Home > other >  Why 51 single chip computer serial communication control led lights can control buzzer but has not r
Why 51 single chip computer serial communication control led lights can control buzzer but has not r

Time:02-20

# include
# define uint unsigned int
# define uchar unsigned char
Sbit beep=P1 ^ 5;
Uint a;
Void delay ()
{uint x, y;
For (x=10; X <0; X -)
For (y=10; Y <0; Y -);
}
Void chuankou ()
{TMOD=0 x20;
TH1=0 xf3;
TL1=0 xf3;
TR1=1;
SCON=0 x50;
PCON=0 x80;
ES=1;
EA=1;
}
Void main ()
{chuankou ();
While (1)
{if (a==1)
{beep=~ beep;
Delay ();

}

}

}
Void deepint () interrupt 4
{
A=SBUF;
RI=0;
SBUF=a;
while(! TI);
TI=0;


}
  • Related