14-Bit Core Instruction Set
Microchip's mid-range 8-bit microcontroller family uses a 14-bit wide instruction set. This instruction set consists of 36 instructions, each a single 14-bit wide word. Most instructions operate on a file register, f, and the working register, WREG (accumulator). The result can be directed either to the file register or the WREG register or to both in the case of some instructions. A few instructions operate solely on a file register (BSF, for example).
The instruction set is grouped into the following catagories: Byte-oriented file register operations, bit-oriented file register operations, and core literal and control operations. Instructions are listed by catagory in the tables below. Instruction opcode is show in Hex by certain making assumptions, either listed in the key or as a footnote. For more information on the opcode bit values for each instruction, as well as the number of cycles per instruction, status bits affected and complete instruction details, see the relevent device data sheet.
Table: 14-Bit Core Byte-Oriented File Register Operations
Hex
|
Mnemonic
|
Description
|
Function
|
07df
|
ADDWF
|
f,d
|
Add W and f
|
W + f → d
|
05df
|
ANDWF
|
f,d
|
AND W and f
|
W .AND. f → d
|
01'1'f
|
CLRF
|
f
|
Clear f
|
0 → f
|
01xx
|
CLRW
|
|
Clear W
|
0 → W
|
09df
|
COMF
|
f,d
|
Complement f
|
.NOT. f → d
|
03df
|
DECF
|
f,d
|
Decrement f
|
f - 1 → d
|
0Bdf
|
DECFSZ
|
f,d
|
Decrement f, skip if zero
|
f - 1 → d, skip if 0
|
0Adf
|
INCF
|
f,d
|
Increment f
|
f + 1 → d
|
0Fdf
|
INCFSZ
|
f,d
|
Increment f, skip if zero
|
f + 1 → d, skip if 0
|
04df
|
IORWF
|
f,d
|
Inclusive OR W and f
|
W .OR. f → d
|
08df
|
MOVF
|
f,d
|
Move f
|
f → d
|
00'1'f
|
MOVWF
|
f
|
Move W to f
|
W → f
|
0000
|
NOP
|
|
No operation
|
|
0Ddf
|
RLF
|
f,d
|
Rotate left f
|
|
0Cdf
|
RRF
|
f,d
|
Rotate right f
|
|
02df
|
SUBWF
|
f,d
|
Subtract W from f
|
f - W → d
|
0Edf
|
SWAPF
|
f,d
|
Swap halves f
|
f(0:3) ↔ f(4:7) → d
|
06df
|
XORWF
|
f,d
|
Exclusive OR W and f
|
W .XOR. f → d
|
Table: 14-Bit Core Bit-Oriented File Register Operations
Hex
|
Mnemonic
|
Description
|
Function
|
4bf
|
BCF
|
f,b
|
Bit clear f
|
0 → f(b)
|
5bf
|
BSF
|
f,b
|
Bit set f
|
1 → f(b)
|
6bf
|
BTFSC
|
f,b
|
Bit test, skip if clear
|
skip if f(b) = 0
|
7bf
|
BTFSS
|
f,b
|
Bit test, skip if set
|
skip if f(b) = 1
|
Table: 14-Bit Core Literal and Control Operations
Hex
|
Mnemonic
|
Description
|
Function
|
3Ekk
|
ADDLW
|
kk
|
Add literal to W
|
kk + WREG → WREG
|
39kk
|
ANDLW
|
kk
|
AND literal and W
|
kk .AND. WREG → WREG
|
2'0'kkk
|
CALL
|
kkk
|
Call subroutine
|
PC + 1 → TOS, kk → PC
|
0064
|
CLRWDT
|
|
Clear watchdog timer
|
0 → WDT (and Prescaler if assigned)
|
2'1'kkk
|
GOTO
|
kkk
|
Goto address (k is nine bits)
|
kk → PC(9 bits)
|
38kk
|
IORLW
|
kk
|
Incl. OR literal and W
|
kk .OR. WREG → WREG
|
30kk
|
MOVLW
|
kk
|
Move Literal to W
|
kk → WREG
|
0062
|
OPTION
|
|
Load OPTION register
|
WREG → OPTION Register
|
0009
|
RETFIE
|
|
Return from Interrupt
|
TOS → PC, 1 → GIE
|
34kk
|
RETLW
|
kk
|
Return with literal in W
|
kk → WREG, TOS → PC
|
0008
|
RETURN
|
|
Return from subroutine
|
TOS → PC
|
0063
|
SLEEP
|
|
Go into Standby Mode
|
0 → WDT, stop oscillator
|
3Ckk
|
SUBLW
|
kk
|
Subtract W from literal
|
kk - WREG → WREG
|
006r
|
TRIS
|
r
|
Tristate port r
|
WREG → I/O control reg r
|
3Akk
|
XORLW
|
kk
|
Exclusive OR literal and W
|
kk .XOR. WREG → WREG
|
Table: 12-Bit/14-Bit Core Special Instruction Mnemonics
Mnemonic
|
Description
|
Equivalent
Operation(s)
|
Status
|
ADDCF
|
f,d
|
Add Carry to File
|
BTFSC
INCF
|
3,0
f,d
|
Z
|
ADDDCF
|
f,d
|
Add Digit Carry to File
|
BTFSC
INCF
|
3,1
f,d
|
Z
|
B
|
k
|
Branch
|
GOTO
|
k
|
-
|
BC
|
k
|
Branch on Carry
|
BTFSC
GOTO
|
3,0
k
|
-
|
BDC
|
k
|
Branch on Digit Carry
|
BTFSC
GOTO
|
3,1
k
|
-
|
BNC
|
k
|
Branch on No Carry
|
BTFSS
GOTO
|
3,0
k
|
-
|
BNDC
|
k
|
Branch on No Digit Carry
|
BTFSS
GOTO
|
3,1
k
|
-
|
BNZ
|
k
|
Branch on No Zero
|
BTFSS
GOTO
|
3,2
k
|
-
|
BZ
|
k
|
Branch on Zero
|
BTFSC
GOTO
|
3,2
k
|
-
|
CLRC
|
|
Clear Carry
|
BCF
|
3,0
|
-
|
CLRDC
|
|
Clear Digit Carry
|
BCF
|
3,1
|
-
|
CLRZ
|
|
Clear Zero
|
BCF
|
3,2
|
-
|
LCALL
|
k
|
Long Call
|
BCF/BSF
BCF/BSF
CALL
|
0x0A,3
0x0A,4
k
|
|
LGOTO
|
k
|
Long GOTO
|
BCF/BSF
BCF/BSF
GOTO
|
0x0A,3
0x0A,4
k
|
|
MOVFW
|
f
|
Move File to W
|
MOVF
|
f,0
|
Z
|
NEGF
|
f,d
|
Negate File
|
COMF
INCF
|
f,1
f,d
|
Z
|
SETC
|
|
Set Carry
|
BSF
|
3,0
|
-
|
SETDC
|
|
Set Digit Carry
|
BSF
|
3,1
|
-
|
SETZ
|
|
Set Zero
|
BSF
|
3,2
|
-
|
SKPC
|
|
Skip on Carry
|
BTFSS
|
3,0
|
-
|
SKPDC
|
|
Skip on Digit Carry
|
BTFSS
|
3,1
|
-
|
SKPNC
|
|
Skip on No Carry
|
BTFSC
|
3,0
|
-
|
SKPNDC
|
|
Skip on No Digit Carry
|
BTFSC
|
3,1
|
-
|
SKPNZ
|
|
Skip on Non Zero
|
BTFSC
|
3,2
|
-
|
SKPZ
|
|
Skip on Zero
|
BTFSS
|
3,2
|
-
|
SUBCF
|
f,d
|
Subtract Carry from File
|
BTFSC
DECF
|
3,0
f,d
|
Z
|
SUBDCF
|
f,d
|
Subtract Digit Carry from File
|
BTFSC
DECF
|
3,1
f,d
|
Z
|
TSTF
|
f
|
Test File
|
MOVF
|
f,1
|
Z
|