下面主函数里,O,K两个字符无法显示,但“dofly”字符串可以显示,很奇怪,检查了很久不知什么问题,程序没错啊
void LCD_1602_Write_Data(uc8 Data)
{
LCD_1602_Busy_Check();
RS=1;
RW=0;
EN=1;
P0=Data;
delay_ms(5);//延时,让LCD接收数据
EN=0;
}
void LCD_1602_Write_Char(uc8 x,uc8 y,uc8 c)
{
LCD_1602_Busy_Check();
if(y==0)
{
LCD_1602_Write_Cmd(0x80+x);//设置DDRAM,即显示位置,第一行x列显示
}
else
{
LCD_1602_Write_Cmd(0xc0+x);//设置DDRAM,即显示位置,第二行x列显示
}
LCD_1602_Write_Data(c);
delay_ms(5);
}
void LCD_1602_Write_String(uc8 x,uc8 y,uc8 *s)
{
LCD_1602_Busy_Check();
if(y==0)
{
LCD_1602_Write_Cmd(0x80+x);
}
else
{
LCD_1602_Write_Cmd(0xc0+x);
}
while(*s)
{
LCD_1602_Write_Data(*s);
s++;
delay_ms(5);
}
}
void main()
{
LCD_1602_Init();//LCD初始化
LCD_1602_Clear();
while(1)
{
LCD_1602_Write_Char(1,0,'O');
LCD_1602_Write_Char(2,0,'K');
LCD_1602_Write_String(0,1,"dofly");
}
while(1);
}
一周热门 更多>