#include <reg52.h>
#include <stdio.h>
#define uchar unsigned char
#define uint unsigned int
sbit LED = P2^2;
void timer_init()
{
TMOD |= 0x01;
TH0 = 0x4C;
TL0 = 0x00;
EA = 1;
ET0 = 1;
TR0 = 1;
}
void trigger_timer0() interrupt 1
{
static uint i = 0;
TH0 = 0x4C;
TL0 = 0x00;
i++;
if( i == 20 )
{
i = 0;
LED = ~LED;
}
}
void main()
{
timer_init();
while( 1 );
}