| |||||
Technical Support Support Resources
Product Information | C51: XWORD MACRO QUESTIONSInformation in this article applies to:
QUESTIONWhen 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? ANSWERThe 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[100] accesses the BYTE at address 100. While XWORD[100] 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. MORE INFORMATIONSEE ALSOLast Reviewed: Friday, July 15, 2005 | ||||
| |||||