TEXT1.C(113): error C141: syntax error near 'void'请问我的程序哪错了
#include<reg52.h>#defineucharunsignedchar//宏定义#defineuintunsignedintsbitWL=P2^0;sbitD...
#include<reg52.h>
#define uchar unsigned char //宏定义
#define uint unsigned int
sbit WL=P2^0;
sbit DL=P2^1;
sbit xinhao=P3^4;
uchar t;
uint T,num,qian,bai,shi,ge;
void delay(uint z) //延时子函数
{
uint x,y;
for(x=110;x>0;x--)
for(y=z;y>0;y--);
}
uchar code table[]={0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71,
0x00};
void display(uchar qian,uchar bai,uchar shi,uchar ge )
{
WL=1;
P1=0xfe;
WL=0;
DL=1;
P1=table[qian];
DL=0;
delay(1);
WL=1;
P1=0xfd;
WL=0;
DL=1;
P1=table[bai];
DL=0;
delay(1);
WL=1;
P1=0xfd;
WL=0;
DL=1;
P1=0x80;
DL=0;
WL=1;
P1=0xfb;
WL=0;
DL=1;
P1=table[shi];
DL=0;
delay(1);
WL=1;
P1=0xf7;
WL=0;
DL=1;
P1=table[ge];
DL=0;
delay(1);
}
uint read()
{
uchar th1,th2,tl;
uint avl;
while(1)
{
th1=TH0;
tl=TL0;
th2=TH0;
if(th1==th2)
break;
}
avl=th1*256+tl;
return avl;
} //实现读取运行中计数器寄存器中的值
void main()
{
TMOD=0x15;
TH1=(65536-10000)/256;
TL1=(65536-10000)%256;
TH0=0;
TL0=0;
EA=1;
while(xinhao==1);
TR0=1;
TR1=1;
ET0=1;
ET1=1;
while(1)
{
num=read();
if(num==10)
{
T=12*(1/11059200)*(TH1*256+TL1+t*50000)/100;
qian=T/1000;
bai=T/100%10;
shi=T%100/10;
ge=T%10;
}
display(qian,bai,shi,ge);
}
void timer1() interrupt 3
{
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
t++;
if(t>=10)
{
TH0=0;
TL0=0;
t=0;
}
} 展开
#define uchar unsigned char //宏定义
#define uint unsigned int
sbit WL=P2^0;
sbit DL=P2^1;
sbit xinhao=P3^4;
uchar t;
uint T,num,qian,bai,shi,ge;
void delay(uint z) //延时子函数
{
uint x,y;
for(x=110;x>0;x--)
for(y=z;y>0;y--);
}
uchar code table[]={0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71,
0x00};
void display(uchar qian,uchar bai,uchar shi,uchar ge )
{
WL=1;
P1=0xfe;
WL=0;
DL=1;
P1=table[qian];
DL=0;
delay(1);
WL=1;
P1=0xfd;
WL=0;
DL=1;
P1=table[bai];
DL=0;
delay(1);
WL=1;
P1=0xfd;
WL=0;
DL=1;
P1=0x80;
DL=0;
WL=1;
P1=0xfb;
WL=0;
DL=1;
P1=table[shi];
DL=0;
delay(1);
WL=1;
P1=0xf7;
WL=0;
DL=1;
P1=table[ge];
DL=0;
delay(1);
}
uint read()
{
uchar th1,th2,tl;
uint avl;
while(1)
{
th1=TH0;
tl=TL0;
th2=TH0;
if(th1==th2)
break;
}
avl=th1*256+tl;
return avl;
} //实现读取运行中计数器寄存器中的值
void main()
{
TMOD=0x15;
TH1=(65536-10000)/256;
TL1=(65536-10000)%256;
TH0=0;
TL0=0;
EA=1;
while(xinhao==1);
TR0=1;
TR1=1;
ET0=1;
ET1=1;
while(1)
{
num=read();
if(num==10)
{
T=12*(1/11059200)*(TH1*256+TL1+t*50000)/100;
qian=T/1000;
bai=T/100%10;
shi=T%100/10;
ge=T%10;
}
display(qian,bai,shi,ge);
}
void timer1() interrupt 3
{
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
t++;
if(t>=10)
{
TH0=0;
TL0=0;
t=0;
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询