Microchip
17CXX Instruction Set Tables

Instruction general structure:

Type 1 (most) :
Bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Coding : opcode (7 bits) d f (8 bits)

Where : d range : (0 -  1 dec) ( 1 bit  )  
        f range : (0 - 31 dec) ( 5 bits )

Type 2 (ANDLW, CALL, IORLW, MOVLW, RETLW, XORLW) :
Bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Coding : opcode (8 bits) k(8 bits)

Where : k range : (0 - 255 dec) ( 8 bits )  

Type 3 (CLRW, CLRWDT, NOP, OPTION, SLEEP) :
Bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Coding : opcode (16 bits)

Type 4 (BCF, BSF, BTFSC, BTFSS) :
Bit : 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Coding : opcode (5 bits) b (3 bits) f (8 bits)


Instruction Set Summary:

Instruction Syntax Operation Encoding Words Cycles Flags
ADDLW ADDLW k (W) + k → W 1011 0001 kkkk kkkk 1 1 OV,C,DC,Z
ADDWF ADDWF f,d (W) + (f) → d 0000 111d ffff ffff 1 1 OV,C,DC,Z
ADDWFC ADDWFC f,d (W) + (f) + C → d 0001 000d ffff ffff 1 1 OV,C,DC,Z
ANDLW ANDLW k (W) .AND. (k) → W 1011 0101 kkkk kkkk 1 1 Z
ANDWF ANDWF f,d (W) .AND. (f) → d 0000 101d ffff ffff 1 1 Z
BCF BCF f,b 0 → f(b) 1000 1bbb ffff ffff 1 1 None
BSF BSF f,b 1 → f(b) 1000 0bbb ffff ffff 1 1 None
BTFSC BTFSC f,b skip if bit(b) in file(f) is clear 1001 1bbb ffff ffff 1 1(2) None
BTFSS BTFSS f,b skip if bit(b) in file(f) is set 1001 0bbb ffff ffff 1 1(2) None
BTG BTG f,b toggles bit(b) in file(f) 0011 1bbb ffff ffff 1 1 None
CALL CALL k PC+1 → Stack, k → PC<12:0>,
k<12:8> → PCLATH<4:0>,
PC<15:13> → PCLATH<7:5>
111k kkkk kkkk kkkk 1 2 None
CLRF CLRF f 00h → f,   s ∈ [0,1],   00h → (dest) 0010 100s ffff ffff 1 1 None
CLRWDT CLRWDT 00h → WDT, 0 → WDT prescaler 0000 0000 0000 0100 1 1 TO,PD
COMF COMF f,d neg(f) → d 0001 001d ffff ffff 1 1 Z
CPFSEQ CPFSEQ f skip if (f) = (W) 0011 0001 ffff ffff 1 1(2) None
CPFSGT CPFSGT f skip if (f) > (W) 0011 0010 ffff ffff 1 1(2) None
CPFSLT CPFSLT f skip if (f) < (W) 0011 0000 ffff ffff 1 1(2) None
DAW DAW f,s Decimal adjust W reg, see specific page for details 0010 111s ffff ffff 1 1 C
DECF DECF f,d (f - 1) → d 0000 011d ffff ffff 1 1 OV,C,DC,Z
DECFSZ DECFSZ f,d (f - 1) → d, skip if result = 0 0001 011d ffff ffff 1 1(2) None
DCFSNZ DCFSNZ f,d (f - 1) → d, skip if result ≠ 0 0010 011d ffff ffff 1 1(2) None
GOTO GOTO k k→PC<12:0>, k<12:8>→PCLATH<4:0>,
PC<15:13>→PCLATH<7:5>
110k kkkk kkkk kkkk 1 2 None
INCF INCF f,d (f + 1) → d 0001 010d ffff ffff 1 1 OV,C,DC,Z
INCFSZ INCFSZ f,d (f + 1) → d, skip if result = 0 0001 111d ffff ffff 1 1(2) None
INFSNZ INFSNZ f,d (f + 1) → d, skip if result ≠ 0 0010 010d ffff ffff 1 1(2) None
IORLW IORLW k (W .OR. k) → W 1011 0011 kkkk kkkk 1 1 Z
IORWF IORWF f,d (f .OR. W) → d 0000 100d ffff ffff 1 1 Z
LCALL LCALL k PC+1 → TOS, k→PCL, (PCLATH)→PCH 1011 0111 kkkk kkkk 1 2 None
MOVFP MOVFP f,p (f) → (p) 011p pppp ffff ffff 1 1 None
MOVLB MOVLB k k → BSR<3:0> 1011 1000 uuuu kkkk 1 1 None
MOVLR MOVLR k k → BSR<7:4> 1011 101x kkkk uuuu 1 1 None
MOVLW MOVLW k k → W 1011 0000 kkkk kkkk 1 1 None
MOVPF MOVPF p,f (p) → (f) 010p pppp ffff ffff 1 1 Z
MOVWF MOVWF f W → f 0000 0001 ffff ffff 1 1 None
MULLW MULLW k (k) x (W) → PRODH:PRODL 1011 1100 kkkk kkkk 1 1 None
MULWF MULWF f (f) x (W) → PRODH:PRODL 0011 0100 ffff ffff 1 1 None
NEGW NEGW f,s -(W) → (f), -(W) → s 0010 110s ffff ffff 1 1 OV,C,DC,Z
NOP NOP No operation 0000 0000 0000 0000 1 1 None
RETFIE RETFIE Stack → PC,   0 → GLINTD,   PCLATH unchanged. 0000 0000 0000 0101 1 2 GLINTD
RETLW RETLW k k → W, Stack → PC, PCLATH unchanged. 1011 0110 kkkk kkkk 1 2 None
RETURN RETURN Stack → PC, PCLATH is unchanged. 0000 0000 0000 0010 1 2 None
RLCF RLCF f,d f(n) → d(n+1), C → d(0), f(7) → C 0001 101d ffff ffff 1 1 C
RLNCF RLNCF f,d f(n) → d(n+1), f(7) → d(0) 0010 001d ffff ffff 1 1 None
RRCF RRCF f,d f(n) → d(n-1), C → d(7), f(0) → C 0001 100d ffff ffff 1 1 C
RRNCF RRNCF f,d f(n) → d(n-1), f(0) → d(7) 0010 000d ffff ffff 1 1 None
SETF SETF f,s FFh → f, FFh → d 0010 101s ffff ffff 1 1 None
SLEEP SLEEP 0→PD, 1→TO, 00h→WDT, 0→WDT prescaler 0000 0000 0000 0011 1 1 TO, PD
SUBLW SUBLW k k - (W) → W 1011 0010 kkkk kkkk 1 1 OV,C,DC,Z
SUBWF SUBWF f,d (f - W) → d 0000 010d ffff ffff 1 1 OV,C,DC,Z
SUBWFB SUBWFB f,d (f) - (W) - not(C) → (d) 0000 001d ffff ffff 1 1 OV,C,DC,Z
SWAPF SWAPF f,d f<0:3> → d<4:7>, f<4:7> → d<0:3> 0001 110d ffff ffff 1 1 None
TABLRD TABLRD t,i,f Table Read, see specific page for details 1010 10ti ffff ffff 1 2(3) None
TABLWT TABLWT t,i,f Table Write, see specific page for details 1010 11ti ffff ffff 1 2(many) None
TLRD TLRD t,f if t=0, TBLATL → f;   if t=1, TBLATH → f 1010 00tx ffff ffff 1 1 None
TLWT TLWT t,f if t=0, f → TBLATL;   if t=1, f → TBLATH 1010 01tx ffff ffff 1 1 None
TSTFSZ TSTFSZ f skip if f=0 0011 0011 ffff ffff 1 1 None
XORLW XORLW k (W .XOR. k) → W 1011 0100 kkkk kkkk 1 1 Z
XORWF XORWF f,d (W .XOR. f) → d 0000 110d ffff ffff 1 1 Z

Status Word Flags (Memory Location 03h)
Bit Flag Description
0 C Carry
1 DC Digit Carry/Borrow
2 Z Zero
3 PD Power Down
4 TO Time Out

(d) field values:
d destination
0 W
1 f

Back