注册 登录
编程论坛 单片机编程

单片机跑马灯出错

雨露均沾 发布于 2017-04-16 17:36, 3391 次点击
跑马灯实验(c51).c(19): error C141: syntax error near 'for'

程序代码:
#include<stdio.h>
#include<reg51.h>
#include<intrins.h>

unsigned char  byTemp[3] _at_ 0x0023;

void Delay1s(void)
{
    unsigned char a,b,c;
    for(c=152;c>0;c--)
       for(b=70;b>0;b--)
          for(a=46;a>0;a--);
    _nop_();
}

void main(void)
{
    unsigned char data byLedValue=0xFE
    for (;;)
    {
        p0 = byLedValue;
        Delay1s();
        byLedValue = _crol_(byLedValue,1);
    }
}
2 回复
#2
尘曦2018-10-30 19:40
十九句那少个分号?
#3
尘曦2018-10-30 19:43
//21句p没大写,19句少个分号
#include<stdio.h>
#include<reg51.h>
#include<intrins.h>

unsigned char  byTemp[3] _at_ 0x0023;

void Delay1s(void)
{
    unsigned char a,b,c;
    for(c=152;c>0;c--)
       for(b=70;b>0;b--)
          for(a=46;a>0;a--);
    _nop_();
}

void main(void)
{
    unsigned char data byLedValue=0xFE;
    for (;;)
    {
        P0 = byLedValue;
        Delay1s();
        byLedValue = _crol_(byLedValue,1);
    }
}
1