标题:
error C247: non-address/-constant initializer
[打印本页]
作者:
FUGUANGWW
时间:
2023-11-15 17:57
标题:
error C247: non-address/-constant initializer
#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).
求大佬帮忙看一看
作者:
jiban530
时间:
2023-11-16 10:12
把inint1602();改成 init 1602();试试呢
作者:
yzwzfyz
时间:
2023-11-16 11:05
先将编辑器语句行号勾选起来,即每句首显示第几行。
这样好说。
作者:
Cqzm
时间:
2023-11-16 11:33
ETO=0;
THO=(65536-46483)/256;
TLO=(65536-46483)%256;
TRO=1;
是0不是O,ET0,TH0,TL0 TR0 试试
作者:
Hephaestus
时间:
2023-11-16 13:24
c语言数组不是c++的字符串。不能用第10行11行的赋值方法。
作者:
angmall
时间:
2023-11-16 13:45
#define 是宏定义 不用加分号
#define uchar unsigned char;
#define uint unsigned int;
作者:
Hephaestus
时间:
2023-11-16 15:32
angmall 发表于 2023-11-16 13:45
#define 是宏定义 不用加分号
#define uchar unsigned char;
虽然你说得对,但是按你的说法第6行就错了,但是报错是第11行,不觉得很奇怪吗?
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1