C51: XWORD MACRO QUESTIONS
Information in this article applies to:
When using the XBYTE MACRO, my data is stored exactly where it is supposed to be. All works OK. When I use the XWORD MACRO, the data does not go to the specified address.
What's happening here?
The XBYTE macro is defined to access memory as a large array of unsigned char. For example:
xdata unsigned char XBYTE [0x10000] _at_ 0;
The XWORD macro is defined to access memory as a large array of unsigned int. For example:
xdata unsigned int XWORD [0x8000] _at_ 0;
XBYTE accesses the BYTE at address 100. While XWORD accesses the WORD at address 200.
In a nutshell, the XWORD macro only accesses 16-bit values on even boundaries. The index is NOT the address, but the index of the word. The address is 2 times the index. This is the same as indexing into an array of ints that start at address 0.
Last Reviewed: Friday, July 15, 2005
of your data.