C166: WORD VARIABLES ON ODD-BYTE BOUNDARIES
Information in this article applies to:
I am porting a working application from an 8-bit microcontroller to a C16x device. The following code works just fine on the C16x:
#define test MVAR (unsigned short, 0x120000) test = 100;
However, the following code does not work:
#define test MVAR (unsigned short, 0x120001) test = 100;
When executing the second example, the program halts. What's going on?
The problem is that the C16x can only access words on word boundaries (even addresses). The C16x devices generate a Class B hardware trap when a word is accessed on an odd address (non-word boundary).
This problem doesn't occur on 8-bit devices because there is no boundary limitations on those parts.
Last Reviewed: Sunday, January 30, 2005
of your data.