• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

help defining globals to different banks with PICC

Not open for further replies.


New Member

I am writing software in C for a PIC16f877 with the Hi-Tech PICC compiler. The code utilizes mainly global variables including several global int arrays (8ints wide). As I expanded the program to include more variables I recieved errors such as:
"(491) can't find 0x6 words for psect "rdata_0" in segment "BANK0" "
when I take away several of my globals then this error goes away and the project builds properly.
I belive this is from bank0 running out of memory space, and this is the bank where PICC compiler stores the global variables. I should have 4 banks on the 16f877 and there should be plenty more memory available for storage becaues it is not an incredibly complex program.
does anyone know the best way to overcome this issue so that I can still add additional global arrays and expand the software. I was thinking that if I could store the globals in a different bank then the issue could resolve itself. However I am writing in C language so i dont know how to control where a variable is stored so that it can be easily accessed as global. Is there a good way to do this? Can tell the software to store some globals on other banks, and how do i know what adresses are appropriate to allocate.
Thanks very much for your help.


Well-Known Member
Most Helpful Member
Don't you just precede the declaration with the bank number?

bank2 unsigned int test[8];



New Member
thanks so much

that seemed to do the trick and it builds correctly! I was worried it was going to be a complex answer involving writing asm etc. I still havent tested it with the rest of the hardware yet but that is the next step. Thanks a lot, AweLucid
Not open for further replies.

Latest threads

EE World Online Articles