Appendix A

Instruction Sets

  • Baseline PIC 174–175
  • Comparison Table 176–177
  • 10F2xx 178–180
  • 12F519 181–183
  • 16F6xx 184–186
  • 18Fxxxx 187–193

Baseline PIC MCU Instruction Set

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

MneumonicOperandsDescriptionCycles12-Bit Opcode (MSB…LSB)Status AffectedNotes
Byte-oriented operations
ADDWFf,dADD W with f0001 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
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
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

Unlabelled Table

  1. 1. The ninth 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. 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 and is driven low by an external device, the data will be written back with a “0.”
  3. 3. The instruction TRIS f, where f = 5, 6, or 7 causes the contents of the W register to be written to the tristate latches of PORTA, B or C, respectively.
  4. 4. A “1” forces the pin to a high impedance state and disables the output buffers.

Comparison Table

10Fxxx12Fxxx16Fxxx18Fxxx10Fxxx12Fxxx16Fxxx18Fxxx
ADDLWADDLWMOVLWMOVLWMOVLWMOVLW
ADDWFADDWFADDWFADDWFMOVWFMOVWFMOVWFMOVWF
ADDWFCMULLW
ANDLWANDLWANDLWANDLWMULWF
ANDWFANDWFANDWFANDWFNEGF
BCNOPNOPNOPNOP
BCFBCFBCFBCFOPTIONOPTION
BNPOP
BNCPUSH
BNNRCALL
BNOVRESET
BNZRETFIERETFIERETFIE
BOVRETLWRETLWRETLWRETLW
BRA
BSFBSFBSFBSFRETURNRETURNRETURN
BTFSCBTFSCBTFSCBTFSCRLCFRLCF
BTFSSBTFSSBTFSSBTFSSRLFRLFRLF
BTGRRFRRFRRF
BZRLNCF
CALLCALLCALLCALLRRCF
CLRFCLRFCLRFCLRFRRNCF
CLRWCLRWCLRWSETF
CLRWDTCLRWDTCLRWDTCLRWDTSLEEPSLEEPSLEEPSLEEP
COMFCOMFCOMFCOMFSUBFWB
CPFSEQSUBLWSUBLW
CPFSGTSUBWFSUBWFSUBWFSUBWF
CPFSLTSUBWFB
DAWSWAPFSWAPFSWAPFSWAPF
DCFSNZTBLRD*
DECFDECFDECFDECFTBLRD*−
DECFSZDECFSZDECFSZDECFSZTBLRD*+
GOTOGOTOGOTOGOTOTBLRD +*
INCFINCFINCFINCFTBLWT*
INCFSZINCFSZINCFSZINCFSZTBLWT*−
INFSNZTBLWT*+
IORLWIORLWIORLWIORLWTBLWT +*
IORWFIORWFIORWFIORWFTRIS
LFSRTRISGPIO
MOVFMOVFMOVFMOVFTSTFSZ
MOVFFXORLWXORLWXORLWXORLW
MOVLBXORWFXORWFXORWFXORWF

Unlabelled Table

Unlabelled Image

Unlabelled Image
Unlabelled Image

Unlabelled Image

Unlabelled Image
Unlabelled Image

Unlabelled Image

Unlabelled Image
Unlabelled Image

Unlabelled Image

Unlabelled Image
Unlabelled Image
Unlabelled Image
Unlabelled Image
Unlabelled Image
Unlabelled Image
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.79.88