Hello!
I'm using a AT89c51RC Controller for my application.
When I define global variables with an initial value, they are not always initialized correctly.
Example:
signed int test=3;
If I place the variable on the beginning of the xdata memory space, then they are initialized correctly. But if I place the variable at the back of xdata, they have wrong values like -16235.
I have deleted or commented out all loops in my programm, so there cannot be a memory overflow, that is produced be me.
If I initialize the variables later within my program manually, everything works correctly -> so the error must occur before the program starts.
I also checked out the amount of xdata that is used by my program, but its far from being full.
Is it possible, that there is an error in the startup.a51 or init.a51 files?
I use no reentrant functions, so I disabled the XBPSTACK but that changed nothing ...
Maybe someone can help me or give me a hint
Josef
On start of my C-program i set the AUXR Register to value 0x0c to change the size of xdata from 256 bytes to 1024 bytes
Please read the manual
www.atmel.com/.../doc1920.pdf
states
4. The 256-byte expanded RAM (ERAM, 00H-FFH) is indirectly accessed by MOVX instructions, and with the EXTRAM bit cleared.
Erik
I could not get '768' of my head and I just had to look up the P89c51RD2. Voila! there is the 768 bytes of ERAM. Of course Josefs 1k is still wrong, especially since he is using a RC. Arghmel and NXP both have only 256 bytes ERAM in the RC
for the P89C51RD2 4. The 768-bytes expanded RAM (ERAM, 00H – 2FFH) are indirectly accessed by move external instruction, MOVX, and with the EXTRAM bit cleared, see Figure 38.