Keil Logo

C51: PLACING FAR VARIABLES AT ABSOLUTE LOCATIONS


Information in this article applies to:

  • C51 Version 6

QUESTION

How can I locate far variables at absolute memory locations. I have tried the following:

unsigned char far x _at_ 0x00000A;

But this generates the following compiler error message:

Error C274: Absolute Specifier Illegal

ANSWER

Variables of type far may be placed at absolute memory locations using the FVAR, FCVAR, FARRAY, and FCARRAY macros. For example:

#define IOVAL FVAR (long, 0x14FFE)   // long at HDATA address 0x14FFE
.
.
.
int var;
.
.
.
var = IOVAL;                 /* read */
IOVAL = 0x10;                /* write */
var = FCVAR (int, 0x24002)   /* read int from HCONST address 0x24002 */
.
.
.

STATUS

Support for _at_ and far addresses was added in C51 Version 7.

MORE INFORMATION

  • Refer to FVAR in the Cx51 User's Guide.

SEE ALSO

Last Reviewed: Tuesday, April 10, 2007


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

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.