Better HD44780 lcd display initialization.
authorbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 3 Jun 2010 15:58:51 +0000 (15:58 +0000)
committerbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 3 Jun 2010 15:58:51 +0000 (15:58 +0000)
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
bertos/drv/lcd_hd44.h

index 78df78d5d8746aa614a7b7e8b32d3d2ca647b856..5bce8c6df245001e7e8f43a378113954bfdcb541 100644 (file)
@@ -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 */
index 0616d31c67b11329a98ccd1e83883f8e50313b2e..b2ff8f0c03b503456b1dbf62ef55f44c16a1cf0f 100644 (file)
@@ -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 */