Tutorial (6): Branching and Conditional Instructions in PIC Microcontrollers

19 days ago
54

* One of the most important features of any microprocessor or microcontroller program is its ability to make ‘decisions’.

* Microprocessors generally have within their instruction sets a number of instructions which allow them to test a particular bit, and either continue program execution if a condition is not met or branch to another part of the program if it is.

1) Tests bit b in memory location f and skips just one instruction if the bit is clear.
BTFSC f,b: Bit Test f, Skip if Clear

2) Tests bit b in memory location f and skips just one instruction if the bit is set.
BTFSS f,b : Bit Test f, Skip if Set
3) DECFSZ f,d: Decrement f, Skip if 0
4) INCFSZ f,d: Increment f, Skip if 0

Loading comments...