Accessing SFRs
The interesting SFRs are bit-addressable
- addresses 0x80, 0x88, 0x90, . . . , 0xF8
SFRs can be addressed by bit, char or int sbit EA = 0xAF; /* one of the interrupt enables sfr Port0 = 0x80; /* Port 0 */ sfr16 Timer2 = 0xCC; /* Timer 2 */ sbit LED0 = Port1 ^ 2; /* Define a port bit */ EA = 1; /* Enable interrupts */ Port0 = 0xff; /* Set all bits in Port 0 to 1 if (Timer2 > 100) . . . LED0 = 1; /* Turn on one bit in Port 2 */