Contents at a Glance
Contents
List of Programs
Introduction
What you need
What you should know
Introducing the PIC84
Instruction Set
A simple PIC84 program
Using MPLAB to debug the program
Pause to reflect
The Instruction Set
The STATUS register
1: Move instructions
MOVWF f (Move W to f, PIC p58)
MOVLW k (Move literal to W, PIC p58)
2: Clear instructions
CLRW (Clear W, PIC p55)
3: Arithmetic instructions
SUBWF f,d (Subtract W from f, PIC p61)
ADDLW k (Add literal & W, PIC p53)
SUBLW k (Subtract W from literal, PIC p61)
4: Logical functions
IORWF f,d (Inclusive OR W with f, PIC p58)
XORWF f,d (Exclusive OR W with f, PIC p62)
ANDLW k (AND literal with W, PIC p53)
IORLW k (Inclusive OR literal with W, PIC p57)
XORLW k (Exclusive OR literal with W, PIC p62)
COMF f,d (Complement f, PIC p56)
5: Decrementing & Incrementing
INC f,d (Increment f, PIC 57)
6: Bit setting & clearing
BSF f,b (Bit set f, PIC p54)
7: Program control
CALL k (Call subroutine, PIC p55)
RETURN (Return from subroutine, PIC p60)
RETLW k (Return with literal in W, PIC p59)
RETFIE (Return from Interrupt, PIC p59)
8: Skipping instructions
INCFSZ f,d (Increment f, skip if 0, PIC p57)
BTFSC f,b (Bit test f, skip if clear, PIC p54)
BTFSS f,b (Bit test f, skip if set, PIC p55)
9: Rotations & Swap
RLF f,d (Rotate left f thru carry, PIC p60)
SWAPF f,d (Swap nybbles in f, PIC p62)
10: Sleep & Watchdog Timer
CLRWDT (Clear watchdog timer, PIC p56)
11: Miscellaneous
OPTION (Not recommended)
TRIS (Not recommended)
Pause to reflect
Interrupts on the 84
Types of Interrupt and the INTCON register
Servicing an Interrupt
Timers on the 84
The TIMER0 module
Using the timers overflow
Using the EEPROM data memory
Appendix: Program listings
Program 1: simple . asm
Program 3: clears . asm
Program 4: arith . asm
Program 5: inter1.asm
Program 6: inter2.asm
Program 7: inter3.asm
Program 8: time0.asm
Questions:
Comments: