Professional Documents
Culture Documents
Pic Instruction Set
Pic Instruction Set
EE2801-L20P01
ffff ffff ffff xxxx ffff ffff ffff ffff ffff ffff ffff ffff 0000 ffff ffff ffff ffff ffff ffff ffff ffff ffff kkkk kkkk kkkk 0100 kkkk kkkk kkkk 1001 kkkk 1000 0011 kkkk kkkk
1,2 1,2 2 1,2 1,2 1,2,3 1,2 1,2,3 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 3 3
C,DC,Z Z TO,PD Z
TO,PD C,DC,Z Z
EE2801-L20P02
Byte-oriented file register operations 13 8 7 6 OPCODE d f (FILE #) d = 0 for destination W d = 1 for destination f f = 7-bit file register address Bit-oriented file register operations 13 10 9 7 6 OPCODE b (BIT #) b = 3-bit bit address f = 7-bit file register address Literal and control operations
TA B L E 13-1:
Field
f W b k x
Descriptio n
Register file address (0x00 to 0x7F) Working register (accumulator)
0 f (FILE #)
or
. It
is the recommended form of use for compatibility with all Microchip software tools.
d PC TO PD
Destination select; d =
: store result in W,
General 13 OPCODE
8 7 k (literal)
k = 8-bit immediate value CALL and GOTO instructions only 13 11 10 OPCODE k (literal) k = 11-bit immediate value
Program Counter
Time-out bit
Power-down bit
EE2801-L20P03
.Model small .Data var1 db 33h var2 db 0A4h var3 db ? .Code .8086 start: mov ax, @Data ;Set data segment. mov ds, ax mov mov add mov al, var1 bl, var2 al, bl var3, al ;Set Al to 33h ;Set BL to A4h ;Compute al = al + bl ;Move sum to memory ;Stop program
EE2801-L20P04
contents of variables. Move Move Move Move literal 33h into W. from W to var1 (initialize var1) literal A4h into W. from W to var2 (initialize var2)
; ; Do the addition. movf var1,W addwf var2,W movwf var3 stop goto End stop
; Get data from var1 into W. ; Calculate W = var1 + var2. ; Store result in var3.
EE2801-L20P05
BTFSS
BTFSC
label
label
CY CY
EE2801-L20P06
; Initialize contents of variables. ; movlw 0x0A ; Initialize count to 10 decimal by movwf count ; setting W and moving W -> count. ; ; Do the simple loop. loop decf count,F ; count = count - 1. btfsc STATUS,Z ; Skip next instruction if Z = 0. stop End
EE2801-L20P07
goto goto
stop loop