PIC18F010/020
DS41142A-page 98 Preliminary 2001 Microchip Technology Inc.
TABLE 13-2: PIC18F010/020 INSTRUCTION SET
Mnemonic,
Operands
Description Cycles
16-Bit Instruction Word
Status
Affected
Notes
MSb LSb
BYTE-ORIENTED FILE REGISTER OPERATIONS
ADDWF
ADDWFC
ANDWF
CLRF
COMF
CPFSEQ
CPFSGT
CPFSLT
DECF
DECFSZ
DCFSNZ
INCF
INCFSZ
INFSNZ
IORWF
MOVF
MOVFF
MOVWF
MULWF
NEGF
RLCF
RLNCF
RRCF
RRNCF
SETF
SUBFWB
SUBWF
SUBWFB
SWAPF
TSTFSZ
XORWF
f [,d] [,a]
f [,d] [,a]
f [,d] [,a]
f [,a]
f [,d] [,a]
f [,a]
f [,a]
f [,a]
f [,d] [,a]
f [,d] [,a]
f [,d] [,a]
f [,d] [,a]
f [,d] [,a]
f [,d] [,a]
f [,d] [,a]
f [,d] [,a]
f
s
, f
d
f [,a]
f [,a]
f [,a]
f [,d] [,a]
f [,d] [,a]
f [,d] [,a]
f [,d] [,a]
f [,a]
f [,d] [,a]
f [,d] [,a]
f [,d] [,a]
f [,d] [,a]
f [,a]
f [,d] [,a]
Add WREG and f
Add WREG and Carry bit to f
AND WREG with f
Clear f
Complement f
Compare f with WREG, skip =
Compare f with WREG, skip >
Compare f with WREG, skip <
Decrement f
Decrement f, Skip if 0
Decrement f, Skip if Not 0
Increment f
Increment f, Skip if 0
Increment f, Skip if Not 0
Inclusive OR WREG with f
Move f
Move fs (source) to 1st word
f
d
(destination)2nd wor d
Move WREG to f
Multiply WREG with f
Negate f
Rotate Left f through Carry
Rotate Left f (No Carry)
Rotate Right f through Carry
Rotate Right f (No Carry)
Set f
Subtract f from WREG with
borrow
Subtract WREG from f
Subtract WREG from f with
borrow
Swap nibble s in f
Test f, skip if 0
Exclusive OR WREG with f
1
1
1
1
1
1 (2 or 3)
1 (2 or 3)
1 (2 or 3)
1
1 (2 or 3)
1 (2 or 3)
1
1 (2 or 3)
1 (2 or 3)
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1 (2 or 3)
1
0010
0010
0001
0110
0001
0110
0110
0110
0000
0010
0100
0010
0011
0100
0001
0101
1100
1111
0110
0000
0110
0011
0100
0011
0100
0110
0101
0101
0101
0011
0110
0001
01da
00da
01da
101a
11da
001a
010a
000a
01da
11da
11da
10da
11da
10da
00da
00da
ffff
ffff
111a
001a
110a
01da
01da
00da
00da
100a
01da
11da
10da
10da
011a
10da
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
C, DC, Z, OV, N
C, DC, Z, OV, N
Z, N
Z
Z, N
None
None
None
C, DC, Z, OV, N
None
None
C, DC, Z, OV, N
None
None
Z, N
Z, N
None
None
None
C, DC, Z, OV, N
C, Z, N
Z, N
C, Z, N
Z, N
None
C, DC, Z, OV, N
C, DC, Z, OV, N
C, DC, Z, OV, N
None
None
Z, N
1, 2, 6
1, 2, 6
1,2, 6
2, 6
1, 2, 6
4, 6
4, 6
1, 2, 6
1, 2, 3, 4, 6
1, 2, 3, 4, 6
1, 2, 6
1, 2, 3, 4, 6
4, 6
1, 2, 6
1, 2, 6
1, 6
6
6
1, 2, 6
6
1, 2, 6
6
6
6
1, 2, 6
6
1, 2, 6
4, 6
1, 2, 6
6
BIT-ORIENTED FILE REGISTER OPERATIONS
BCF
BSF
BTFSC
BTFSS
BTG
f, b [,a]
f, b [,a]
f, b [,a]
f, b [,a]
f [,d] [,a]
Bit Clear f
Bit Set f
Bit Test f, Skip if Clear
Bit Test f, Skip if Set
Bit Toggle f
1
1
1 (2 or 3)
1 (2 or 3)
1
1001
1000
1011
1010
0111
bbba
bbba
bbba
bbba
bbba
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
None
None
None
None
None
1, 2, 6
1, 2, 6
3, 4, 6
3, 4, 6
1, 2, 6
Note 1: Wh en a PORT register is modified as a function of itself (e.g., MOVF PORTB, 1, 0), the value used will be that value
present on the pins themselves. For example, if the data latch is ’1’ for a pin configured as input and is driven low by an
external device, the data will be written back with a ’0’.
2: If this instruction is executed on the TMR0 register (and, where applicable, d = 1), the prescaler will be cleared if
assigned.
3: If Program Counte r (PC) is modified or a co nditional test is tru e, the instruction req uires two cy c l es. The seco nd cycle is
executed as a NOP.
4: Som e instructions are 2 word instruc t io ns. The second word of these instru ct i ons w ill be executed as a NOP, unless the
first word of the instructio n re tri eves the information embed ded in the se 16-bits. This ensures that all program memory
locations have a valid ins truction.
5: If the table write starts the write cycle to internal memory, the write will continue until terminated.
6: Mic ro chip Assembler MASM automatically defaults destination bit ’d’ to ’1’, while acces s bi t ’a’ defaults to ’1’ or ’0’
according to address of reg is ter being used.