KEIL错误:error C129: missing ';' before 'data' 到底哪里错了啊
#include"reg52.h"#defineuintunsignedint#defineucharunsignedcharsbitD1=P2^2;sbitD2=P2^...
#include"reg52.h"
#define uint unsigned int
#define uchar unsigned char
sbit D1=P2^2;
sbit D2=P2^3;
sbit D3=P2^4;
uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00};
uchar shu1,shu2,shu3,shu4,shu5,shu6,shu7,shu8,t0;
uint shua,shub;
voide data();
voide delay(uint);
voide display();
voide init();
voide main()
{
init();
shub=8765;shua=4321;
while(1)
{
data();
display();
if(shub==6666&shua==6666)
TR0=0;
}
}
voide init()
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
}
voide time0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
t0++;
if(t0==20)
{
t0=0;
shua--;
if(shua==0)
{
shua=9999;
shub--;
}
}
}
voide data() //数据处理
{
shu1=shua%10;
shu2=shua%100/10;
shu3=shua%1000/100;
shu4=shua/1000;
shu5=shub%10;
shu6=shub%100/10;
shu7=shub%1000/100;
shu8=shub/1000;
}
voide display() //数码管显示、关闭
{
D3=0;D2=0;D1=0; P0=0;
D3=0;D2=0;D1=1; P0=0;
D3=0;D2=1;D1=0; P0=0;
D3=0;D2=1;D1=1; P0=0;
D3=1;D2=0;D1=0; P0=0;
D3=1;D2=0;D1=1; P0=0;
D3=1;D2=1;D1=0; P0=0;
D3=1;D2=1;D1=1; P0=0;
delay(10);
D3=0;D2=0;D1=0; P0=table[shu1];
D3=0;D2=0;D1=1; P0=table[shu2];
D3=0;D2=1;D1=0; P0=table[shu3];
D3=0;D2=1;D1=1; P0=table[shu4];
D3=1;D2=0;D1=0; P0=table[shu5];
D3=1;D2=0;D1=1; P0=table[shu6];
D3=1;D2=1;D1=0; P0=table[shu7];
D3=1;D2=1;D1=1; P0=table[shu8];
}
voide delay(uint z) //延时
{
uint x,y;
for(x=z;x>0;x--)
for(y=100;y>0;y--);
} 展开
#define uint unsigned int
#define uchar unsigned char
sbit D1=P2^2;
sbit D2=P2^3;
sbit D3=P2^4;
uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00};
uchar shu1,shu2,shu3,shu4,shu5,shu6,shu7,shu8,t0;
uint shua,shub;
voide data();
voide delay(uint);
voide display();
voide init();
voide main()
{
init();
shub=8765;shua=4321;
while(1)
{
data();
display();
if(shub==6666&shua==6666)
TR0=0;
}
}
voide init()
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
}
voide time0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
t0++;
if(t0==20)
{
t0=0;
shua--;
if(shua==0)
{
shua=9999;
shub--;
}
}
}
voide data() //数据处理
{
shu1=shua%10;
shu2=shua%100/10;
shu3=shua%1000/100;
shu4=shua/1000;
shu5=shub%10;
shu6=shub%100/10;
shu7=shub%1000/100;
shu8=shub/1000;
}
voide display() //数码管显示、关闭
{
D3=0;D2=0;D1=0; P0=0;
D3=0;D2=0;D1=1; P0=0;
D3=0;D2=1;D1=0; P0=0;
D3=0;D2=1;D1=1; P0=0;
D3=1;D2=0;D1=0; P0=0;
D3=1;D2=0;D1=1; P0=0;
D3=1;D2=1;D1=0; P0=0;
D3=1;D2=1;D1=1; P0=0;
delay(10);
D3=0;D2=0;D1=0; P0=table[shu1];
D3=0;D2=0;D1=1; P0=table[shu2];
D3=0;D2=1;D1=0; P0=table[shu3];
D3=0;D2=1;D1=1; P0=table[shu4];
D3=1;D2=0;D1=0; P0=table[shu5];
D3=1;D2=0;D1=1; P0=table[shu6];
D3=1;D2=1;D1=0; P0=table[shu7];
D3=1;D2=1;D1=1; P0=table[shu8];
}
voide delay(uint z) //延时
{
uint x,y;
for(x=z;x>0;x--)
for(y=100;y>0;y--);
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询