Keil Logo

External Data Memory

External data memory is read/write. Since external data memory is indirectly accessed through a data pointer register (which must be loaded with an address), it is slower than access to internal data memory.

Several 8051 devices provide on-chip XRAM space that is accessed with the same instructions as the traditional external data space. This XRAM space is typically enabled via dedicated chip configuration SFR registers and overlaps the external memory space.

There may be up to 64K Bytes of external data memory; though, this address space does not necessarily have to be used as memory. Your hardware design may map peripheral devices into the memory space. If this is the case, your program would access external data memory to program and control the peripheral. This technique is referred to as memory-mapped I/O.

The C51 Compiler offers two memory types that access external data: xdata and pdata.

  • The xdata memory specifier refers to any location in the 64K Byte address space of external data memory. The large memory model locates variables in this memory space.
  • The pdata memory type specifier refers to exactly one (1) page (256 bytes) of external data memory. The compact memory model locates variables in this memory space.


  • External data memory may be accessed indirectly using the MOVX instruction. It may not be accessed directly.

Related Knowledgebase Articles

  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.