PDA

View Full Version : pbp - asm variable passing



Charles Linquis
- 25th May 2009, 04:38
I have a growing number of ASM routines in my program. Whenever I want to pass variables between ASM and PBP, I define the variable as "BankA system". This has always worked fine, but now I get the msg ""cannot fit variable in the selected bank". I obviously have too many variables. My question is - must I always define the common variables in bankA? Is there something else I can do to allow access to a variable from both ASM and PBP now that I have bankA filled?

I'm using an 18F series chip.

Darrel Taylor
- 25th May 2009, 08:49
You can access any variable in any bank you want. They don't need to be in BANKA.

If you put them in BANK0, it works almost identical to BANKA since you always start in BANK0 from the beginning of an ASM block.

If they are in another bank, you can use CHK?RP _VarName to find the bank any variable is in. Just be sure to put it back to BANK0 before exiting the ASM block (RST?RP).

Best bet... use BANK0 and don't use SYSTEM.
SYSTEM variables usually end up in BANKA, whether BANKA is specified or not. Then they'll push other variables out of BANKA that were specified to be there.
<br>