Loading...
Pic Programming

Instruction Set

PIC16F84 INSTRUCTION SET

 

Literal and control instructions:

Mnemonic

Description

Function

addlw              k

Add literal to W

k + W =>W

andlw              k

AND literal and W

k  .AND.  W => W

call                   k

Call subroutine

PC + 1 => TOS,  k  => PC

clrwdt

Clear watchdog timer

0 => WDT (and prescaler if assigned)

goto                 k

Goto address (k is nine bits)

k =>  PC  (9 bits)

iorlw                k

Incl. OR literal and W

k  .OR.  W =>  W

movlw             k

Move Literal to W

k =>  W

option

Load OPTION register

W =>  OPTION Register

retfie

Return from Interrupt

TOS  =>  PC,  1  =>  GIE

retlw                k

Return with literal in W

k  => W,  TOS  =>  PC

return

Return from subroutine

TOS  =>  PC

sleep

Go into Standby Mode

0  =>  WDT,  stop oscillator

sublw              k

Subtract W from literal

K  -  W  =>  W

tris                   f

Configure port f (downward compat. instr.)

W  =>  I/0 control reg f

xorlw                k

Exclusive OR literal and W

k  .XOR.  W  =>  W

Byte-oriented instructions:

Mnemonic

Description

Function

addwf              f,d

Add W and f

W + f  =>  d

andwf              f,d

AND W and f

W  .AND.  f  =>  d

clrf                    f

Clear f

0  =>  f

clrw

Clear W

0  =>  W

comf                f,d

Complement f

.NOT.  f  =>  d

decf                 f,d

Decrement f

f  -  =>  d

decfsz             f,d

Decrement f, skip if zero

f  -  1  =>  d,  skip if 0

incf                   f,d

Increment f

f  +  1  =>  d

incfsz               f,d

Increment f,  skip if zero

f  +  1  =>  d, skip if 0

iorwf                f,d

Inclusive OR W and f

W  .OR.  f  =>  d

movf                f,d

Move f

f  =>  d

movwf             f

Move W to f

W  =>  f

nop

No operation

 
    rlf                    f,d     Rotate left f
   rrf                     f,d    Rotate right f
   subwf              f,d    Subtract W from f  f  - W  =>  d
   swapf              f,d    Swap halves f  f(0:3)  «  f(4:7)  =>  d
   xorwf            f,d    Exclusive OR W and f  W  .XOR.  f  =>  d

Bit-oriented instructions:

Mnemonic

Description

Function

bcf                    f,b

Bit clear f

0  =>  f(b)

bsf                   f,b

Bit set f

1  =>  f(b)

btfsc                f,b

Bit test, skip next instruction if clear

skip if  f(b) = 0

btfss                f,b

Bit test, skip next instruction if set

skip if  f(b) = 1

Key:

Field

Description

b

Bit address within an 8-bit file register

d

Destination select;

d = 0

Store result in W

   

d = 1

Store result in file register f.

     

Default is d = 1.

f

Register file address (0x00 to 0xFF)

k

Literal field, constant data or label

W

Working register (accumulator)


Keywords : Pic6f84, Pic, Introduction, What Are PICs, Insruction, Set, Assembler
Writer : delon  |
6 Mar 2006 Mon   
|  11.000 Views
No Comments
Write Comment
Your Name
Email
You are writing as anonymous comment, if you are a member please login.