Beispiel #1
0
void lcd_init (void)
{
	lcd_init_io ();
	lcd_init_controller ();
	lcd_init_ltcd ();
	lcd_layer_fullscreen ();

	lcd_vsync = true;

	lcd_set_layer (LCD_FOREGROUND);
}
Beispiel #2
0
/*
 * General Initialization	Example Initialization
 * 1	Wait 20ms for LCD to power up
 * 2	Write D7-4 = 3 hex, with RS = 0
 * 3	Wait 5ms
 * 4	Write D7-4 = 3 hex, with RS = 0, again
 * 5	Wait 200us
 * 6	Write D7-4 = 3 hex, with RS = 0, one more time
 * 7	Wait 200us
 * 8	Write D7-4 = 2 hex, to enable four-bit mode
 * 9	Wait 5ms
 * 10	Write Command "Set Interface"	Write 28 hex (4-Bits, 2-lines)
 * 11	Write Command "Enable Display/Cursor"	Write 08 hex (don't shift display, hide cursor)
 * 12	Write Command "Clear and Home"	Write 01 hex (clear and home display)
 * 13	Write Command "Set Cursor Move Direction"	Write 06 hex (move cursor right)
 * 14	--	Write 0C hex (turn on display)
 * Display is ready to accept data.
 */
void lcd_init() {
    uint8_t count;
    lcd_init_io();
    delay_ms(20);
    lcd_rs_pin = LCD_RS_COMMAND;
    lcd_rw_pin = LCD_RW_WRITE;
    lcd_en_pin = LCD_EN_LOW;
    for(count = 0; count < 3; count++) {
        lcd_send_nibble(0x03);
        delay_ms(5);
    }
    lcd_send_nibble(0x02);
    delay_ms(5);
    lcd_command(LCD_CMD_FUNCTION_SET | LCD_CMD_FUNCTION_SET_2LINE_MODE);
    lcd_command(LCD_CMD_DISPLAY_CONTROL | LCD_CMD_DISPLAY_CONTROL_ON| LCD_CMD_DISPLAY_CONTROL_BLINK | LCD_CMD_DISPLAY_CONTROL_UNDERLINE);
    lcd_command(LCD_CMD_CLEAR_DISPLAY);
    lcd_command(LCD_CMD_ENTRY_MODE | LCD_CMD_ENTRY_MODE_INCREMENT);
}