Specifications
mikroElektronika | Free Online Book | PIC Microcontrollers | Chapter 9: Instruction Set
register. If d = f or d = 1, the result is stored in register f. If the result is 0, then a NOP is
executed instead, making this a two-cycle instruction.
Operation: (f) - 1 -> d
Operand: 0 ≤ f ≤ 127, d[0,1]
Status affected: -
Number of cycles: 1 or 2 depending on the result.
EXAMPLE 1:
....
MOVLW .10
MOVWF CNT ;10 -> CNT
Loop ......
...... ;Instruction block
......
DECFSZ CNT,f ; decrement REG by one
GOTO Loop ; Skip this line if = 0
LAB_03 ....... ; Jump here if = 0
In this example, instruction block is executed as many times as the initial value of the
variable CNT is, which in this example is 10.
GOTO - Unconditional Branch
Syntax: [label] GOTO k
Description: Unconditional jump to the address k.
Operation: (k) -> PC(10:0), (PCLATH(4:3)) -> PC(12:11)
Operand: 0 ≤ k ≤ 2047
Status affected: -
Number of cycles: 2
EXAMPLE :
....
LAB_00 GOTO LAB_01 ; Jump to LAB_01
http://www.mikroe.com/en/books/picmcubook/ch9/ (17 of 35)5/3/2009 11:35:12 AM