Example #1
0
/**************************************************************************************************
 * @fn      HalLcd_HW_Init
 *
 * @brief   Initilize HW LCD Driver.
 *
 * @param   None
 *
 * @return  None
 **************************************************************************************************/
void HalLcd_HW_Init(void)
{
  /* Initialize LCD IO lines */
  halLcd_ConfigIO();

  /* Initialize SPI */
  halLcd_ConfigSPI();

  /* Perform reset */
  LCD_ACTIVATE_RESET();
  HalLcd_HW_WaitUs(15000); // 15 ms
  LCD_RELEASE_RESET();
  HalLcd_HW_WaitUs(15); // 15 us

  /* Perform the initialization sequence */
  FUNCTION_SET(CGRAM | COM_FORWARD | THREE_LINE);

  /* Set contrast */
  HalLcd_HW_SetContrast(15);

  /* Set power */
  SET_POWER_SAVE_MODE(OSC_OFF | POWER_SAVE_ON);
  SET_POWER_CTRL(VOLTAGE_DIVIDER_ON | CONVERTER_AND_REG_ON);
  SET_BIAS_CTRL(BIAS_1_5);
  HalLcd_HW_WaitUs(21000);// 21 ms

  /* Clear the display */
  HalLcd_HW_Clear();
  HalLcd_HW_ClearAllSpecChars();
  SET_DISPLAY_CTRL(DISPLAY_CTRL_ON | DISPLAY_CTRL_BLINK_OFF | DISPLAY_CTRL_CURSOR_OFF);
}
Example #2
0
/**************************************************************************************************
 * @fn      HalLcd_HW_Init
 *
 * @brief   Initilize HW LCD Driver.
 *
 * @param   None
 *
 * @return  None
 **************************************************************************************************/
void HalLcd_HW_Init(void)
{
    /* Initialize LCD IO lines */
    halLcd_ConfigIO();

    /* Initialize SPI */
    halLcd_ConfigSPI();

    HalLcd_HW_Control(0xaf);    //开显示
    HalLcd_HW_Control(0x40);    //显示起始行为0
    HalLcd_HW_Control(0xa0);    //RAM列地址与列驱动同顺序
    HalLcd_HW_Control(0xa6);    //正向显示
    HalLcd_HW_Control(0xa4);    //显示全亮功能关闭
    HalLcd_HW_Control(0xa2);    //LCD偏压比1/9
    HalLcd_HW_Control(0xc8);    //行驱动方向为反向
    HalLcd_HW_Control(0x2f);    //启用内部LCD驱动电源
    HalLcd_HW_Control(0xf8);    //升压电路设置指令代码
    HalLcd_HW_Control(0x00);    //倍压设置为4X
    
    
    HalLcd_HW_SetContrast(0x68);//set contrast 对比度
 
    
    /* Clear the display */
    HalLcd_HW_Clear();

}
Example #3
0
/**************************************************************************************************
初始化,已根据lcd12864手册更改
 **************************************************************************************************/
void HalLcd_HW_Init(void)
{
  /* Initialize LCD IO lines */
  halLcd_ConfigIO();

  /* Initialize SPI */
  halLcd_ConfigSPI();

	HalLcd_HW_Control(0xe2);	//软复位
	HalLcd_HW_WaitUs(15000); // 15 us
	HalLcd_HW_Control(0x2c);	//升压步聚1
	HalLcd_HW_WaitUs(15); // 15 us
	HalLcd_HW_Control(0x2e);	//升压步聚2
	HalLcd_HW_WaitUs(15); // 15 us
	HalLcd_HW_Control(0x2f);	//升压步聚3
	HalLcd_HW_WaitUs(150); // 15 us
	HalLcd_HW_Control(0x23);	//粗调对比度,可设置范围0x20~0x27
	HalLcd_HW_WaitUs(15); // 15 us
	HalLcd_HW_Control(0x81);	//微调对比度
	HalLcd_HW_WaitUs(15); // 15 us
	HalLcd_HW_Control(0x28);	//0x1a,微调对比度的值,可设置范围0x00~0x3f
	HalLcd_HW_WaitUs(15); // 15 us
	
	HalLcd_HW_Control(0xa2);	// 1/9偏压比(bias)
	HalLcd_HW_WaitUs(15); // 15 us
	HalLcd_HW_Control(0xa0);	//行扫描顺序:从上到下
	HalLcd_HW_WaitUs(15); // 15 us
	HalLcd_HW_Control(0xc8);	//列扫描顺序:从左到右
	HalLcd_HW_WaitUs(15); // 15 us
	HalLcd_HW_Control(0x40);	//起始行:第一行开始
	HalLcd_HW_WaitUs(15); // 15 us
	HalLcd_HW_Control(0xaf);	//打开显示
	HalLcd_HW_WaitUs(15); // 15 us
    HalLcd_HW_Control(0xa4);	
	HalLcd_HW_WaitUs(15); // 15 us
        
	HalLcd_HW_Clear();
        //display_string_5x7(1,1,"abcdefghijklmnopqrstuvwxyz");
        //display_string_5x7(8,1,"uvwxyz0123456789");
        //while(1);


}
Example #4
0
/*********************************************************************
 * 函数名称:HalLcd_HW_Init
 * 功    能:LCD硬件初始化
 * 入口参数:无
 * 出口参数:无
 * 返 回 值:无
 ********************************************************************/
void HalLcd_HW_Init(void)
{
  halLcd_ConfigIO(); // 初始化LCD IO口
  halLcd_ConfigSPI();// 初始化 SPI 口

  /* 复位LCD */
  LCD_ACTIVATE_RESET();
  HalLcd_HW_WaitUs(8000);
  LCD_RELEASE_RESET();
  HalLcd_HW_WaitUs(30000); 
  HalLcd_HW_WaitUs(30000); 

  HalLcd_HW_SetBackLight(0); // 设置背光强度
  HalLcd_HW_Clear();         // 清屏
  HalLcd_HW_SetBackLight(100);
	
  HalLcd_HW_FontCharSet(0,1);// 字体设置
  HalLcd_HW_FontMode(1,0);
}