From 13535b4d8636ee22a2dd737e0fa4433d5f785a8b Mon Sep 17 00:00:00 2001 From: batt Date: Thu, 3 Jun 2010 15:58:51 +0000 Subject: [PATCH] Better HD44780 lcd display initialization. If the display is already in 4bit mode, reset to 8 bit mode first, otherwise commands are misunderstood. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3893 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/drv/lcd_hd44.c | 1 + bertos/drv/lcd_hd44.h | 1 + 2 files changed, 2 insertions(+) diff --git a/bertos/drv/lcd_hd44.c b/bertos/drv/lcd_hd44.c index 78df78d5..5bce8c6d 100644 --- a/bertos/drv/lcd_hd44.c +++ b/bertos/drv/lcd_hd44.c @@ -405,6 +405,7 @@ void lcd_hw_init(void) timer_delay(50); #if CONFIG_LCD_4BIT + lcd_regWrite(LCD_CMD_SET8BIT); lcd_mode4Bit(); timer_delay(2); #endif /* CONFIG_LCD_4BIT */ diff --git a/bertos/drv/lcd_hd44.h b/bertos/drv/lcd_hd44.h index 0616d31c..b2ff8f0c 100644 --- a/bertos/drv/lcd_hd44.h +++ b/bertos/drv/lcd_hd44.h @@ -79,6 +79,7 @@ #define LCD_CMD_SETFUNC 0x38 /**< 8 bits, 2 lines, 5x7 dots */ #endif +#define LCD_CMD_SET8BIT 0x30 #define LCD_CMD_DISPLAY_ON 0x0F /**< Switch on display */ #define LCD_CMD_DISPLAY_OFF 0x08 /**< Switch off display */ #define LCD_CMD_CLEAR 0x01 /**< Clear display */ -- 2.25.1