#ifndef _lcd1602_h_
#define _lcd1602_h_
#include<reg51.h>
#define uchar unsigned char;
#define uint unsigned int;
uchar int_time;
uchar second;
uchar minute;
uchar hour;
uchar code date[]=" H.I.T. CHINA ";
uchar code time[]=" TIME 23;59;55";
uchar second=55,minute=59,hour=23;
void clock_init()
{
unsigned char i,j;
for(i=0;i<16;i++)
{
write_data(date[ i]);
}
write_com(0x80+0x40);
for(j=0;j<16;j++)
{
write_data(time{j});
}
}
void clock_write(unit s,unit m,unit h)
{
write_sfm(0x47,h);
write_sfm(0x4a,m);
write_sfm(0x4d,s);
}
void main()
{
init1602();
clock_init();
TMOD=0x01;
EA=1;
ETO=1;
THO=(65536-46483)/256;
TLO=(65536-46483)%256;
TRO=1;
int_time=0;
second=55;
minute=59;
hour=23;
while(1)
{
clock_write(second,minute,hour);
}
}
void TO_intereserve(void) interrupt 1 using 1
{int_time++;
if(int_time==20)
{
int_time=0;
second++;
}
if(second==60)
{
second=0;
minute ++:
}
if (minute==60)
{
minute=0;
hour ++;
}
if(hour==24)
{
hour=0;
}
THO=(65536-46083)/256;
TLO=(65536-46083)%256;
}
#endif
编译如下
compiling lcd1602.c...
lcd1602.c(10): error C247: non-address/-constant initializer
lcd1602.c - 1 Error(s), 0 Warning(s).
求大佬帮忙看一看 |