keil编译器中,为什么我的程序有这么多的错误

#include<reg51.h>
typedef unsigned char u8;
typedef unsigned int u16;
sbit a=P2^2;
sbit b=P2^3;
sbit c=P2^4;
u8 code duan[17]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71}

void main()
{
a=0;
b=0;
c=0;
P0=smgduan[0];
while(1);
}

第1个回答  2018-07-11
第7~10行,段码表最后要加一个分号;
主程序第4行
P0=smgduan[0];多了3个字母,与上面定义的段码表不符,就是缺少分号的那行,
应该是
P0=duan[0];本回答被网友采纳
第2个回答  2018-07-11

段码申明那里少一个分好;

#include<reg51.h>
typedef unsigned char u8;
typedef unsigned int u16;
sbit a=P2^2;
sbit b=P2^3;
sbit c=P2^4;
u8 code duan[17]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};

void main()
{
a=0;
b=0;
c=0;
P0=smgduan[0];
while(1);
}

本回答被提问者采纳
相似回答