找回密码
 立即注册

QQ登录

只需一步,快速开始

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

main.c(4): error C129: missing ';' before 'i'这个究竟是什么问题啊,求解答

[复制链接]
跳转到指定楼层
楼主
ID:1005197 发表于 2022-2-14 21:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
#define LED_L16 P0
#define LED_H16 P2
#define LED_C0L P1
uchar i,j;
uchar s;
uchar time;
uchar start;
uint code aFont[4][32]=
{
0x00,0x00,0xF8,0x88,0x88,0x88,0x88,0xFF,0x88,0x88,0x88,0x88,0x88,0xF8,0x00,0x00,0x00,0x00,0x00,0x1F,0x08,0x08,0x08,0x08,0x7F,0x88,0x88,0x88,0x88,0x9F,0x80,0xF0,0x00
},
{
0x80,0x82,0x82,0x82,0x82,0x82,0x82,0xE2,0xA2,0x92,0x8A,0x86,0x82,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00
},
{
0x40,0x30,0x11,0x96,0x90,0x90,0x91,0x96,0x90,0x90,0x98,0x14,0x13,0x50,0x30,0x00,0x04,0x04,0x04,0x04,0x040x44,0x84,0x7E,0x06,0x05,0x04,0x04,0x04,0x04,0x04,0x00
},
{
0x00,0xFE,0x22,0x5A,0x86,0x10,0x0c,0x24,0x24,0x25,0x26,0x24,0x24,0x14,0x0c,0x00,0x00,0xFF,0x04,0x08,0x07,0x80,0x41,0x31,0x0F,0x01,0x01,0x3F,0x41,0x41,0x71,0x00
};
void main(void)
{
        LED_L16=0;
        LED_H16=0;        
        while(1)
        {
                Leddis(1);
                Leddis(2);
                Leddis(2,8);
                LeftC(4,8);
        }
        
}
void delay(uint t)//void
{
                while(t--);
}
void Leddis(uchar p)//void
{
                for(time=0;time<100;time++)
                        
        {               
                        s=0;
                  for(j=(p-1)*2;j<(p-1)*2+2;j++)
                {
                                for(i=0;i<16;i++)
                        {
                                        LED_COL=s;
                                        LED_L16=aFont[j][ i];
                                        LED_H16=aFont[j][i+16];
                                        delay(40);
                                        LED_L16=0;
                                        LED_H16=0;
                                        delay(2);
                                        s++;
                        }
                }                        
        }
}
void RightJ(uchar num,uchar movecol)//void
{
        start=16*num-movecol;
                while(1)
                {
                for(time=0;time<100;time++)
                        {
                                s=start;
                                for(j=0;j<4;j++)
                                {
                                        for(i=0;i<16;i++)
                                {
                                        LED_COL=s;
                                        LED_L16=aFont[j][ i];
                                        LED_H16=aFont[j][i+16];
                                        delay(40);
                                        LED_L16=0;
                                        LED_H16=0;
                                        delay(2);
                                        s++;        
                                        if(s>31) break;
                                }
                                if(s>31) break;
                        }
                        if(start>0)
                        {
                        start-=movecol;
                        }
                        else
                        {
                                break;
                        }
                }
        }
}
void RightC(uchar num,uchar movecol)//void
{
        uchar col=movecol;
        uchar n=0;
        uchar count=0;
                while(count<16*num/movecol)
                {
                for(time=0;time<100;time++)
                        {
                                s=0;
                                start=col;
                                for(j=n;j<4;j++)
                                {
                                for(i=start;i<16;i++)
                                {
                                LED_COL=s;
                                LED_L16=aFont[j][ i];
                                LED_H16=aFont[j][i+16];
                                        delay(40);
                                        LED_L16=0;
                                        LED_H16=0;
                                        delay(2);
                                        s++;        
                                        if(s>31) break;
                                }
                                start=0;
                                if(s>3)break;
                        }
                                count++;
                                co1+=movecol;
                                if(col==16)                        
                        {
                                n++;
                                col=0;
                        }
                }
        }
}
最后测试有错,下面显示的是这样
compiling main.c...
main.c(4): error C129: missing ';' before 'i'
main.c - 1 Error(s), 0 Warning(s).

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

使用道具 举报

沙发
ID:625730 发表于 2022-2-14 22:13 | 只看该作者
uchar 没有被定义吧。
回复

使用道具 举报

板凳
ID:908826 发表于 2022-2-15 08:55 | 只看该作者
uchar这个一般情况下是说的unsigned char的缩写,这个需要你自己定义,一般是宏定义#define uchar unsigned  char
回复

使用道具 举报

地板
ID:139866 发表于 2022-2-15 15:19 | 只看该作者
不包含头文件你这程序能编译过吗?
还有,aFont这个定义你看你写对了?
自定义函数不在 Main函数之前声明为什么能在main里调用?
回复

使用道具 举报

5#
ID:1005197 发表于 2022-2-15 21:24 | 只看该作者
13205495918 发表于 2022-2-15 08:55
uchar这个一般情况下是说的unsigned char的缩写,这个需要你自己定义,一般是宏定义#define uchar unsigned ...

还是有错
下面显示的是
compiling main.c...
main.c(9): error C129: missing ';' before 'code'
main.c - 1 Error(s), 0 Warning(s).
回复

使用道具 举报

6#
ID:625730 发表于 2022-2-15 21:32 | 只看该作者
龚芳平 发表于 2022-2-15 21:24
还是有错
下面显示的是
compiling main.c...

uint一样也要定义,耐心找些案例看看,先易后难。
回复

使用道具 举报

7#
ID:879809 发表于 2022-2-15 23:41 | 只看该作者
13205495918 发表于 2022-2-15 08:55
uchar这个一般情况下是说的unsigned char的缩写,这个需要你自己定义,一般是宏定义#define uchar unsigned ...

我总觉得#define没有typedef合理。
回复

使用道具 举报

8#
ID:624769 发表于 2022-2-16 01:28 | 只看该作者
发表于 2022-2-15 23:41
我总觉得#define没有typedef合理。

#define 可以被反复包含,所以喜欢搬运代码, 又不太喜欢整理的  喜欢用 define
喜欢自己码代码的 会喜欢用 typedef
回复

使用道具 举报

9#
ID:313048 发表于 2022-2-16 09:31 | 只看该作者
知其然不知其所以然,抄代码要你也要知道代码是干啥用,别C都不懂,然后就直接抄过来用。
回复

使用道具 举报

10#
ID:1005197 发表于 2022-2-16 20:28 | 只看该作者
AUG 发表于 2022-2-16 09:31
知其然不知其所以然,抄代码要你也要知道代码是干啥用,别C都不懂,然后就直接抄过来用。

正在学习期间,还有很多需要请教
回复

使用道具 举报

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

本版积分规则

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

Powered by 单片机教程网

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