We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
How do I access a variable in bank 0 ?
If I look in my .m51 file I see my var ISP_VERSION:
CODE 754EH 001AH UNIT ?CO?ISP_VERSION
Now I try to access this var from a different image in a different bank using C code:
ispversion = 0x754E;
sprintf(SendString,"\r\nISP version %s",ispversion );
THIS DOES NOT WORK IT SEEMS!!!
This code is part of my main() function. I see in the .m51 file of this image:
CODE 011DH 0BCAH UNIT ?PR?MAIN?MAIN
But I do not really understand in which bank the main functionis located. I see in my .m51 file also (if relevant):
TYPE BASE LENGTH RELOCATION SEGMENT NAME ----------------------------------------------------- * * * * * * * D A T A M E M O R Y * * * * * * * REG 0000H 0008H ABSOLUTE "REG BANK 0" REG 0008H 0008H ABSOLUTE "REG BANK 1" REG 0010H 0008H ABSOLUTE "REG BANK 2"
I also tried this C code but it did not work as well:
unsigned char code *ispversion;
ispversion = (unsigned char code*)0x754E;
you see: I am not a banking expert (yet)!
"you see: I am not a banking expert (yet)!" You are also not a C expert ;)
Note that 0x754E is a number.
But when you print with %s you are trying to print a text string not a number.
The normal C string to print a 4-digit wide hexadecimal number is %04x (or %04X if you want capital letters).
well...
0x754E is the location (address) of the data where my data is located. The variable ispversion is a character pointer which (I hope) is pointing to this location. So I do not think the C here is the issue...