8051 - C Programming
8051 - C Programming
Microcontrollers in
Embedded Systems
Programming in C
DATA TYPES
void main() {
SW=1; //make switch input
TMOD=0x01;
TL0=0xFF;
TH0=0xDB;
IE=0x82; //enable interrupt for timer 0
TR0 = 1 //start timer
while (1)
{LED=SW;} //send switch to LED
}
8051 C interrupt numbers
PROGRAMMING The 8051 C compilers have extensive support for the 8051
INTERRUPT interrupts with two major features as follows:
IN C They assign a unique number to each of the 8051 interrupts, as
shown in Table below.