|
PIC16F627A_05 Datasheet, PDF (119/180 Pages) Microchip Technology – Flash-Based, 8-Bit CMOS Microcontrollers with nanoWatt Technology | |||
|
◁ |
PIC16F627A/628A/648A
15.2 Instruction Descriptions
ADDLW
Syntax:
Operands:
Operation:
Status Affected:
Encoding:
Description:
Words:
Cycles:
Example
Add Literal and W
[ label ] ADDLW k
0 ⤠k ⤠255
(W) + k â (W)
C, DC, Z
11
111x kkkk kkkk
The contents of the W register
are added to the eight bit literal
âkâ and the result is placed in the
W register.
1
1
ADDLW 0x15
Before Instruction
W = 0x10
After Instruction
W = 0x25
ANDLW
Syntax:
Operands:
Operation:
Status Affected:
Encoding:
Description:
Words:
Cycles:
Example
AND Literal with W
[ label ] ANDLW k
0 ⤠k ⤠255
(W) .AND. (k) â (W)
Z
11
1001 kkkk kkkk
The contents of W register are
ANDâed with the eight bit literal
âkâ. The result is placed in the W
register.
1
1
ANDLW 0x5F
Before Instruction
W = 0xA3
After Instruction
W = 0x03
ADDWF
Syntax:
Operands:
Operation:
Status Affected:
Encoding:
Description:
Words:
Cycles:
Example
Add W and f
[ label ] ADDWF f,d
0 ⤠f ⤠127
d â [0,1]
(W) + (f) â (dest)
C, DC, Z
00
0111 dfff ffff
Add the contents of the W
register 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â.
1
1
ADDWF REG1, 0
Before Instruction
W = 0x17
REG1 = 0xC2
After Instruction
W = 0xD9
REG1 = 0xC2
Z =0
C =0
DC = 0
ANDWF
Syntax:
Operands:
Operation:
Status Affected:
Encoding:
Description:
Words:
Cycles:
Example
AND W with f
[ label ] ANDWF f,d
0 ⤠f ⤠127
d â [0,1]
(W) .AND. (f) â (dest)
Z
00
0101 dfff ffff
AND the W register 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â.
1
1
ANDWF REG1, 1
Before Instruction
W = 0x17
REG1 = 0xC2
After Instruction
W = 0x17
REG1 = 0x02
© 2005 Microchip Technology Inc.
DS40044D-page 117
|
▷ |