Sei sulla pagina 1di 3

CODE

1. RA or RB = bidirectional port

2. VDD = positive supply

3. VSS = negative supply

4. OSC1/CLK1 = connect an external clock

5. MCLR = this pin is used to erase the memory location


inside the PIC

6. INT = i/p pin can be monitored. If goes high can cause the
program to be restart.

7. TOCK1 = this is another clock i/p which operates an internal


timer.

8. STATUS = register that used to switch from bank 0 to 1 or vice


versa

9. TRISA or TRISB = tri-state register. Used to program a pin to be


an i/p or o/p

10. PORTA or PORTB = to send bit 0 or bit 1 to our port.

11. W and F = general purpose register

12. BSF = Bit set F (F=memory location) ex: BSF 03H, 5


address 03H to 1
Status register Set bit 5 in address

13. MOLVW = move literal value into W ex: MOLVW b’00110’ or


MOLVW 06H
binary register W
b=number in general purpose
Put this value in

14. MOVWF = Move the contents of W into the register


address that follows.

Ex: MOVW 85H (85H is the address of TRISA for


PIC84A)

1
Ex: our TRISA register now has the value 0 0 1 1 0

So port A pin RA4 RA3 RA2 RA1 RA0

0 0 1 1 0

15. BCF = bit clear F ex: BCF 03H,5


address 03H to 0
Status register Set bit 5 in address

16. START = it is label ( we can type or define any


name of label)

17. GOTO = goto instruction does exactly what it says. Ex:


GOTO START Goto the instruction START

18. ‘equ’ = means something equal something else.

19. DELAY LOOPS = - the principle of the DELAY is that we count


down from a previously set number and when it
reaches zero, we stop counting. The zero value
indicates the end of the delay.

- First, define a constant to use as a counter.

- We call this constant COUNT

- How big a number to start is 255

- What ever number we assign our COUNT, it


will equal to the contents of a register.

- Each instruction takes one clock cycle to


complete

- If we using 4MHz crystal, so each instruction


take 1/4MHz, so 1uS.

2
20. DECFSZ = ‘decrement the register by the number that
follow the comma. If we reach zero, jump two places
forward.

Ex: DECFSZ COUNT,1 ; subtract 1 from 255

21. CALL = - A subroutines is a section of code or program


than can be called as when we need it.

- Subroutines are used if we are performing the same


function more than once for example creating a delay.

- First give name. Ex ROUTINE

- To start the subroutine from anywhere in our


program, we simply type the instruction CALL followed
by the subroutine name.

- Any constant(ex: Delay) must be declared in main


program before they are used or declared in the
subroutine itself.

22. BTFSC = Do a bit test on the register and bit we specify. If it


is a 0, then we skip the next instruction. Ex to
check switch closed r not.

23. BTFSS = Do a bit test on the register and bit we specify. If it


is a 1, then we skip the next instruction. Ex to
check switch closed r not.

Potrebbero piacerti anche