This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

89C51 with internal XRAM and EEPROM

I am using an 89C51 variant with both intenal XRAM and EEPROM and as such their address space overlaps from 0x0000 to 0x03FF so I have variables declared as follows:-

#define size 0x20

/* variables to be stored in xdata */
char xdata cArray[size];
int xdata iTimer;

/* variables to be stored in EEPROM */
char xdata cEE_Array _at_ 0x00; /* config data copied to/from cArray */
int xdata iEE_Timer _at_ 0x20;

My problem is that if i redefine 'size' later I have to recalculate where variables are '_at_' in EEPROM. Assuming that other than ensuring that enough space is left between variable declarations to allow for any future changes, is there any way of getting rid of the '_at_' definitions and getting the compiler/linker to sort out the address within the EEPROM the variables are?

Thanks,
Mark.

Please Note I have C51 ver 7.XX and cannot upgrage to the package allowing RAM bank switching.

0