#include
#define uint unsigned int#define uchar unsigned charsbit rs=P1^0;//数据/指令挑选端(H/L)sbit rw=P1^1;//读/写挑选端(H/L)sbit en=P1^2;//使能端uchar code zifu1[]="Gui fa zhi *_* !";uchar code zifu2[]="tel: 18778434282";uint i;void delay(uchar time)//延时函数{uint x,y;for(x=100;x>0;x--)for(y=time;y>0;y--);}void write_com(uchar com) //指令输入函数{rs=0;P2=com;delay(5);en=1;delay(5);en=0;}void write_date(uchar date)//数据输入函数{rs=1;P2=date;delay(5);en=1;delay(5);en=0;}void chu()//液晶初始化{rw=0;//低电平要挟数据或指令en=0;write_com(0x38);//设置16X2显现,5X7点阵,8位数据口write_com(0x01);//数据指针清零write_com(0x0c);//光标敞开}void move()//整屏移动(0x18是向左移,0x1c是右移){for(i=0;i<16;i++)//移动16位{write_com(0x18);delay(500);}}void main()//主函数{chu();write_com(0x80+0x10);//挑选地址for(i=0;i<16;i++){write_date(zifu1[i]);delay(5);}write_com(0x80+0x40+0x10);for(i=0;i<16;i++){write_date(zifu2[i]);delay(5);}while(1){move();}}