Ejemplo n.º 1
0
 /***********************************************************************************
 * @fn          halLcdInit
 *
 * @brief       Initalise LCD
 *
 * @param       none
 *
 * @return      none
 */
void halLcdInit(void)
{
    // Initialize I/O
    LCD_CTRL_INIT_PORTS();

    // Perform the initialization sequence
    FUNCTION_SET(CGRAM | COM_FORWARD | THREE_LINE);
    halLcdSetContrast(15);
    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);
    halMcuWaitMs(21); // 21 ms

    // Clear the display
    halLcdClear();
    halLcdClearAllSpecChars();
    SET_DISPLAY_CTRL(DISPLAY_CTRL_ON | DISPLAY_CTRL_BLINK_OFF | DISPLAY_CTRL_CURSOR_OFF);
}
Ejemplo n.º 2
0
void HalLcd_HW_Init(void)
{
  /* Initialize SPI */
  UCB0CTL1 |= UCSWRST;
  UCB0CTL0 |= UCMST | UCSYNC | UCCKPH | UCMSB;   /* MSB, Master mode, Sync mode, Data capture on the first UCLK edge */
  UCB0CTL1 |= UCSSEL1;                           /* SMCLK */
  UCB0BR0  = 4;
  UCB0BR1  = 0;
  LCD_SPI_INIT_PORTS();
  LCD_SPI_END();
  UCB0CTL1 &= ~UCSWRST;

  /* Init I/O */
  LCD_CTRL_INIT_PORTS();

  /* Perform reset */
  LCD_ACTIVATE_RESET();
  HalLcd_HW_Wait(15); // 15 ms
  LCD_RELEASE_RESET();
  HalLcd_HW_Wait(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_Wait(20);// 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);
}