PIC16F84A REGISTER FILE MAP

PIC16F84A REGISTER FILE MAP:




This figure shows the register file map inside the PIC16F84
It’s devided into two banks , Bank 0 and Bank 1. Bank 1 is used to control the actual operation of the PIC, Bank 0 is used to manipulate the data.
example : to make one bit on Port A high. First we need to go to Bank 1 to set the particular bit, or pin, on Port A as an output. We then come back to Bank 0 and send a logic 1 to that pin.



The most common used registers are : STATUS, TRISA and TRISB. The first allows us to come back to Bank 0, TRISA allows us to determine which pins on Port A are output and which are input, TRISB allows us to determine which pins on Port B are output and which are input. The SELECT register in Bank 0 allows us to switch to Bank 1.

STATUS

To change from Bank 0 to Bank 1 we tell the STAUS register. We do this by setting bit 5 of the STATUS register to 1. To switch back to Bank 0, we set bit 5 of the STATUS register to 0. The STATUS register is located at address 03h (the ‘h’ means the number is in Hexadecimal).



TRISA and TRISB.
These are located at addresses 85h and 86h respectively. To program a pin to be an output or an input, we simply send a 0 or a 1 to the specified bit in the register. Now, this can either be done in binary, or hex.
On Port A we have 5 pins, and hence 5 bits. If we wanted to set one of the pins to input, we send ‘1’ to the specified bit. If we wanted to set one of the pins to an output, we set the specified bit to ‘0’.




PORTA and PORTB:
To send one of our output pins high, we simply send a ‘1’ to the corresponding bit in our PORTA or PORTB register. To read if a pin is high or low on our port pins, we can make a check to see if the particular corresponding bit is set to high (1) or set to low (0)
W:
The W register is a general register in which we can put any value that we wish. When we assigned a value to W register, we can add it to another value, or move it. If you assign another value to W, its contents are overwritten.

Facebook

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost