PIC16C62X
SUBLW
Subtract W from Literal
SUBWF
Syntax:
Subtract W from f
Syntax:
[ label ]
SUBLW k
[ label ]
SUBWF f,d
Operands:
Operation:
0 ≤ k ≤ 255
Operands:
0 ≤ f ≤ 127
d
[0,1]
k - (W) → (W)
Operation:
(f) - (W) → (dest)
Status
C, DC, Z
Affected:
Status
C, DC, Z
Affected:
Encoding:
11
110x
kkkk
kkkk
Encoding:
00
0010
dfff
ffff
The W register is subtracted (2’s com-
plement method) from the eight bit literal
'k'. The result is placed in the W register.
Description:
Subtract (2’s complement method)
Description:
W register from 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'.
Words:
1
1
Cycles:
Words:
1
1
Example 1:
SUBLW
0x02
Cycles:
Before Instruction
Example 1:
SUBWF
REG1,1
W
C
=
=
1
?
Before Instruction
REG1
W
C
=
=
=
3
2
?
After Instruction
W
=
1
C
=
1; result is posi-
After Instruction
tive
REG1
W
C
=
=
=
1
2
Example 2:
Example 3:
Before Instruction
W
C
=
=
2
?
1; result is positive
Example 2:
Before Instruction
After Instruction
REG1
W
C
=
=
=
2
2
?
W
C
=
=
0
1; result is zero
Before Instruction
After Instruction
W
C
=
=
3
?
REG1
W
C
=
=
=
0
2
1; result is zero
After Instruction
Example 3:
Before Instruction
W
=
0xFF
C
tive
=
0; result is nega-
REG1
W
C
=
=
=
1
2
?
After Instruction
REG1
W
C
=
=
=
0xFF
2
0; result is negative
1998 Microchip Technology Inc.
Preliminary
DS30235G-page 71