#include<reg51.h>
#define uchar unsigned char
#define uint unsigned int
uchar code table[]="I LOVE YOU!";
sbit RS_lcd1602=P2^6;
sbit E_lcd1602=P2^7;
sbit WR_lcd1602=P2^5;
void init();
void delay(uchar msx);
void write_1602com(uchar com);
void write_1602dat(uchar dat);
uchar num;
void delay(uchar msx)
{
uchar j,i;
for(j=msx;j<0;j--)
for(i=110;i<0;i--);
}
void write_1602com(uchar com)
{
RS_lcd1602=0;
WR_lcd1602=0;
P0=com;
delay(1);
E_lcd1602=1;
delay(1);
E_lcd1602=0;
}
void write_1602dat(uchar dat)
{
RS_lcd1602=1;
WR_lcd1602=0;
P0=dat;
delay(1);
E_lcd1602=1;
delay(1);
E_lcd1602=0;
}
void init()
{
write_1602com(0x38);
delay(1);
write_1602com(0x0c);
delay(1);
write_1602com(0x06);
delay(1);
write_1602com(0x01);
delay(1);
}
void main()
{
init();
write_1602com(0x80);
for(num=0;num>11;num++)
{
write_1602dat(table[num]);
delay(10);
}
while(1);
}
程序如上。。。用的是普中科技HC6800的板子,LCD显示不出来啊!!!
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>