/*************************************** 说明: LCD初始化函数,需要按照产品 说明书完成 *****************************************/ void LcdInit(void) { Delay400Ms(); /* 写指令0x38连续3次, 不检测忙信号*/ LcdWriteCmd(0x38 , 0 ); Delay5Ms(); LcdWriteCmd(0x38 , 0 ); Delay5Ms(); LcdWriteCmd(0x38 , 0 ); Delay5Ms(); /* 以后的读写操作均要判断忙信号 */ LcdWriteCmd(0x38 , 1 ); /* 先设置关屏 */ LcdWriteCmd(0x08 , 1 ); /* 清屏 */ LcdWriteCmd(0x01 , 1 ); /* 设置光标显示模式 */ LcdWriteCmd(0x06 , 1 ); /* 开屏并显示光标 */ LcdWriteCmd(0x0c , 1 ); }
void LCMInit(void) //LCM初始化 { LCM_Data = 0; WriteCommandLCM(0x38,0); //三次显示模式设置,不检测忙信号 Delay5Ms(); Delay5Ms(); WriteCommandLCM(0x38,0); Delay5Ms(); Delay5Ms(); WriteCommandLCM(0x38,0); Delay5Ms(); Delay5Ms(); WriteCommandLCM(0x38,1); //显示模式设置,开始要求每次检测忙信号 WriteCommandLCM(0x08,1); //关闭显示 WriteCommandLCM(0x01,1); //显示清屏 WriteCommandLCM(0x06,1); // 显示光标移动设置 WriteCommandLCM(0x0F,1); // 显示开及光标设置 }
/*************************************** 说明: 长延时 , 400ms *****************************************/ void Delay400Ms(void) { unsigned char i = 80; while(i--) Delay5Ms(); }