单片机程序一直编译不成功 missing function-prototype,以下是抄书上的程序,keil一直编译不过,新手小白不知道什么原因,自己对照书一直找不出错误。
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^6;
sbit wela=P2^7;
sbit led1=P1^0;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
void delayms(uint);
void dispaly(uchar,uchar);
uchar num,num1,num2,shi,ge;
void main()
{
TMOD=0x11;
TH0=(65536-45872)/256;
TL0=(65536-45872)%256;
TH1=(65536-45872)/256;
TL1=(65536-45872)%256;
EA=1;
ET0=1;
ET1=1;
TR0=1;
TR1=1;
while(1)
{
display(shi,ge);
}
}
void display(uchar shi,uchar ge) //μ÷óÃÏÔê¾×óoˉêy
{
dula=1;
P0=table[shi]; //μúò»¸öêyÂë1üÏÔê¾ê®Î»êy¾Y
dula=0;
P0=0xff; //1رÕËùóDÏÔê¾
wela=1;
P0=0xfe;
wela=0;
delayms(5);
dula=1;
P0=table[ge]; //μú¶t¸öêyÂë1üÏÔ꾸öλêy¾Y
dula=0;
P0=0xff; //1رÕËùóDÏÔê¾
wela=1;
P0=0xfd;
wela=0;
delayms(5);
}
void delayms(uint xms) //μ÷óÃmsÑóê±×óoˉêy
{
uint i,j;
for(i=xms;i>0;i–)
for(j=110;j>0;j–);
}
void T0_time() interrupt 1
{
TH0=(65536-45872)/256;
TL0=(65536-45872)%256;
num1++;
if(num1==4)
{
num1=0;
led1=~led1;
}
}
void T1_time() interrupt 3
{
TH1=(65536-45872)/256;
TL1=(65536-45872)%256;
num2++;
if(num2==20)
{
num2=0;
num++;
if(num==60)
num=0;
shi=num/10;
ge=num%10;
}
}
,请求大师傅告知一下。
keil
compiling 数码管2.c…
数码管2.c(31): warning C206: ‘display’: missing function-prototype
数码管2.c(31): error C267: ‘display’: requires ANSI-style prototype
数码管2.c(38): error C231: ‘display’: redefinition
数码管2.c(56): error C231: ‘display’: redefinition
Target not created.
Build Time Elapsed: 00:00:00,compiling 数码管2.c… 数码管2.c(31): warning C206: ‘display’: missing function-prototype 数码管2.c(31): error C267: ‘display’: requires ANSI-style prototype 数码管2.c(38): error C231: ‘display’: redefinition 数码管2.c(56): error C231: ‘display’: redefinition Target not created. Build Time Elapsed: 00:00:00,找到错误dispaly写错了,正确display