独立按键控制LED状态
作者:互联网
#include <REGX52.H>
#include <INTRINS.H>
void Delay1ms(unsigned int xms)
{
unsigned char i, j;
while(xms)
{
_nop_();
i = 2;
j = 199;
do
{
while (--j);
} while (--i);
xms--;
}
}
void main()
{
while(1)
{
if(P3_1==0)
{
Delay1ms(20);
while(P3_1==0)
{
}
Delay1ms(20);
P2_0=~P2_0;
}
}
}
标签:状态,LED,--,void,Delay1ms,while,按键,20,xms 来源: https://blog.csdn.net/m0_57444266/article/details/122300572