Instruction Set

Baseline 8-bit PIC® MCU Instruction Set

This applies to the PIC10F2xx, PIC12C5xx, PIC12F5xx, PIC16C5xx, and PIC16F5xx families.

Byte Oriented Operations
Mnemonic,
Operands
DescriptionCycles12-bit Opcode
MSb……LSb
Status
Affected
Notes
ADDWFf,dAdd W and f10001 11df ffffC,DC,Z1,2,4
ANDWFf,dAND W with f10001 01df ffffZ2,4
CLRFfClear f10000 011f ffffZ4
CLRWClear W10000 0100 0000Z
COMFf,dComplement f10010 01df ffffZ
DECFf,dDecrement f10000 11df ffffZ2,4
DECFSZf,dDecrement f, Skip if 01(2)0010 11df ffffNone2,4
INCFf,dIncrement f10010 10df ffffZ2,4
INCFSZf,dIncrement f, Skip if 01(2)0011 11df ffffNone2,4
IORWFf,dInclusive OR W with f10001 00df ffffZ2,4
MOVFf,dMove f10010 00df ffffZ2,4
MOVWFfMove W to f10000 001f ffffNone1,4
NOPNo Operation10000 0000 0000None
RLFf,dRotate left f through Carry10011 01df ffffC2,4
RRFf,dRotate right f through Carry10011 00df ffffC2,4
SUBWFf,dSubtract W from f10000 10df ffffC,DC,Z1,2,4
SWAPFf,dSwap f10011 10df ffffNone2,4
XORWFf,dExclusive OR W with f10001 10df ffffZ2,4
Bit Oriented Operations
Mnemonic,
Operands
DescriptionCycles12-bit Opcode
MSb……LSb
Status
Affected
Notes
BCFf,bBit Clear f10100 bbbf ffffNone2,4
BSFf,bBit Set f10101 bbbf ffffNone2,4
BTFSCf,bBit Test f, Skip if Clear1(2)0110 bbbf ffffNone
BTFSSf,bBit Test f, Skip if Set1(2)0111 bbbf ffffNone
Literal and Control Operations
Mnemonic,
Operands
DescriptionCycles12-bit Opcode
MSb……LSb
Status
Affected
Notes
ANDLWkAND literal with W11110 kkkk kkkkZ
CALLkSubroutine Call21001 kkkk kkkkNone1
CLRWDTClear Watchdog Timer10000 0000 0100TO,PD
GOTOkUnconditional Branch2101k kkkk kkkkNone
IORLWkInclusive OR literal with W11101 kkkk kkkkZ
MOVLWkMove literal to W11100 kkkk kkkkNone
OPTIONLoad OPTION register10000 0000 0010None
RETLWkReturn, place literal in W21000 kkkk kkkkNone
SLEEPGo into standby mode10000 0000 0011TO,PD
TRISfLoad TRIS register10000 0000 0fffNone3
XORLWkExclusive OR literal with W11111 kkkk kkkkZ

Notes

  1. The 9th bit of the program counter will be forced to a ‘0’ by any instruction that writes to the PC except for GOTO (see Section 3.5 “Program Counter” for more on program counter).
  2. When an I/O register is modified as a function of itself (e.g., MOVF PORTB, 1), 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 andis driven low by an external device, the data will be written back with a ‘0’.
  3. The instructionTRIS f, where f = 5, 6 or 7 causes the contents of the W register to be written to the tri-state latches of PORTA, B or C, respectively. A ‘1’ forces the pin to a high-impedance state and disables the output buffers.
  4. If this instruction is executed on the TMR0 register (and, where applicable, d = 1), the prescaler will be cleared (if assigned to TMR0)