找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 2003|回復(fù): 6
打印 上一主題 下一主題
收起左側(cè)

請問一下這個怎們解決main.c(6): error C129: missing ';' before '-'

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:1001624 發(fā)表于 2022-1-16 10:13 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
#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);
               
        }
}

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報

沙發(fā)
ID:342822 發(fā)表于 2022-1-16 11:27 | 只看該作者
uchar code DSY_CODE[]
回復(fù)

使用道具 舉報

板凳
ID:161164 發(fā)表于 2022-1-16 11:41 | 只看該作者
"-"是減號,請用"_"代替
回復(fù)

使用道具 舉報

地板
ID:824490 發(fā)表于 2022-1-16 12:04 | 只看該作者
DSY-CODE ==》DSY_CODE  

就可以了,在這邊不要用“-”,被誤讀成“減”了
回復(fù)

使用道具 舉報

5#
ID:8222 發(fā)表于 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);
               
        }
}
回復(fù)

使用道具 舉報

6#
ID:1001624 發(fā)表于 2022-1-16 16:09 | 只看該作者
謝謝各位,我傻了
回復(fù)

使用道具 舉報

7#
ID:453974 發(fā)表于 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);
               
        }
}
回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表