unsigned int x;
timer0 () interrupt 1 using 2
{ x++;
TH0=-46080/256;
TL0=-46080%256;
}
void main (void)
{
unsigned int s;
TMOD=0x21; /*t1工作方式2,t0工作方式1 0010,0001*/
TH1=0xfd;
TL1=0xfd;
TH0=-46080/256;
TL0=-46080%256;
PCON=0x00;
SCON=0x50;
IE=0x9a;
PT1=1;
TR1=1;
TR0=1;
x=0;
s=0;
while (1)
{ if (x>20)
{ x=0;
s++;
printf("%d\n",s);
}
}
}