1、#include#define uchar unsigned char#define uint unsigned int#define p0 P0sbit e=P27; /1602 使能引脚sbit rw=P26; /1602 读写引脚sbit rs=P25; /1602 数据/命令选择引脚 void delay() char i,j;for(i=0;i100;i+)for(j=0;j20;j+); void wwr(uchar del) /写指令 p0=del; rs=0;rw=0;e=0;delay();e=1;delay();void wwss (uchar del) /写数据 p0=d
2、el;rs=1;rw=0;e=0;delay();e=1;delay();void init(void)wwr(0x0b);wwr(0x01);wwr(0x38);wwr(0x0f);wwr(0xc0);wwr(0x06);/*void wws(uchar a216)/写数据 地址 uchar *p=a;uchar i,j,z;for(i=0;i2;i+) if(i=0)z=0x80;else z=0xc1;wwr(z);for(j=0;j16;j+) if(aij=0)aij= ;wwss(*p);p+;*/void wws(uchar a,uchar hang) uchar i,z,b;if(!hang)z=0x80;else z=0xc0;wwr(z);for(i=0;i16;i+) if(ai=0)ai= ;if(!hang) if(i=4|i=6)b=-;wwss(b);wwss(ai);void main()uchar aa16=“20110330 T30 C “ ,bb16=“ “ ;aa12=0xdf;init();wws(aa,0);wws(bb,1);while(1);