喊麦歌曲大全100首:高手帮我看看 关于函数声明

来源:百度文库 编辑:中科新闻网 时间:2024/04/30 09:51:38
我是菜鸟 高手帮我看看,delay()函数怎么声明,这个程序能通过编译,但有下列警告:warning c206:‘delay’:missing function-prototype。 程序运行起来却没有问题,如果我把delay()放到main()之前就没问题,但我想问一下,如果我一定要放后面现在的位置,应该怎么改,高手帮帮菜鸟,刚学c51

#include <reg51.h>

unsigned char code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
unsigned char sec1;
unsigned char sec2;
unsigned char count;
sbit p24=P2^4;
sbit p23=P2^3;
sbit p20=P2^0;
unsigned char bdata bitx; //位设置 位字节
sbit m=bitx^0; //定义要在main()外定义为全局变量
sbit n=bitx^1;
sbit j=bitx^2;
sbit q=bitx^3;
sbit w=bitx^4;
sbit e=bitx^5;
sbit r=bitx^6;
sbit t=bitx^7;
unsigned char bdata bity;
sbit y=bity^0;
sbit u=bity^1;
unsigned char b;
unsigned char c;
unsigned char a;

main()
{
TMOD=0x10;
ET1=1;
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
EA=1;
TR1=1 ;
EX1=1 ;
IT1=1 ;
sec1=0;
sec2=0;
m=1;
for (;;)
{
P0=table[sec1];
p23=0;
for (a=0;a<10;a++)
{
delay();
}
p23=1;
P0=table[sec2];
p24=0;
for (a=0;a<10;a++)
{
delay();
}
p24=1;
m=~m;
}
}

void t1(void) interrupt 3 using 0
{
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
count++;
if (count==20)
{
count=0;
sec1++;
if (sec1==10)
{
sec1=0 ;
sec2++ ;
if (sec2==6)
{
sec2=0;
}
}

}
}

void IaT0(void) interrupt 2
{
P0=0x00;
p20=0;
while(1);
}

delay()
{
for (b=0;b<65535;b++)
{
for (c=0;c<100;c++);
}
}

在#include后面增加一行函数定义
void delay(void);