程序如下:
#include<reg52.h>
sbit EN=P2^6;
sbit RS=P2^4;
sbit RW=P2^5;
#define uchar unsigned char
#define uint unsigned int
uchar code table[]="hello world";
uchar code table1[]="hello china";
uchar num;
void delay(uint z);
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void write_com(unsigned char com)//写命令,指令的函数
{
RS=0;//rs=0,写指令 rs=1,写数据
P0=com;
delay(5);
EN=1;
delay(5);
EN=0;
}
void write_data(unsigned char date)//写数据的函数
{
RS=1;//rs=0,写指令 rs=1,写数据
P0=date;
delay(5);
EN=1;
delay(5);
EN=0;
}
void init()
{
EN=0;
write_com(0x38);// 显示模式设置 二进制:00111000
write_com(0x0e);// 显示开光以及光标设置
write_com(0x07);// 显示开光以及光标设置
}
void mian()
{
init();
for(num=0;num<11;num++)
{
write_data(table[num]);
delay(30);
}
write_com(1);//清屏
write_com(0x80+0x40);//重新设置数据指针,从第二行开始
for(num=0;num<13;num++)
{
write_data(table1[num]);
delay(30);
}
for(num=0;num<16;num++)
{
write_data(0x18);
delay(200);
}
while(1);
}
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?MIAN?8_1
*** WARNING L10: CANNOT DETERMINE ROOT SEGMENT
Program Size: data=9.0 xdata=0 code=199
"8-1" - 0 错误 (s), 2 警告 (s).
该怎么解决啊~~~谢谢大家了·!!!!
|