/* My C program run by C-52 EVB */ #include /* special function register declarations */ /* for the intended 8051 derivative */ #include /* prototype declarations for I/O functions */ #include unsigned char tick; /**********************************/ /* Your Interrupt Service Routine */ /**********************************/ void timer0int (void) interrupt 1 using 1 { TH0 = 0xdc; TL0 = 0x00; tick++; } /*********************/ /* Your main program */ /*********************/ void main (void) { /* the setting of the STACK area is performed in the file STARTUP.A51, so you need not to worry about this here */ float n; int i; i=0; n=1.0; EA = 1; ET0 = 1; // or IE |= 0x82; /* set bit EA and Timer0 enable */ TMOD |= 0x01; /* timer 0 run 16 bit counter */ TR0 = 1; //or TCON |= 0x10; /* run timer 0 */ while (1) { while (tick <50) ; tick = 0; P1 ^= 0x80; // XRL P1,#0x80, i.e., toggle P1.7 printf("\n Hello World %d sin(%f) = %f",i++,n,sin(n)); n += 0.001; } }