|ARM Technical Support Knowledge Articles|
Applies to: C51 C Compiler
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.
Article last edited on: 2005-07-15 10:38:56
Did you find this article helpful? Yes No
How can we improve this article?