main.c(199): error C237: 'display': function already has a body

LAN929131485 2020-06-10 09:05:45
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code
tab[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
float f;
uchar sg,ss,bai,shi,gei,xsl,xs2,tt,ii;
sbit ds=P1^1;
sbit weed=P3^0;
sbit dued=P3^1;
sbit xeed=P3^4;
sbit hh=P3^2;
sbit hh1=P3^3;
sbit pp=P1^2;
sbit pp1=P2^0;
void display();
void dely(uint a);
bit chu18b20()
{
uint i;
bit x;
x=1;
ds=1;
i++;
ds=0;
i=100;
while(--i);
ds=1;
i=6;
while(--i);
x=ds;
i=10;
while(--i);
return(x);
}

uchar redds18b20()
{
uint i;
uchar date,k;
date=0;
for(k=0;k<8;k++)
{
date=date>>1;
ds=0;
i++;
ds=1;
i++;
i=1;
while(--i);
if(ds==1)
date=date|0x80;
else date=date|0x00;
i=10;
while(--i);
}

return(date);
}

void writeds18b20(uchar date)
{
uchar temp,k;
bit x1;
uint i;
for(k=0;k<8;k++)
{
temp=date;
x1=temp&0x01;
date=date>>1;
if(x1)
{
ds=0;
i++;
ds=1;
i++;
i=10;
while(--i);
ds=1;
}
else
{
ds=0;
i++;
i=10;
while(--i);
ds=1;
}
}
}

void redtemp()
{
uchar templ,temph;
uint temp;
if(!chu18b20())
{
writeds18b20(0xcc);
writeds18b20(0xbe);
templ=redds18b20();
temph=redds18b20();
display();
temph=temph&0x07; //??????
temp=temph<<8;
temp=temp|templ;
f=temp*0.0625;
}
}

void chuli()
{
uint zz;
zz=f*100;
bai=zz/10000;
shi=(zz/1000)%10;
gei=(zz/100)%10;
xs2= zz%10;
if(xs2>=5)
xsl=(zz/10)%10+1;
else xsl=(zz/10)%10;
}
void qidong18b20()
{
if(!chu18b20())
{
writeds18b20(0xcc);
writeds18b20(0x44);
}
}
void display()
{
chuli();
weed=1;
P0=0xfe;
weed=0;
dued=1;
P0=tab[xsl];
dued=0;
dely(1);
dued=1;
P0=0X00;
dued=0;
weed=1;
P0=0Xfd;
weed=0;
dued=1;
P0=tab[gei]|0x80;
dued=0;
dely(1);
dued=1;
P0=0X00;
dued=0;
weed=1;
P0=0xfb;
weed=0;
dued=1;
P0=tab[shi];
dued=0;
dely(1);
dued=1;
P0=0X00;
dued=0;
weed=1;
P0=0xef;
weed=0;
dued=1;
P0=tab[0];
dued=0;
dely(1);
dued=1;
P0=0X00;
dued=0;
weed=1;
P0=0Xdf;
weed=0;
dued=1;
P0=tab[sg]|0x80;
dued=0;
dely(1);
dued=1;
P0=0X00;
dued=0;
weed=1;
P0=0Xbf;
weed=0;
dued=1;
P0=tab[ss];
dued=1;
dely(1);
P0=0X00;
dued=0;
}

void display(uint a)
{
uint x,y;
for(x=a;x>0;x--);
for(y=122;y>0;y--);
}
void chu52()
{
pp1=0;
TMOD=0X01;
TH0=0X3C;
TL0=0XB0;
P1=0xff;
sg=0;
ss=7;
ET0=1;
EA=1;
f=70;
TR0=1;
tt=0;
}

void timer0(void)interrupt 1
{
TH0=0X3C;
TL0=0XB0;
tt++;
if(tt==20)
{
tt=0;
redtemp();
display();
qidong18b2();
}
}
void anjian()
{
if(hh==0)
for(ii=0;ii<12;ii++)
display();
if(hh==0)
{
sg=sg+1;
if(sg==10)
sg=0;
}
if(hh1==0)
for(ii=0;ii<12;ii++)
display();
if(hh1==0)
{
ss=ss+1;
if(ss==10)
ss=0;
}
}

void main()
{
chu52();
qidong18b20();
while(1);
{
float fs;
fs=ss*10+sg;
if(f>=fs)
{
pp=1;
if(f-fs>=5)
pp1=1;
else pp1=0;
}
if(f<fs)
{
pp=0;
pp1=0;
}
display();
anjisn();
}
}
...全文
1927 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
棉猴 2020-06-11
  • 打赏
  • 举报
回复
main()函数的最后
 display();
 anjian();//--------anjisn()改为anjian()------
在main()函数代码的上面
void dely(uint a)\\-----display改为dely-----
{
    uint x,y;
for(x=a;x>0;x--);
qybao 2020-06-10
  • 打赏
  • 举报
回复
把void display(uint a) 改成 void dely(uint a)
LAN929131485 2020-06-10
  • 打赏
  • 举报
回复
有大佬救救我吗,想了半天了,就一个错误。

3,882

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧