標(biāo)題: 請(qǐng)問一下這個(gè)怎們解決main.c(6): error C129: missing ';' before '-' [打印本頁(yè)]

作者: 云fei    時(shí)間: 2022-1-16 10:13
標(biāo)題: 請(qǐng)問一下這個(gè)怎們解決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    時(shí)間: 2022-1-16 11:27
uchar code DSY_CODE[]
作者: lkc8210    時(shí)間: 2022-1-16 11:41
"-"是減號(hào),請(qǐng)用"_"代替
作者: 名字不是重點(diǎn)    時(shí)間: 2022-1-16 12:04
DSY-CODE ==》DSY_CODE  

就可以了,在這邊不要用“-”,被誤讀成“減”了
作者: 溫xyz    時(shí)間: 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    時(shí)間: 2022-1-16 16:09
謝謝各位,我傻了
作者: 累不死的狗    時(shí)間: 2022-1-17 22:06
自己抄錯(cuò)程序了
#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.torrancerestoration.com/bbs/) Powered by Discuz! X3.1