液晶不能正常显示
时间:10-02
整理:3721RD
点击:
液晶显示不全,程序写进去,液晶只有前5个字符可以显示,后面的就不能显示了,用的是c8051f020芯片控制的,不知道为什么,帮忙看下,程序如下:
#include<c8051f020.h>
#define unchar unsigned char
#define uint unsigned int
void write_com(unchar com);
void write_data(unchar date);
unchar code table[]="HEHENIHAO";
unchar code table1[]="GOOD";
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void init()
{
P4=0xf8;
P4=0xfc;
write_com(0x80);
write_com(0x38);
write_com(0x0e);
write_com(0x06);
}
void write_com(unchar com)
{
P4=0xf8;
P5=com;
delay(5);
P4=0xfc;
delay(5);
P4=0xf8;
}
void write_data(unchar date)
{
P4=0xf9;
P5=date;
delay(5);
P4=0xfd;
delay(5);
P4=0xf9;
}
void main()
{
uint num=0;
init();
for(num=0;num<9;num++)
{
write_data(table[num]);
delay(200);
}
write_com(0x80+0x45);
for(num=0;num<4;num++)
{
write_data(table1[num]);
delay(200);
}
while(1);
}
#include<c8051f020.h>
#define unchar unsigned char
#define uint unsigned int
void write_com(unchar com);
void write_data(unchar date);
unchar code table[]="HEHENIHAO";
unchar code table1[]="GOOD";
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void init()
{
P4=0xf8;
P4=0xfc;
write_com(0x80);
write_com(0x38);
write_com(0x0e);
write_com(0x06);
}
void write_com(unchar com)
{
P4=0xf8;
P5=com;
delay(5);
P4=0xfc;
delay(5);
P4=0xf8;
}
void write_data(unchar date)
{
P4=0xf9;
P5=date;
delay(5);
P4=0xfd;
delay(5);
P4=0xf9;
}
void main()
{
uint num=0;
init();
for(num=0;num<9;num++)
{
write_data(table[num]);
delay(200);
}
write_com(0x80+0x45);
for(num=0;num<4;num++)
{
write_data(table1[num]);
delay(200);
}
while(1);
}
看看延时有没有错
不是我以前写的那种。无能为力