//------------------------------------------------------------------------------
//液晶初始化
//------------------------------------------------------------------------------
void LCD_Initialize()
{
__delay_ms(50);
/*
Write_LCD_Command(0x30); __delay_ms(1);
Write_LCD_Command(0x30); __delay_ms(1);
Write_LCD_Command(0x30); __delay_ms(1);
*/
Write_LCD_Command(LCD_SETFUNCTION + 0x08); //4位模式,双行,5*7点阵
Write_LCD_Command(LCD_SETVISIBLE + 0x04); //不显示光标,不闪烁
Write_LCD_Command(LCD_SETMODE + 0x02); //自动递增
Write_LCD_Command(LCD_SETDDADDR); //DDRA偏移地址0x80
}
这个代码在mplab ide 里能正常初始化后显示出字符,在mplab x ide里初始化不成功,显示空白。
//------------------------------------------------------------------------------
//液晶初始化
//------------------------------------------------------------------------------
void LCD_Init(void)
{
__delay_ms(15);
Write_LCD_NO_Com(0x02); //这是没做忙检测的,不过做不做忙检测好像都一样
Write_LCD_Command(LCD_SETFUNCTION + 0x08); //4位模式,双行,5*7点阵
Write_LCD_Command(LCD_SETVISIBLE + 0x04); //不显示光标,不闪烁
Write_LCD_Command(LCD_SETMODE + 0x02); //自动递增
Write_LCD_Command(LCD_SETDDADDR); //DDRA偏移地址0x80
}
修改成这样后能在mplab x ide里正常初始化,显示字符。 |