#include <reg51.h>
#include <intrins.h>
#define LED P2
void Delay10ms(int a);
void main()
{
int n=0;
LED=0xfe;
while(1)
{
for(;n<7;n++)
{
LED=_crol_(LED,1);
Delay10ms(50);
}
for(;n>0;n--)
{
LED=_cror_(LED,1);
Delay10ms(50);
}
}
}
void Delay10ms(int a)
{
int b,c;
for(;a>0;a--)
for(b=38;b>0;b--)
for(c=150;c>0;c--)
}
第28行结尾,缺了 ';' 分号,修改如下,改动处见注释,供参考:
#include <reg51.h>
#include <intrins.h>
#define LED P2
void Delay10ms(int a);
void main()
{
int n=0;
LED=0xfe;
while(1)
{
for(;n<7;n++)
{
LED=_crol_(LED,1);
Delay10ms(50);
}
for(;n>0;n--)
{
LED=_cror_(LED,1);
Delay10ms(50);
}
}
}
void Delay10ms(int a)
{
int b,c;
for(;a>0;a--)
for(b=38;b>0;b--)
for(c=150;c>0;c--)
; // 修改,缺了';' 分号
}
编译器都给你提示错误位置了啊,位置在29行,你的图没贴出29行,我也没法给你说具体错误了。
虽然你的文字代码贴了29行的,但是和错误提示的不匹配,29行没有},所以还是要看你项目里到底怎么写的。