PIC16C71X
COMF
Complement f
[ label ] COMF f,d
0 ≤ f ≤ 127
DECFSZ
Syntax:
Decrement f, Skip if 0
[ label ] DECFSZ f,d
0 ≤ f ≤ 127
Syntax:
Operands:
Operands:
d
[0,1]
d
[0,1]
Operation:
(f) → (dest)
Operation:
(f) - 1 → (dest); skip if result = 0
Status Affected:
Encoding:
Z
Status Affected:
Encoding:
None
00
1001
dfff
ffff
00
1011
dfff
ffff
The contents of register 'f' are comple-
mented. If 'd' is 0 the result is stored in
W. If 'd' is 1 the result is stored back in
register 'f'.
Description:
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'.
Description:
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
instruction.
Words:
1
1
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Words:
1
Decode
Read
register
'f'
Process
data
Write to
dest
Cycles:
1(2)
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register
'f'
Process
data
Write to
dest
COMF
REG1,0
Example
Before Instruction
REG1
After Instruction
REG1
=
0x13
If Skip:
(2nd Cycle)
Q1
Q2
Q3
Q4
=
=
0x13
0xEC
NOP
NOP
NOP
NOP
W
DECF
Decrement f
[label] DECF f,d
0 ≤ f ≤ 127
HERE
DECFSZ
GOTO
CNT, 1
LOOP
Example
Syntax:
Operands:
CONTINUE •
•
•
d
[0,1]
Before Instruction
Operation:
(f) - 1 → (dest)
PC
=
address HERE
Status Affected:
Encoding:
Z
After Instruction
CNT
if CNT =
PC
if CNT ≠
PC
=
CNT - 1
0,
address CONTINUE
0,
address HERE+1
00
0011
dfff
ffff
Decrement register 'f'. If 'd' is 0 the
result is stored in the W register. If 'd'
is 1 the result is stored back in register
'f'.
Description:
=
=
Words:
1
1
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register
'f'
Process
data
Write to
dest
DECF
CNT, 1
Example
Before Instruction
CNT
=
0x01
Z
=
0
After Instruction
CNT
Z
=
=
0x00
1
1997 Microchip Technology Inc.
DS30272A-page 75