ARM Technical Support Knowledge Articles

ABSOLUTE ACCESS FOR FAR VARIABLES

Applies to: C51 C Compiler

Answer


Information in this article applies to:


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

Article last edited on: 2005-07-15 14:07:15

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential