找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1164|回复: 6
收起左侧

请问一下这个怎们解决main.c(6): error C129: missing ';' before '-'

[复制链接]
ID:1001624 发表于 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);
               
        }
}

回复

使用道具 举报

ID:342822 发表于 2022-1-16 11:27 | 显示全部楼层
uchar code DSY_CODE[]
回复

使用道具 举报

ID:161164 发表于 2022-1-16 11:41 | 显示全部楼层
"-"是减号,请用"_"代替
回复

使用道具 举报

ID:824490 发表于 2022-1-16 12:04 | 显示全部楼层
DSY-CODE ==》DSY_CODE  

就可以了,在这边不要用“-”,被误读成“减”了
回复

使用道具 举报

ID:8222 发表于 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);
               
        }
}
回复

使用道具 举报

ID:1001624 发表于 2022-1-16 16:09 | 显示全部楼层
谢谢各位,我傻了
回复

使用道具 举报

ID:453974 发表于 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);
               
        }
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表