Page 46 of the attached datasheet shows the initialization
method for 4 bit operation. The current (arduino-1.0)
code in LiquidCrystal.cpp looks like this:
if (! (_displayfunction & LCD_8BITMODE)) {
// this is according to the hitachi HD44780 datasheet
// figure 24, pg 46
// we start in 8bit mode, try to set 4 bit mode
write4bits(0x03);
delayMicroseconds(4500); // wait min 4.1ms
// second try
write4bits(0x03);
delayMicroseconds(4500); // wait min 4.1ms
// third go!
write4bits(0x03);
delayMicroseconds(150);
// finally, set to 4-bit interface
write4bits(0x02);
} else {
It looks to me like there is an extra, unnecessary wait. I think the code should look
like this:
if (! (_displayfunction & LCD_8BITMODE)) {
// this is according to the hitachi HD44780 datasheet
// figure 24, pg 46
write4bits(0x03);
delayMicroseconds(4500); // wait min 4.1ms
write4bits(0x03);
delayMicroseconds(150); // wait min 4.1ms
write4bits(0x03);
// finally, set to 4-bit interface
write4bits(0x02);
} else {
Anyone know why this difference exists? The latter code works for me.