Based on STC80C52 microcontroller programming, P1.0 and P1.1 port connects two leds, low level light, P2 3 pin connection buzzer, effective, low level P3.2 P3.3 and connecting the two keys, at the beginning of the two light has been on each press a button, one of the lamp is a shiny, at the same time a buzzer alarm,
CodePudding user response:
See the MCU course, and not very hard,
CodePudding user response:
Write directly without debugging
Sbit led1=P1.0
Sbit led2=P1.1
Sbit bili=P2
Sbit k1=P3.2
Sbit k2=P3.3
The main ()
{
Char aa=0;
Led1=led2=0;
While (1)
{
If (k1==0) {led1=~ led1; Bili=0; While (+ + aa); }
}
}