
2004 Microchip Technology Inc.
Preliminary
DS39646B-page 71
PIC18F8722 FAMILY
5.2.4
TWO-WORD INSTRUCTIONS
The standard PIC18 instruction set has 8 two-word
instructions:
CALL
,
MOVFF
,
GOTO
,
LSFR, ADDULNK,
CALLW, MOVSS
and
SUBULNK
. In all cases, the
second word of the instructions always has ‘
1111
’ as
its four Most Significant bits; the other 12 bits are literal
data, usually a data memory address.
The use of ‘
1111
’ in the 4 MSbs of an instruction spec-
ifies a special form of
NOP
. If the instruction is executed
in proper sequence – immediately after the first word –
the data in the second word is accessed and used by
the instruction sequence. If the first word is skipped for
some reason and the second word is executed by itself,
a
NOP
is executed instead. This is necessary for cases
when the two-word instruction is preceded by a condi-
tional instruction that changes the PC. Example 5-4
shows how this works.
EXAMPLE 5-4:
CASE 1:
Object Code
0110 0110 0000 0000
1100 0001 0010 0011
1111 0100 0101 0110
0010 0100 0000 0000
CASE 2:
Object Code
0110 0110 0000 0000
1100 0001 0010 0011
1111 0100 0101 0110
0010 0100 0000 0000
TWO-WORD INSTRUCTIONS
Note:
See
Section 5.6 “PIC18 Instruction
Execution and the Extended Instruc-
tion Set”
for information on two-word
instructions in the extended instruction set.
Source Code
TSTFSZ
MOVFF
REG1
REG1, REG2 ; No, skip this word
; Execute this word as a NOP
REG3
; continue code
; is RAM location 0
ADDWF
Source Code
TSTFSZ
MOVFF
REG1
REG1, REG2 ; Yes, execute this word
; 2nd word of instruction
REG3
; continue code
; is RAM location 0
ADDWF