各位看看这个1602的程序哪里有问题,为什么能显示字符串但不能显示字符呢,多谢
时间:10-02
整理:3721RD
点击:
下面主函数里,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);
}
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);
}
把OK换成小写试试