PDA

View Full Version : Bank A System



Charles Linquis
- 8th July 2006, 18:17
When your PBP program has an assembly-language subroutine, what determines
whether or not you need to define variables as 'bankA system'?

For example, my assembly-language subroutine has 3 basic types of variables:

1. Variables that hold the context registers - WREG, STATUS, FSR0L, FSR0H
2. Variables that I need to pass back and forth between PBP and assembly
3. Temporary variables that are first assigned in PBP, but otherwise are used only within the assembly-language subroutine.

It is my belief that the 'bankA' designation forces PBP to put the variables in the first 256 bytes of RAM, but what does the 'system' nomenclature mean?

Is there some rule for how these labels are used?

SteveB
- 8th July 2006, 20:03
It is my belief that the 'bankA' designation forces PBP to put the variables in the first 256 bytes of RAM.
Actually, in the PIC18F, 'bankA' forces PBP to put the variables into the "Access Bank" which is location 00h-7Fh (first 128 bytes) plus the "SFR" section of memory, which will be the last 128 bytes of memory. EDIT:A little clarifaction of the previous statement. PBP won't actually assign a variable in the SFR section of the "Access Bank". So only 128 bytes are available as GPR for variables. When this is done, it makes access to these varible easier, as you can force the ASM commands to ignore the BSR value and use only "Access Bank" varibles. Any varible that I use in my ASM ISRs I declare with 'banka" so that I don't have to fuss with the BSR. Just a technique though. See section 5-Memory Organization of you datasheet.


but what does the 'system' nomenclature mean?
'System', I far as I can tell, just makes PBP declare the variable in ASM without the leading underscore. So, without 'system', the PBP varible 'wsave' would be '_wsave' in the ASM portion of the code. I think section 7.3-RAM Usage of the PBP manual addresses this topic.

Steve