52单片机和1602的液晶显示程序 uchar dis1[16]="www.hdu.edu.cn "; uchar dis2[16]="zhejianghangzhou"; uchar dis3[16]="welcome to hdu "; uchar dis4[16]="hello world "; uchar dis5[16]="0123456789876543"; void delay(uchar ms) { // 延时子程序 uchar i; while(ms--) { for(i = 0; i< 250; i++); } } bit lcd_bz() { // 测试LCD忙碌状态 bit result; rs = 0; rw = 1; ep = 1; result = (bit)(P2 & 0x80); ep = 0; return result; } void lcd_wcmd(uchar cmd) { // 写入指令数据到LCD while(lcd_bz()); rs = 0; rw = 0; ep = 0; P2 = cmd; ep = 1; ep = 0; }