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 sbit type defines a bit within a special function register (SFR). It is used in one of the following ways:
sbit name = sfr-name ^ bit-position; sbit name = sfr-address ^ bit-position; sbit name = sbit-address;
With typical 8051 applications, it is often necessary to access individual bits within an SFR. The sbit type provides access to bit-addressable SFRs and other bit-addressable objects. For example:
sbit EA = 0xAF;
This declaration defines EA as the SFR bit at address 0xAF. On the 8051, this is the enable all bit in the interrupt enable register.
Any symbolic name can be used in an sbit declaration. The expression to the right of the equal sign ('=') specifies an absolute bit address for the symbolic name. There are three variants for specifying the address:
sbit name = sfr-name ^ bit-position;
The previously declared SFR (sfr-name) is the base address for the sbit. It must be evenly divisible by 8. The bit-position (which must be a number from 0-7) follows the carat symbol ('^') and specifies the bit position to access. For example:
sfr PSW = 0xD0; sfr IE = 0xA8; sbit OV = PSW^2; sbit CY = PSW^7; sbit EA = IE^7;
sbit name = sfr-address ^ bit-position;
A character constant (sfr-address) specifies the base address for the sbit. It must be evenly divisible by 8. The bit-position (which must be a number from 0-7) follows the carat symbol ('^') and specifies the bit position to access. For example:
sbit OV = 0xD0^2; sbit CY = 0xD0^7; sbit EA = 0xA8^7;
sbit name = sbit-address;
A character constant (sbit-address) specifies the address of the sbit. It must be a value from 0x80-0xFF. For example:
sbit OV = 0xD2; sbit CY = 0xD7; sbit EA = 0xAF;
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.