keil 编译的时候出现这个警告*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS 要怎么消除??没有任何错误
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit S1=P3^5; //定义"启动"按钮
sbit S2=P3^4; //定义"停止"按钮
sbit S3=P3^3; //定义"清零"按钮
sbit P2_0 = P2^0;
sbit P2_1 = P2^1;
sbit P2_2 = P2^2;
sbit P2_3 = P2^3;
uchar p,q,a,s,g,hms,hmg;
unsigned char disp[4];
uchar code table[]={0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8,
0x80,0x90, 0x88, 0x83, 0xC6, 0xA1, 0x86, 0x8E}; //共阳极数码管编码
void display(uchar s,uchar g,uchar hms,uchar hmg); //声明显示函数
void delay(uint z); //声明延时函数
void init(); //声明初始化函数
void main()
{
init(); //调用初始化程序
while(1)
{
if(S1==0) //检测"启动"按钮是否按下
{
delay(10); //延时去抖动
if(S1==0) //再次检测"启动"按钮是否按下
{
while(!S1);//松开手检测,若按键没有释放,S1始终为0,那么!S1始终为1,程序就一直停在此
TR0=1; //启动定时器
}
}
if(S2==0) //检测"停止"按钮是否按下
{
delay(10); //延时去抖动
if(S2==0) //再次检测"停止"按钮是否按下
{
while(!S2);//松手检测
TR0=0; //关闭定时器
}
}
if(S3==0) //检测"清零"按钮是否按下
{
delay(10); //延时去抖动
if(S3==0) //再次检测"清零"按钮是否按下
{
while(!S3);//松手检测
p=0; //将变量p的值清零
q=0; //将变量q的值清零
s=0; //将秒的十位清零
g=0; //将秒的个位清零
hms=0; //将毫秒的十位清零
hmg=0; //将毫秒的个位清零
TR0=0; //关闭定时器
}
}
display(s, g, hms, hmg); //调用显示函数
}
}
void delay(uint z) //延时函数
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void display(uchar s,uchar g,uchar hms,uchar hmg) //显示程序
{
P2=0x7f;
s=disp[0];
delay(10);
P2=0xbf;
g=disp[1];
delay(10);
P2=0xdf;
hms=disp[2];
delay(10);
P2=0xef;
hmg=disp[3];
delay(10); //使用动态扫描的方法实现数码管显示
}
void init() //初始化程序
{
p=0;
TMOD=0x01; //使用定时器T0的方式1
TH0=(65536-50000)/256;
TL0=(65536-50000)%256; //定时5ms中断一次
EA=1; //中断总允许
ET0=1; //允许定时器T0中断
}
void timer0() interrupt 1
{
TH0=(65536-5000)/256; //重新赋初值
TL0=(65536-5000)%256;
a++; //中断一次变量a加一
if(a==20)
{
a=0;
p++; if(p>99) //当秒表中毫秒的值大于99时回零
{
p=0;
q++; //秒表中秒的值加一
if (q==60) //当秒表中秒的值等于60时回零
{
q=0;
}
}
s=q/10; g=q%10; hms=p/10; hmg=p%10; //分离秒的个位和十位,分离毫秒的个位和十位
}
}
|