| ||||||||
Technical Support On-Line Manuals C166 User's Guide | sbit TypesThe sbit keyword allows you to define objects that access individual bits of bit-addressable SFRs and bit-addressable objects. For example: sbit IEN = PSW ^ 11; defines IEN as an SFR bit at bit 11 of the PSW. On the C16x/ST10 microcontroller, this is the global interrupt enable bit in the PSW register. Any symbolic name may be used in an sbit declaration. The expression to the right of the equal sign ('=') specifies an absolute bit address for the symbolic name. Two variations of this definition are possible: Variant 1sbit name = sfr-name ^ bit-position; The previously declared SFR (sfr-name) is the base address for the sbit. The bit-position (which must be a number from 0-15) follows the carat symbol ('^') and specifies the bit position to access. For example: sfr PSW = 0xFF10; sbit USR0 = PSW ^ 6; sfr ADCON = 0xFFA0; sbit ADBSY = ADCON ^ 8; Variant 2sbit name = sfr-address ^ bit-position; An integer constant (sfr-address) specifies the base address for the sbit. The bit-position (which must be a number from 0-15) follows the carat symbol ('^') and specifies the bit position to access. For example: sbit ADBSY = 0xFFA0 ^ 8; sbit USR0 = 0xFF10 ^ 6; Note
| |||||||
| ||||||||