找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2714|回复: 6
打印 上一主题 下一主题
收起左侧

LED3.C(4): error C129: missing ';' before 'char'

[复制链接]
跳转到指定楼层
楼主
ID:443762 发表于 2019-6-26 11:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
#include<reg52.h>
#define uchar unshigned char
#define uint unshigned int
uchar b;
uchar code table[]={0x00,0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0xff};
void ys(uint);
void main()
{

        wihle(1)
        {
                for(b=9;b>0;b++)
                {
                P1=table[b];
                ys(500);
                }
        }
}
void ys(unsigned int hs)
{
        unsigned int i,j;
        for(i=hs;i>0;i--)
        {
                for(j=125;j>0;j--);
        }
}
编译时老是出现char前面少了个分号,
求大神们帮忙看看!!!!!!!!!!!!!!

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:213173 发表于 2019-6-26 12:09 | 只看该作者
就这么几条语句还打错字,楼主太粗心。
#include<reg52.h>
//#define uchar unshigned char
//#define uint unshigned int
#define uchar unsigned char
#define uint unsigned int
uchar b;
uchar code table[]={0x00,0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0xff};
void ys(uint);
void main()
{
//        wihle(1)
        while(1)
        {
                for(b=9;b>0;b++)
                {
                        P1=table[b];
                        ys(500);
                }
        }
}
void ys(uint hs)
{
        uint i,j;
        for(i=hs;i>0;i--)
        {
                for(j=125;j>0;j--);
        }
}
回复

使用道具 举报

板凳
ID:564898 发表于 2019-6-26 14:25 来自触屏版 | 只看该作者
unsigned char
回复

使用道具 举报

地板
ID:571958 发表于 2019-6-26 17:25 | 只看该作者
用define不好,应该用typedef
typedef unsigned char u8;
回复

使用道具 举报

5#
ID:446383 发表于 2019-6-27 15:24 | 只看该作者
typedef 会检查语法错误,  define不会检查。
回复

使用道具 举报

6#
ID:307020 发表于 2019-6-27 23:42 | 只看该作者
还是多看看书和例程,熟悉熟悉关键字,不要总忙着挣黑币呦
回复

使用道具 举报

7#
ID:573345 发表于 2019-6-28 09:29 | 只看该作者
#define uchar unsigned char
#define uint   unsinged int

注意:unsingned 的拼写
回复

使用道具 举报

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

本版积分规则

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

Powered by 单片机教程网

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