#include
sbit p10=P1^0;
sbit p17=P1^7;
unsigned char c;
unsigned char k;
unsigned int k2,k1;
bit p;
main()
{
void delay();
TR0=0;
TMOD=0X01;
TH0=0XFF;
TL0=0X9C;
EA=1;
ET0=1;
while(1){
l2:if(p17==0)
delay();
if(p17==0)
{TR0=1;goto l1;}}
l1:while(1){if(k1==500&&k2==500) {k1=0;k2=0;TR0=0;goto l2;}}}
void isr() interrupt 1
{
TH0=0XFF;
TL0=0X9C;
if(p==0) c++;
else k++;
if(c==6) {c=0;p10=~p10;k1++;if(k1==500) {p=~p;}}
if(k==9) {k=0;p10=~p10;k2++;if(k2==500){p=~p;}
}
}
void delay()
{unsigned char a,b;
for(a=20;a>0;a--)
for(b=200;b>0;b--);
}