程序编好后烧入板子成功后,灯却没有反应,望解决
#include<reg52.h>
#define unit unsigned int
sbit D00=P1^0;
sbit D14=P1^4;
void delay(unit a);
void main()
{
D14=0;
while(1)
{
D00=0;
delay(500);
D00=1;
delay(500);
}
}
void delay(unit a)
{
unit x,y;
for(x=a;x>0;x--)
for(y=100;y>0;y--);
}
第3行错了
sbit D00=P1^0;
应该改为 sbit D00=P0^0; 因为51黑-5开发板的发光管是接的p0口啊.你写成p1口当然没有反应.
欢迎光临 (http://www.51hei.com/bbs/) | Powered by Discuz! X3.1 |