The purpuse of this little page is just to give basics about PIC 16F84 (or 16C84). mnemonic | Instructions on registers ( octets ) | modified bits | ADDWF f,d | d:=W+f | C,DC,Z | ANDWF f,d | d:=W AND f | Z | CLRF f | f:=0 | Z | CLRW | W:=0 | Z | COMF f,d | d:=NOT(f) | Z | DECF f,d | d:=f-1 | Z | DECFSZ f,d | d:=f-1 ; Skip if Zero | . | INCF f,d | d:=f+1 | Z | INCFSZ f,d | d:=f+1 ; Skip if Zero | . | IORWF f,d | d:=W OR f | Z | MOVF f,d | d:=f ( good test of f=0 while doing MOVF f,1 ) | z | MOVWF f | f:=W | . | NOP | no operation | . | RLF f,d | d=f SHL 1 | C | RRF f,d | d=f SHR 1 | C | SUBWF f,d | d:= f-W (2 complement--> d:=f + not (W) +1 ) | C,DC,Z | SWAPF f,d | d:= f[4..7] <--> f[0..3] | . | XORWF f,d | d:= W XOR f | Z | |
mnemonic | Instructions on registers ( bit per bit ) | modified bits | BCF f,b | f[b]:=0 (put the b bit of f to 0) | . | BSF f,b | f[b]:=1 (put the b bit of f to 1) | . | BTFSC f,b | test bit b of f ; Skip if Clear ( 0 ) | . | BTFSS f,b | test bit b of f ; Skip if Set ( 1 ) | . |
mnemonic | Control Instructions | modified bits | ADDLW k | W:=W+k | C,DC,Z | ANDLW k | W:=W AND k | Z | CALL k | call a subprogram | . | CLRWDT | clear watchdog timer | TO,PD | GOTO k | jump to adress k | . | IORLW k | W:=W OR k | Z | MOVLW k | W:=k | . | RETFIE | return of an interruption | . | RETLW k | w:=k , and return of a sub program | . | RETURN | and return of a sub program | . | SLEEP | sleep mode and oscillator in off mode | TO,PD | SUBLW k | W:=k-W | C,DC,Z | XORLW k | W:=W XOR k | Z |
d can be 0 or 1. If d is 0, d is W, else if d is 1, d is f (the register on which we are working on). I suggest to define W EQU 0 andF EQU 1 at the beggining of the program and to use W or F where to stock the result. If you use include files (P16F84.inc), those constants are already defined there.
The full datasheet of the pic16f84 is available [HERE].
Creation date : 06/12/2004 @ 04:00
Last update : 11/01/2005 @ 20:02
Category : Electronic
Page read 10724 times
Print preview
Print the page
|