#include <reg51.h>
#define LED1_ON() P1^2 = 0
#define LED1_OFF() P1^2 = 1
sbit KEY1 = P3^2;
void delay100us(unsigned int uiDly)
{
unsigned char i; //延时100us
do{
i=46;
do{
} while(--i!=0);
} while(--uiDly!=0);
}
void main (void)
{
while(1){
KEY1=1;//等待按键按下
while(1) {
while(KEY1==1) { } //循环检测?
delay100us(100);
if(KEY1!=1) {
break;
}
}
LED1_ON();//点亮LED
/*
* 等待释放按键
*/
while(1){
while(KEY1==0) { } //检测是否释放
delay100us(100);
if(KEY1!=0){
break;
}
}
LED1_OFF();//熄灭LED
}
}
错误是:00.c(1): warning C500: LICENSE ERROR (R207: REGISTRY READ ERROR)
00.c(74): error C141: syntax error near '='
00.c(52): error C141: syntax error near '='
是哪里问题呢
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
问题已解决,谢谢
一周热门 更多>