up: microprocessors - microchip pics  
Programming MicroCHip PIC's
Assembly Language
What links here?
MPASM Manual



Here, COUNT declares a name the holds the value 08h. In this case, the label is used as a name for a memory location. LABEL defines a name for the location of the instruction that follows it on the line. This label can then be used as the target of goto's and call's. The actual value of LABEL is generated by the assembler.

Pseudo-opcodes



OpcodeMeaning
orgaddrsets the address the next instruction will be assembled at.
end signals the end of source.

Opcodes





















































Byte-Oriented File Register Operations
MnemonicDescriptionFunction
ADDWFf,dAdd W and f (d) := (W) + (f)
ANDWFf,dAND W and f (d) := (W) AND (f)
CLRFfClear f (f) := 0
CLRW Clear WW :=0
COMFf,dComplement d := f NOT f
DECFf,dDecrement d := f - 1
DECFSZf,d Decrement f, skip if zero d := f - 1, skip if 0
INCFf,d Increment f d := f + 1
INCFSZf,d Increment f, skip if zero d := f + 1, skip if 0
IORWFf,d Inclusive OR W and f d := W OR f
MOVFf,d Move f d := f
MOVWFf Move W to f f := W
NOP No operation 
RLFf,d Rotate left f 
RRFf,d Rotate right f 
SUBWFf,d Subtract W from f d := f - W
SWAPFf,d Swap halves f f(0:3) ? f(4:7) ? d
XORWFf,d Exclusive OR W and f d := W .XOR. f
Bit-Oriented File Register Operations
MnemonicDescriptionFunction
BCF f,b Bit b in register f is clearedf(b) := 0
BSF f,b Bit b in register f is setf(b) := 1
BTFSC f,b test bit b of register f, skip next instruction if clear skip if f(b) = 0
BTFSS f,b test bit b of register f, skip next instruction if set skip if f(b) = 1
Literal and Control Operations
MnemonicDescriptionFunction
ADDLW kk Add literal to W (W) := kk + (W)
ANDLW kk AND literal and W (W) := kk AND (W)
CALL kkk Call subroutine TOS := PC + 1
PC := kk
PC<12:11> := (PCLATH<4:3>)
CLRWDT   Clear watchdog timer WDT (and Prescaler if assigned) := 0
GOTO kkk Goto address (k is nine bits) PC(9 bits) := kkk
IORLW kk Incl. OR literal and W WREG := kk OR WREG
MOVLWkk Move Literal to W WREG := kk
OPTION   Load OPTION register (1) OPTION Register := WREG
RETFIE   Return from Interrupt PC := TOS, GIE := 1
RETLW kk Return with literal in W WREG := kk, PC := TOS
RETURN   Return from subroutine PC := TOS
SLEEP   Go into Standby Mode WDT := 0, stop oscillator
SUBLW kk Subtract W from literal WREG := kk - WREG
TRIS r Tristate port r (1)I/O control reg r := WREG
XORLW kk Exclusive OR literal and W WREG := kk XOR WREG
f = register file address (0x00 to 0x7F)


W = working register (accumulator)
b = bit address within an 8-bit file register
k = literal field, constant data or label
x = don't care location
d = destination select


  • d = 0: store result in W
  • d = 1 : store result in f
  • PC = program counter
    TO = time-out bit


    PD = power-down bit


    programming:microchip pics:pic assembly language
    programming - windows - listbox styles
    programming:c:c io.h
    Welding Tip Sizes
    microprocessors - microchip pics - programming interface
    electronics - Flash RAM 32K x 8 bit 28F256
    programming - Libre Calc - reading and writing cell contents
    filename:programming:microchip pics:pic assembly language
    filename:programming%3Amicrochip%20pics%3Apic%20assembly%20language
    last edit:June 12 2011 21:29:38 (5020 days ago)
    ct = 1741678781.000000 = March 11 2025 03:39:41
    ft = 1307928578.000000 = June 12 2011 21:29:38
    dt = 433750203.000000