通过两个按键来控制2个lded的灭亮 按一下灯亮在按一下灯灭
#include <reg52.h>
sbit ADDR0
= P1
^0;
sbit ADDR1
= P1
^1;
sbit ADDR2
= P1
^2;
sbit ADDR3
= P1
^3;
sbit ENLED
= P1
^4;
sbit LED1
= P0
^0;
sbit LED2
= P0
^1;
sbit KEY1
= P2
^4;
sbit KEY2
= P2
^5;
sbit KEYOUT1
= P2
^3;
void main()
{
ENLED
= 0;
ADDR3
=1;
ADDR2
=1;
ADDR1
=1;
ADDR0
=0;
KEYOUT1
= 0;
while (1)
{
LED1
= KEY1
;
LED2
= KEY2
;
}
}
转载请注明原文地址:https://ipadbbs.8miu.com/read-2928.html