Normally the hd44780 needs to be told if it is running 4 or 8bit mode.
Is this Initialization included when calling "LiquidCrystal()" ? Meaning if you have defined 4 wire it init for 4 bit and if you define 8 wires it init for 8bit?
If I look in the program "hello world" there are not Initialization for the 4bit LCD used.
I have a funny problem on an old 44780 + extension chip 44xx, 2x16 , the first 8 segments of line 1 and 2 works , but the last 8 sigments of line 1 and 2 are dark . I don't know if this is because of a wrong init or a burn LCD chip.
When I use a compatible LCD in 4-bit mode, and pass in 4 address lines to the constructor, it works in 4 bit mode.
If you need to know more, how about reading the source? It's open source! On my machine, the source code ends up in arduino-0022\libraries\LiquidCrystal\LiquidCrystal.cpp
Inside LiquidCrystal::begin() you will find this:
//put the LCD into 4 bit or 8 bit mode
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 {
// this is according to the hitachi HD44780 datasheet
// page 45 figure 23
// Send function set command sequence
command(LCD_FUNCTIONSET | _displayfunction);
delayMicroseconds(4500); // wait more than 4.1ms
// second try
command(LCD_FUNCTIONSET | _displayfunction);
delayMicroseconds(150);
// third go
command(LCD_FUNCTIONSET | _displayfunction);
}
So, yes, the library initializes the display into the right mode.
I did read the LCD lib.ref. but got lazy, thats why I wrote my post here . So OK it start out in 8bit and if that don't work switch to 4 . ( And if the display show dark dots , it is the display that is defective) .
I found a 4x20 and connected instead of the funny 2x16 , the 4x20 work perfectly in 4bit/wire mode.