Keil Logo

Far Memory

Far memory refers to the extended address space of many new 8051 variants. The Cx51 Compiler uses generic 3-byte pointers to access extended memory spaces. Two Cx51 memory types, far and const far, access variables in extended RAM space and constants in extended ROM space.

The NXP 51MX Architecture provides hardware support for 8MB code and xdata space using universal pointers. The new instructions of the 80C51MX architecture are used by the Cx51 Compiler to access far and const far variables.

The Dallas 390 Architecture supports an extended code and xdata address space in contiguous mode with a 24-bit DPTR register and the traditional MOVX and MOVC instructions. Variables defined with far and const far are located in these extended xdata and code address spaces.

Classic 8051 devices may also use far and const far variables if you configure XBANKING.A51 for your target hardware. This is useful for devices that provide an address extension SFR or additional memory spaces that can be mapped into the xdata space. You may also use xdata banking hardware to extend the address space of a classic 8051 device. Refer to XBANKING.A51 for more information.


  • You must specify the C51 directive OMF2 and use the extended LX51 linker/locater to use the far and const far memory types.
  • The size of a object is limited to 64KB. It is impossible to define variables the cross a 64KB address boundary.
  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.