標(biāo)題:
error C247: non-address/-constant initializer
[打印本頁(yè)]
作者:
FUGUANGWW
時(shí)間:
2023-11-15 17:57
標(biāo)題:
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
時(shí)間:
2023-11-16 10:12
把inint1602();改成 init 1602();試試呢
作者:
yzwzfyz
時(shí)間:
2023-11-16 11:05
先將編輯器語(yǔ)句行號(hào)勾選起來(lái),即每句首顯示第幾行。
這樣好說(shuō)。
作者:
Cqzm
時(shí)間:
2023-11-16 11:33
ETO=0;
THO=(65536-46483)/256;
TLO=(65536-46483)%256;
TRO=1;
是0不是O,ET0,TH0,TL0 TR0 試試
作者:
Hephaestus
時(shí)間:
2023-11-16 13:24
c語(yǔ)言數(shù)組不是c++的字符串。不能用第10行11行的賦值方法。
作者:
angmall
時(shí)間:
2023-11-16 13:45
#define 是宏定義 不用加分號(hào)
#define uchar unsigned char;
#define uint unsigned int;
作者:
Hephaestus
時(shí)間:
2023-11-16 15:32
angmall 發(fā)表于 2023-11-16 13:45
#define 是宏定義 不用加分號(hào)
#define uchar unsigned char;
雖然你說(shuō)得對(duì),但是按你的說(shuō)法第6行就錯(cuò)了,但是報(bào)錯(cuò)是第11行,不覺得很奇怪嗎?
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1