Unlike the 16 series, in the 18 series INCF and DECF affect the carry flag. DECF is treated like a subtraction of one. Since for subtraction the carry is treated as "not borrow", the carry will be set for every value except 0x00, which will cause a borrow. Bob Ammerman RAm Systems ----- Original Message ----- From: "Alan B. Pearce" To: Sent: Monday, July 21, 2003 8:22 AM Subject: Re: [PIC] : 18F452 MPLAB SIM Question > >When any GPR is decremented using the DECF instruction, the register > >is getting decremented, but the C bit (STATUS,0) is getting set no > >matter what the value of the register. > > > >Why is this so ? Is this a bug ? Anyone alse face the same problem ? > > What does the instruction set portion of the datasheet say should happen for > this instruction? > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads