|
|||||||||||
Technical Support On-Line Manuals Cx51 User's Guide ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Absolute Variable LocationVariables may be located at absolute memory locations in your C program source modules using the _at_ keyword. The usage for this feature is: <[>memory_type<]> type variable_name _at_ constant; Where
The absolute address following the _at_ keyword must conform to the physical boundaries of the memory space for the variable. The Cx51 Compiler checks for and reports invalid address specifications. The following restrictions apply to absolute variable location using the _at_ keyword:
The following example demonstrates how to locate several different variable types using the _at_ keyword. struct link { struct link idata *next; char code *test; }; struct link list idata _at_ 0x40; /* list at idata 0x40 */ char xdata text[256] _at_ 0xE000; /* array at xdata 0xE000 */ int xdata i1 _at_ 0x8000; /* int at xdata 0x8000 */ volatile char xdata IO _at_ 0xFFE8; /* xdata I/O port at 0xFFE8 */ char far ftext[256] _at_ 0x02E000; /* array at xdata 0x03E000 */ void main ( void ){ link.next = (void *) 0; i1 = 0x1234; text [0] = 'a'; IO = 6; ftext [0] = 'f'; } If you wish to declare variables in one source module and access them in another, use the following external declarations to access the _at_ variables defined above in another source file. struct link { struct link idata *next; char code *test; }; extern struct link idata list; /* list at idata 0x40 */ extern char xdata text[256]; /* array at xdata 0xE000 */ extern int xdata i1; /* int at xdata 0x8000 */ extern volatile char xdata IO; /* xdata I/O port at 0xFFE8 */ Note
| ||||||||||
|
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.