Keil Logo

C51: Assigning an I/O Address to a Variable


How do I assign a variable to a specific memory location, like an I/O address, using µVision?


You may use one of the following methods to assign a specific address to a variable.

  1. Use the _at_ keyword when you declare the variable.
  2. Use the Absolute Access Macros defined in ABSACC.H in \C51\INC.
  3. Use the CODE, XDATA, BIT, and other directives in the BL51 linker to locate a SEGMENT at a particular address.

All three of these methods are discussed in detail in the C51 Compiler User's Guide.


Last Reviewed: Thursday, February 25, 2021

Did this article provide the answer you needed?
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.