PIC16F5X
ADDWF
Syntax:
Add W and f
ANDWF
Syntax:
AND W with f
[ label ] ADDWF f, d
[ label ] ANDWF f, d
Operands:
0 ≤ f ≤ 31
d ∈ [0,1]
Operands:
0 ≤ f ≤ 31
d ∈ [0,1]
Operation:
(W) + (f) → (dest)
Operation:
(W) .AND. (f) → (dest)
Status Affected: C, DC, Z
Status Affected:
Encoding:
Z
Encoding:
0001
11df
ffff
0001
01df
ffff
Description:
Add the contents of the W register
and 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:
The contents of the W register are
AND’ed with 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
Words:
1
Cycles:
Example:
1
Cycles:
Example:
1
ADDWF TEMP_REG, 0
ANDWF TEMP_REG, 1
Before Instruction
Before Instruction
W
=
0x17
W
=
0x17
TEMP_REG = 0xC2
After Instruction
TEMP_REG = 0xC2
After Instruction
W
=
0xD9
W
=
0x17
TEMP_REG = 0xC2
TEMP_REG = 0x02
ANDLW
AND literal with W
BCF
Bit Clear f
Syntax:
[ label ] ANDLW
0 ≤ k ≤ 255
k
Syntax:
[ label ] BCF f, b
Operands:
Operation:
Status Affected:
Encoding:
Operands:
0 ≤ f ≤ 31
0 ≤ b ≤ 7
(W).AND. (k) → (W)
Operation:
0 → (f<b>)
Z
Status Affected: None
1110
kkkk
kkkk
Encoding:
Description:
Words:
0100
bbbf
ffff
Description:
The contents of the W register are
AND’ed with the eight-bit literal ‘k’.
The result is placed in the W
register.
Bit ‘b’ in register ‘f’ is cleared.
1
1
Cycles:
Words:
1
Example:
BCF
FLAG_REG,
7
Cycles:
Example:
1
Before Instruction
FLAG_REG = 0xC7
After Instruction
FLAG_REG = 0x47
ANDLW H'5F'
Before Instruction
W
=
0xA3
After Instruction
0x03
W
=
© 2007 Microchip Technology Inc.
DS41213D-page 43