PIC16C9XX
DECFSZ
Decrement f, Skip if 0
Syntax:
[ label ] DECFSZ f,d
Operands:
Operation:
0 ≤ f ≤ 127
d ∈ [0,1]
(f) - 1 → (destination);
skip if result = 0
Status Affected: None
Encoding:
00
1011 dfff ffff
Description:
Words:
The contents of register 'f' are decre-
mented. If 'd' is 0 the result is placed in the
W register. If 'd' is 1 the result is placed
back in register 'f'.
If the result is 1, the next instruction, is
executed. If the result is 0, then a NOP is
executed instead making it a 2TCY instruc-
tion.
1
Cycles:
1(2)
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode Read Process Write to
register 'f' data destination
If Skip: (2nd Cycle)
Q1
Q2
Q3
Q4
No-
No-
No-
No-
Operation Operation Operation Operation
Example
HERE
DECFSZ
GOTO
CONTINUE •
•
•
CNT, 1
LOOP
Before Instruction
PC = address HERE
After Instruction
CNT = CNT - 1
if CNT = 0,
PC = address CONTINUE
if CNT ≠ 0,
PC = address HERE+1
GOTO
Unconditional Branch
Syntax:
[ label ] GOTO k
Operands:
0 ≤ k ≤ 2047
Operation:
k → PC<10:0>
PCLATH<4:3> → PC<12:11>
Status Affected: None
Encoding:
10 1kkk kkkk kkkk
Description:
GOTO is an unconditional branch. The
eleven bit immediate value is loaded
into PC bits <10:0>. The upper bits of
PC are loaded from PCLATH<4:3>.
GOTO is a two cycle instruction.
Words:
1
Cycles:
2
Q Cycle Activity:
Q1
Q2
Q3
Q4
1st Cycle Decode Read Process Write to
literal 'k' data
PC
2nd Cycle No-
No-
No-
No-
Operation Operation Operation Operation
Example
GOTO THERE
After Instruction
PC = Address THERE
© 1997 Microchip Technology Inc.
DS30444E - page 127