#include #include #define uint unsigned int #define uchar unsigned char sbit rs=P1^0; sbit rw=P1^1; sbit en=P1^2; void delay(uint sum) { int i,j; for(i=sum;i>0;i--) for(j=110;j>0;j--); } void write_date(uchar date) { rs=1; rw=0; P0=date; delay(5); en=1; delay(5); en=0; } void write_com(uint com) { rs=0; rw=0; P0=com; delay(5); en=1; delay(5); en=0; } void init() { en=0; write_com(0x38); write_com(0x0e); write_com(0x06); write_com(0x01); write_com(0x80+0x10); } void main() { init(); write_date('a'); delay(20); write_date('b'); while(1); }
下面是运行结果,总是这样显示,不知道问题出在哪?求大神指导···········