The Register

A register is a place inside the PIC that can be written to, read from or both. The figure below shows the register file map inside the PIC16F84A.
Register file map



table 1

if you notice that the table are split into two the first table is Bank0 and the second is the bank1. the Bank1 is use to control the actual operation of the PIC and bank 0 is use to manipulate the data. For example I want the Ra0 to Ra4 as an output then the code is

Bsf STATUS, RPO ; this means that I have to go to bank1 because the default setting of the PIC is at the Bank 0, I have to go to bank1 because the next instruction are only found at the Bank1 (the TRISA).
Movlw 00h
Movwf TRISA

Bcf STATUS, RPO ; this means that I have to go back into bank0 for the next instruction such as to manipulate the data

No comments: