本帖最后由 alittleharry 于 2014-3-16 20:09 编辑
下面是1602液晶初始化代码 ,4位模式数据线模式;第2段到第5段是什么意思?LCD指令码没有0X0002和 0X0003
//LCD_DATA 为数据总线
//LCD_CMD_W_
timing() 为写指令操作时序
void OpenLCD(void)
{
Temp_LCD_DATA = LCD_DATA ; // Save the Port Value of LCD_DATA
LCD_E = 0 ;
LCD_DATA &= 0xfff0; // LCD DB[4:7] & RS & R/W --> Low
DIR_LCD_DATA &= 0xfff0; // LCD DB[4:7} & RS & R/W are output function
DIR_LCD_E = 0; // Set E pin as output
DIR_LCD_RS = 0 ;
DIR_LCD_RW = 0 ;
//第2段
LCD_DATA &= 0xfff0 ;
LCD_DATA |= 0x0003 ;
LCD_CMD_W_Timing() ;
LCD_L_Delay() ;
LCD_DATA &= 0xfff0 ;
LCD_DATA |= 0x0003 ;
LCD_CMD_W_Timing() ;
LCD_L_Delay() ;
LCD_DATA &= 0xfff0 ;
LCD_DATA |= 0x0003 ;
LCD_CMD_W_Timing() ;
LCD_L_Delay() ;
//第5段
LCD_DATA &= 0xfff0 ;
LCD_DATA |= 0x0002 ;
LCD_CMD_W_Timing() ;
LCD_L_Delay() ;
WriteCmdLCD(DISP_2Line_4Bit) ;
LCD_S_Delay() ;
WriteCmdLCD(DISP_ON) ;
LCD_S_Delay() ;
WriteCmdLCD(ENTRY_INC) ;
LCD_S_Delay() ;
WriteCmdLCD(CLR_DISP) ;
LCD_L_Delay() ;
LCD_DATA = Temp_LCD_DATA ;
}
LCD_DATA &= 0xfff0 ;
LCD_DATA |= 0x0003 ;
LCD_CMD_W_Timing() ;
LCD_L_Delay() ;
LCD_DATA &= 0xfff0 ;
LCD_DATA |= 0x0003 ;
LCD_CMD_W_Timing() ;
LCD_L_Delay() ;
LCD_DATA &= 0xfff0 ;
LCD_DATA |= 0x0003 ;
LCD_CMD_W_Timing() ;
LCD_L_Delay() ;
LCD_DATA &= 0xfff0 ;
LCD_DATA |= 0x0002 ;
LCD_CMD_W_Timing() ;
LCD_L_Delay() ;
就是问上面这些是什么意思,LCD指令码中没有0X0003和0x0002
一周热门 更多>