Keil Logo

C51: ABSOLUTE ACCESS FOR FAR VARIABLES


Information in this article applies to:

  • C51 Version 6.14
  • C51 Version 7.07

QUESTION

How do I access far absolute memory locations?

ANSWER

The far memory area is supported for devices with more than 64K of code/xdata space (like the Dallas 390, Philips 51MX, and Analog Devices ADuC812).

In C51 V6.14, we have added a new absolute access macro called FVAR. This macro allows you to define a memory type and its far address. For example:

#include <absacc.h>
#define IO_PORT   FVAR(unsigned char, 0x200000)

void main (void)  {
  unsigned int i;                     /* Delay var */
  unsigned char j;                    /* LED var */

  IO_PORT = 0x55;
  i = IO_PORT;
}

In C51 V7.07, we have added support for the _at_ keyword. This means that it is now possible to define absolute variables directly using the _at_ attribute:

unsigned char far IO_PORT _at_ 0x200000;

void main (void)  {
  unsigned int i;                     /* Delay var */
  unsigned char j;                    /* LED var */

  IO_PORT = 0x55;
  i = IO_PORT;
}

MORE INFORMATION

SEE ALSO

Last Reviewed: Friday, July 15, 2005


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.