#include <AT89X51.H>
unsigned char tcount2s;
unsigned char tcount02s;
unsigned char ID;
void main(void)
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
TR0=1;
ET0=1;
EA=1;
while(1);
}
void t0(void) interrupt 1 using 0
{
tcount2s++;
if(tcount2s==40)
{
tcount2s=0;
ID++;
if(ID==4)
{
ID=0;
}
}
tcount02s++;
if(tcount02s==4)
{
tcount02s=0;
switch(ID)
{
case 0:
P1_0=~P1_0;
break;
case 1:
P1_1=~P1_1;
break;
case 2:
P1_2=~P1_2;
break;
case 3:
P1_3=~P1_3;
break;
}
}
}