本文包含原理图、PCB、源代码、封装库、中英文PDF等资源
您需要 登录 才可以下载或查看,没有账号?注册会员
×
在keil中出现error l 118:reference made to erroneous external 无法生成目标
程序如下 :#include <reg51.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit RS=P2^0;
sbit RW=P2^1;
sbit E=P2^2;
long Ncount=0,aq=(65536-10000)/256,bq=(65536-10000)%256;
uchar b,q,w,m;
void delay(int n)
{ int i,j;
for (i=0;i<m;i++)
for (j=0;j<100;j++);
}
void Busy()
{
uchar busy;
do
{
E=0;
RS=0;
RW=1;
delay(1);
P1=0xFF;
E=1;
busy=P1;
delay(1);
E=0;
}
while(busy&0x80);
}
void write_com(uchar j)
{E=0;
RS=0;
RW=0;
E=1;
P1=j;
busy();
E=0;
}
void write_data(uchar j)
{ E=0;
RS=1;
RW=0;
E=1;
P1=j;
busy();
E=0;
}
void init(void)
{
write_com(0x38);
write_com(0x0c);
write_com(0x06);
write_com(0x01);
}
void init1(void)
{
TMOD=0x15;
EA=0;
TH1=aq;
TL1=bq;
TH0=0X00;
TL0=0X00;
TR0=1;
TR1=1;
TF0=0;
TF1=0;
}
void bintobcd(void)
{
Ncount=TH0;
Ncount=(Ncount<<8)|TL0;
m=Ncount/1000;
w=Ncount%1000/100;
q=Ncount%1000%100/10;
b=Ncount%1000%100%10;
}
void display(void)
{if(TF1==1)
{TF1=0;
TH1=aq;
TL1=bq;
bintobcd();
TH0=0x00;
TL0=0x00;
write_com(0xc0);
write_data('F');
write_data(':');
write_com(0xc7);
write_data(m+0X30);
write_data(w+0X30);
write_data(q+0X30);
write_data(b+0X30);
write_com(0xce);
write_data('H');
write_data('Z');
}
display();
}
void main(void)
{
init();
init1();
while (1)
{
delay(15);
display();
}
} |
|