已搞定,查忙要设定初始化第一次不查忙.查忙程序需要加return;。
void ini() //LCD初始化{
write_order(0x38,0);
write_order(0x38,0);
write_order(0x38,0);
rw=0;
en=0;
P2=0xff;
writeCG();
write_order(0x38,1);
write_order(0x0c,1);
write_order(0x06,1);
write_order(0x01,1);
}
void lcd_wait(void)
{
return;
DATAPORT=0xff; //读LCD前若单片机输出低电平,而读出LCD为高电平,则冲突,Proteus仿真会有显示逻辑黄色
en=1;
rs=0;
rw=1;
_nop_();
_nop_();
_nop_();
while(DATAPORT&BUSY)
{ en=0;
_nop_();
_nop_();
en=1;
_nop_();
_nop_();
}
en=0;
} |