本帖最后由 剑花落影 于 2013-4-11 19:19 编辑
小弟最近在学
单片机,以下是用数码管显示时钟的程序,可是执行后会有警告
“*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS SEGMENT: ?PR?MIAN?CLOCK
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?C_INITSEG”
上网查说是有未调用的函数,可是我的函数都调用了啊
还有我调试程序时,执行到C:0x0008 8090 SJMP C:FF9A时
会出现*** error 65: access viola
tion at C:0xFF9A : no 'execute/read' permission
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code Tab[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
uchar count=0,sec_carry=0,sec=0;
void initial_timer0()
{
TMOD=0x01;
ET0=1;
EA=1;
TH0=(65536-10000)>>8;
TL0=65536-10000;
TR0=1;
}
void delay(uint k)
{
uint i,j;
for(i=0;i<k;i++)
for(j=0;j<121;j++);
}
void display_apart()
{
P0=0xbf;
P2=0xdb;
delay(1);
}
void display_num(uchar x,p_shi,p_ge)
{
uchar shi,ge;
shi=x/10;
ge=x%10;
P0=Tab[ge];
P2=p_ge;
delay(1);
P0=Tab[shi];
P2=p_shi;
delay(1);
} void mian()
{
uchar hour=0,min=0;
initial_timer0();
while(1)
{
if(hour==24)
hour=0;
else
{
if(min==60)
{
hour+=1;
min=0;
}
else
{
if(sec_carry==1)
{
min+=1;
sec_carry=0;
}
}
}
display_apart();
display_num(sec,0xbf,0x7f);
display_num(min,0xf7,0xef);
display_num(hour,0xfe,0xfd);
}
}
void int0() interrupt 1
{
TH0=(65536-10000)>>8;
TL0=65536-10000;
if(++count==100)
{
count=0;
sec++;
if(sec==60)
{
sec_carry=1;
sec=0;
}
}
}
确实运行了
犯的错误太低级了
一周热门 更多>