#include"DS18B20_3.H"
#define uint unsigned int
#define uchar unsigned char uchar a,b,miao,shi,fen,ri,yue,nian,week,flag,key1n,temp,miao1,shi1=12,fen1=1,miao1=0,clock=0;
#define yh 0x80
#define er 0x80+0x40
sbit rs=P2^0;
sbit en=P2^2;
sbit rw=P2^1;
sbit led=P2^6;
sbit IO=P1^1;
sbit SCLK=P1^0;
sbit RST=P1^2;
sbit CLO=P1^4;
sbit ACC0=ACC^0;
sbit ACC7=ACC^7;
sbit key1=P1^5;
sbit key2=P1^6;
sbit key3=P1^7;
sbit buzzer=P1^3;
uchar code tab1[]={"20 - - "}; //显示这有错
uchar code tab2[]={" : : "}; //好着也有,
uchar code tab3[]={" HELLO WELCOME"}; //
void delay(uint xms)
{
uint x,y;
for(x=xms;x>0;x--)
for(y=110;y>0;y--);
}
void dela1ms(int i)
{
int j,k;
while(i--)
for(j=76;j>1;j--);
for(k=29;k>1;k--);
}
write_1602com(uchar com)
{
rs=0;
rw=0;
P0=com;
delay(1);
en=1;
delay(1);
en=0;
}
write_1602dat(uchar dat)
{
rs=1;
rw=0;
P0=dat;
delay(1);
en=1;
delay(1);
en=0;
}
lcd_init()
{
uchar j;
write_1602com(0x0f|0x08);
for(a=0;a<17;a++)
write_1602dat(tab3[a]);
j=17;
while(j--)
{
write_1602com(0x1c);
delay(700);
}
write_1602com(0x01);
delay(10);
write_1602com(0x38);
write_1602com(0x0c);
write_1602com(0x06);
write_1602com(0x01);
write_1602com(yh+1);
for(a=0;a<14;a++)
{
write_1602dat(tab1[a]);
delay(3);
}
write_1602com(er+2);
for(a=0;a<8;a++)
{
write_1602dat(tab2[a]);
delay(3);
}
write_1602com(er+0);
write_1602dat(0x24);
write_1602com(er+1);
write_1602dat(0x20);
}
void write_byte(uchar dat)
{
ACC=dat;
程序没有粘贴完,位置不够!@