LCD1602A显示两行空格子以下是程序
#include <STC89C5xRC.H>
sbit RS=P1^0;sbit RW=P1^1;sbit E=P1^2;unsigned char lcd[]=("Hello lzy!"); //显示数组void delay(unsigned int t) //延时函数{ unsigned int i=0,j=0; for(i=0;i<t;i++) { for(j=0;j<120;j++); }}void writedat(unsigned char dat) //写数据函数{ RS=1; RW=0; E=0; P2=dat; delay(10); E=1; E=0;}void writecom(unsigned char com) //状态处理函数{ RS=0; RW=0; E=0; P2=com; delay(10); E=1; E=0;}void initlcd() //初始化{ writecom(0x38); writecom(0x0c); writecom(0x06); writecom(0x01);}void display() //显示函数{ unsigned int i; writecom(0x80+3); delay(10); //选择显示位置(0x80——第一行,3——列的位置,) |