>I am using 16F870. This chip has only shared GP ram. Only the >SFR's are bank fixed. Some of the general purpose ram is available >in bank 0 and 2, and some is available in bank 1 and 3. There is >also a block that is available in bank 0,1,2 and 3. Right, so treat the ram as three sections. The ram that is in banks 1 & 3 you only declare as bank 1, and that in bank 2 & 4 declare as bank 2. The portion that is accessible from all four banks is declared separately. >What is confusing me though, is if I have the linker allocate a >variable, I do not know where it has put it, hence I don't know >which bank to select to access it. I know I can select the correct >bank with "banksel", but surely this means I have to do it >every single time I access a variable? No, look at the way Olin declares the banks in his development environment at http://www.embedinc.com/pic/ . At the start of each linkable module he declares which bank the local ram is in, and then uses the dbank series of macros to generate the bank selecting instructions. These macros only generate code if needed to bank switch as the current bank is noted in assembler variables so using extra dbank macros than specifically needed does not generate excess code. You can also see in his linker files how the ram accessible from all four banks is declared, and how he sets up general purpose registers in these banks for transferring data between modules where you do not know which bank the called/calling module is in. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.