Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] Access to General Purpose Register (RAM)

Status
Not open for further replies.

swapan

Full Member level 4
Full Member level 4
Joined
Feb 20, 2009
Messages
204
Helped
27
Reputation
54
Reaction score
24
Trophy points
1,298
Location
Kolkata
Visit site
Activity points
2,839
Hi friends,

Though I have made some small tests with Microcontroller, some matters are yet not clear to me. In many devices it is seen that SFRs as well as GPRs are located in different banks. For instance, 16F886 has 4 banks (0-3). In each bank 96 GPRs are there. Now my curiosity is - if the GPRs of bank 1 will be automatically accessed or some other technique will have to apply like accessing SFRs (by setting RP0 bit of STATUS Register).

swapan
 

Hi,

Yes it a confusing method for beginners.

Basically memory is spread over the banks as you mention /shown in the datasheet.

If you use Assembly then its down to you to ensure that you include a directive called ' banksel ' to indicate which bank it can find both the SFR or GPR
( the directive is just a shortcut the changing those bits of the Status register)

eg
banksel TRISA ; select bank 1
clrf TRISA

Note that at the bottom of the GPR banks is an area called Access, this area is common to all banks so any data put in the Access ares is automatically shared in whatever bank you are currently in.

Its a rather tiresome method in Assembly but some of the newer 16F and most of the 18F chips have all the SFR in just one area and ram banks of 256 bytes so changing them is not so frequently done

If you are using C then all of this 'banking' is done automatically for you.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top