Keil Logo

sfr Types

SFRs are declared in the same fashion as other C variables. The only difference is that the data type specified is sfr rather than char or int. For example:

sfr P0 = 0xFF00;    /* Port-0, address FF00h */
sfr P1 = 0xFF04;    /* Port-1, address FF04h */

Names for sfr types are defined using the same method as other C variables. In the above example, P0 and P1 are the SFR name declarations. Any symbolic name may be used in an sfr declaration.

The address specification after the equal sign ('=') must be a numeric constant. Expressions with operators are not allowed. This constant must lie in the SFR address range 0xFE00-0xFFDE or in the extended SFR address range 0xF000-0xF1DE (for C167 family devices).

  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.