[En-Nut-Discussion] LCD_DELAY in avr/dev/hd44780.c
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Mon Sep 4 18:36:58 CEST 2006
Hallo,
the datasheet for the Hitachi HD447800 controller demands for a minimum of
500 ns Enable Cycle time and a minimum Enable pulse width (high level) of
230 ns.
As I understand the code, our code doesn't guarantee that timing. I think
the patch appended would guarantee the timing up to 16 MHz clock.
Bye
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
--- nut/arch/avr/dev/hd44780.c.~1.1.~ 2005-07-26 20:02:27.000000000 +0200
+++ nut/arch/avr/dev/hd44780.c 2006-09-04 18:25:26.000000000 +0200
@@ -122,7 +122,7 @@
*/
static u_char during_init = 1;
-#define LCD_DELAY _NOP(); _NOP()
+#define LCD_DELAY _NOP(); _NOP(); _NOP(); _NOP() /*Three Nops would fit too */
#ifdef LCD_RW_BIT
@@ -134,6 +134,7 @@
sbi(LCD_ENABLE_PORT, LCD_ENABLE_BIT);
LCD_DELAY;
cbi(LCD_ENABLE_PORT, LCD_ENABLE_BIT);
+ LCD_DELAY;
return inp(LCD_DATA_PIN) & LCD_DATA_BITS;
}
@@ -142,12 +143,9 @@
u_char data;
#if LCD_DATA_BITS == 0x0F
data = LcdReadNibble();
- LCD_DELAY;
data = data | (LcdReadNibble() << 4);
- LCD_DELAY;
#elif LCD_DATA_BITS == 0xF0
data = LcdReadNibble() >> 4;
- LCD_DELAY;
data |= LcdReadNibble();
#elif LCD_DATA_BITS == 0xFF
data = LcdReadNibble();
@@ -208,6 +206,7 @@
sbi(LCD_ENABLE_PORT, LCD_ENABLE_BIT);
LCD_DELAY;
cbi(LCD_ENABLE_PORT, LCD_ENABLE_BIT);
+ LCD_DELAY;
}
/*!
More information about the En-Nut-Discussion
mailing list