标题: 请问一下这个怎们解决main.c(6): error C129: missing ';' before '-' [打印本页]

作者: 云fei    时间: 2022-1-16 10:13
标题: 请问一下这个怎们解决main.c(6): error C129: missing ';' before '-'
#include <REGX52.H>
#include <INTRINS.H>
#define uchar unsigned char
#define uint unsigned int
       
uchar code DSY-CODE[]=
{
  0xC0,0xF9,0xA4,0xB0,0x99,0x82,0xF8,0x80,0xFC
};

void DelayMS(uint x)
{
        uchar  t;
        while(x--)
                for(t=120;t>0;t--);
}


void main()
{
        uchar i=0;
        P0=0x00;
        while(1)
        {
                P0=~DSY_CODE[i];
                i=(i+1)%10;
                DelayMS(200);
               
        }
}


作者: taotie    时间: 2022-1-16 11:27
uchar code DSY_CODE[]
作者: lkc8210    时间: 2022-1-16 11:41
"-"是减号,请用"_"代替
作者: 名字不是重点    时间: 2022-1-16 12:04
DSY-CODE ==》DSY_CODE  

就可以了,在这边不要用“-”,被误读成“减”了
作者: 温xyz    时间: 2022-1-16 13:51
#include <REGX52.H>
#include <INTRINS.H>
#define uchar unsigned char
#define uint unsigned int
      
uchar code DSY_CODE[]=      //DSY_CODE
{
  0xC0,0xF9,0xA4,0xB0,0x99,0x82,0xF8,0x80,0xFC
};

void DelayMS(uint x)
{
        uchar  t;
        while(x--)
                for(t=120;t>0;t--);    // t--
}


void main()
{
        uchar i=0;
        P0=0x00;
        while(1)
        {
                P0=~DSY_CODE[i];
                i=(i+1)%10;
                DelayMS(200);
               
        }
}
作者: 云fei    时间: 2022-1-16 16:09
谢谢各位,我傻了
作者: 累不死的狗    时间: 2022-1-17 22:06
自己抄错程序了
#include <REGX52.H>
#include <INTRINS.H>
#define uchar unsigned char
#define uint unsigned int
      
uchar code DSY_CODE[]=
{
  0xC0,0xF9,0xA4,0xB0,0x99,0x82,0xF8,0x80,0xFC
};

void DelayMS(uint x)
{
        uchar  t;
        while(x--)
                for(t=120;t>0;t--);
}


void main()
{
        uchar i=0;
        P0=0x00;
        while(1)
        {
                P0=~DSY_CODE[i];
                i=(i+1)%10;
                DelayMS(200);
               
        }
}





欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1