#include "reg51.h"
//timer init
void initTimer(void)
{
TMOD=0x1;
TH0=0xff;
TL0=0xec;
}
//timer0/counter0 interrupt
void timer0(void) interrupt 1
{
TH0=0xff;
TL0=0xec;
//add your code here.
P1^=1;
}
//the main fun
void main(void)
{
initTimer();
TR0=1;
ET0=1;
EA=1;
while(1)
{;}
}