Keil Logo

C51: Reserving Memory Accessed With XBYTE and XWORD


Information in this article applies to:

  • C51 any Version

QUESTION

I'm using XBYTE and XWORD to access memory directly. How can I reserve the memory so the compiler doesn't locate variables where I have located my memory buffer?

ANSWER

You may declare an xdata array using the _at_ keyword to reserve memory as follows:

unsigned char xdata buffer [100] _at_ 0x8000;

to reserve 100 bytes starting at 8000h. This ensures that the compiler does not locate any other variables at this location.

MORE INFORMATION

SEE ALSO


Last Reviewed: Thursday, February 25, 2021


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.