求解,为什么我的程序不会运行?
时间:10-02
整理:3721RD
点击:
这是一个流水灯从左流到右,在从右流到左的程序,但是不知道哪里出问题了,求大神看看
#include<reg51.h>
#define uint unsigned int
#define uchar unsigned char
#include <intrins.h>
void delay(uint);
uchar temp,a,b;
void main()
{
temp=0xfe;
P1=temp;
while(1)
{
for(a=7;a>0;a--)
{
temp=_crol_(temp,1);
delay(10);
}
for(b=7;b>0;b++)
{
temp=_cror_(temp,1);
delay(10);
}
}
}
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=12500;y>0;y--);
}
#include<reg51.h>
#define uint unsigned int
#define uchar unsigned char
#include <intrins.h>
void delay(uint);
uchar temp,a,b;
void main()
{
temp=0xfe;
P1=temp;
while(1)
{
for(a=7;a>0;a--)
{
temp=_crol_(temp,1);
delay(10);
}
for(b=7;b>0;b++)
{
temp=_cror_(temp,1);
delay(10);
}
}
}
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=12500;y>0;y--);
}
你的数据忘记往P1口赋值了,亮不出来的肯定。
temp=0xfe;
P1=temp;
这个不是赋值吗?
你后面的while(1)语句是死循环,可就一次都没有赋过了~~
怪不得我总感觉好像少了什么似的,真心谢谢你啊!
客气了,祝顺利。
