Cx51 User's GuideCx51 Introduction Compiling Programs Language Extensions Keywords Memory Areas Program Memory Internal Data Memory External Data Memory Far Memory SFR Memory Memory Models Small Model Compact Model Large Model Memory Types bdata code data far idata pdata xdata Data Types Special Function Registers sfr sfr16 sbit Bit-Addressable Objects bit Standard C Types void char int enum float double Type Modifiers signed unsigned short long Type Qualifiers const volatile Storage Classes auto register extern static Absolute Variable Location Pointers Generic Pointers Memory-Specific Pointers Pointer Conversions Abstract Pointers Function Declarations Parameters and the Stack Parameters and Registers Return Values Memory Models Register Banks Register Bank Access Interrupt Functions Reentrant Functions Alien (PL/M-51) Function Real-Time Function Tasks Preprocessor Advanced Programming 8051 Derivatives Error Messages Library Reference Appendix
The sfr type defines a special function register (SFR). It is used as follows:
sfr name = address;
SFRs are declared in the same fashion as other C variables. The only difference is that the type specified is sfr rather than char or int. For example:
sfr P0 = 0x80; /* Port-0, address 80h */ sfr P1 = 0x90; /* Port-1, address 90h */ sfr P2 = 0xA0; /* Port-2, address 0A0h */ sfr P3 = 0xB0; /* Port-3, address 0B0h */
P0, P1, P2, and P3 are the SFR name declarations. Names for sfr variables are defined just like other C variable 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. Classic 8051 devices support the SFR address range 0x80-0xFF. The NXP 80C51MX provides an additional extended SFR space with the address range 0x180-0x1FF.
of your data.
We are pleased to inform you that on 5 September 2016, SoftBank Group Corp. acquired ARM Holdings Plc. ARM will continue to operate as an independent business within the SoftBank group.
Any current agreements between ARM Ltd (or other ARM group companies, as applicable) you / your company remain in effect as between the parties, and the parties will continue to be bound by and perform the obligations in such agreements. If you have any queries please direct these to ARMSoftbank-Notifications@arm.com.