From Programming the PIC16F84
http://www.piclist.com/techref/microchip/davidtait/picprog.html
There are 80 RAM locations in the 16F84. RAM is where you put your variables. The only way to change these RAM locations is through instructions. You don't load RAM from outside as in a 'regular' computer. The information in RAM disappears when power is removed. The first 12 RAM locations, ($00 - $0B), have internal registers mapped to them. Changing these locations with instructions changes the corresponding registers. Microchip calls RAM locations 'files' or 'registers' and uses the symbol 'f' when referring to them. The remaining 68 locations can be used for your variables. Microchip calls the first 12 locations special function registers and the remaining 68 general purpose registers.
Five special function registers are not among the first twelve addresses, not even among the 80 . Because of something called 'banking' you have to set a bit in the byte at RAM location 3 to reach them. This location is called STATUS and the bit, (bit 5), is called RP0. If RP0 is zero you are in bank 0, if it is 1 you are in bank 1. For your own variables it doesn't matter which bank is in use because they are mapped to both banks. For some of the first 12 locations it does matter. Seven of the 12 are mapped to both banks but five are not; so location 5 for example has two meanings depending on RP0. If RP0 is clear, ( bank 0 ), location 5 refers to the data on PORT A. IF RP0 is set, ( bank 1 ), location 5 refers to the direction register TRISA that tells which bits of PORTA are inputs and which are outputs.
Much of this complication can be avoided by using two instructions that Microchip indicates it might not support in future products. The TRIS instruction can be used to set the port direction registers and OPTION can be used to set the OPTION register which deals mainly with timer operations. If you port your code to future Microchip processors that don't support these instructions, you will probably want to rewrite the code for some other reason anyway.
Questions:
Comments:
file: /Techref/microchip/fr.htm, 6KB, , updated: 2015/5/14 02:57, local time: 2024/11/22 15:53,
3.149.243.86:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/Techref/microchip/fr.htm"> File registers</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.