please dont rip this site

File registers.

Accessing registers in Bank1: You’ll have noticed in that some registers like option are in what they refer to as Bank1, as opposed to Bank 0. Others, like status are in both Banks. What this means in practical terms, is that these Bank 1 registers are not normally available, because our default sphere of operations is Bank 0. We use the status register to effect a switch between banks, with RP0 & RP1 (STATUS<5> & <6>) doing the trick. This simply means that we must set RP1 to go to Bank1 and clear it to return. For those registers which are in both banks, you can of course access them no matter where you are, but remember the register has 2 different addresses: status is known as h’03’ and h’83’.

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 03:57, local time: 2024/3/19 02:33,
TOP NEW HELP FIND: 
52.90.181.205: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?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://www.sxlist.com/techref/microchip/fr.htm"> File registers</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to www.sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .