LCD : HD44780  (LM041L) : I'm stuck.

hey,
After many hours on google and a lot of atempt, I’m stuck.
I try a LCD screen (LM041L with HD 44780) but the result is random: in place of “hello, world!”, I have “hVl? vr?!”
The result on the screen is wrong. (see picture in next message)

my config :
RS = pin12 / RW = pin11 / enable = pin 10
DB4= pin 5 / DB5= pin 4 / DB6= pin 3 / DB7= pin 2

my code :

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

void setup()
{
lcd.command(0x028);
lcd.clear();
delay(5000);
lcd.print(“hello, world!”);
delay(2000);
lcd.home();
}

void loop()
{
}

Are you sure the D4, D5, D6,. D7 pins are connected in the right order? If you look up the caracters that you see on the LCD in the ASCII code table for that LCD, and look at the binary version, do you see a pattern?

Hi,
Yes, the DB pins are connected in the right order.
I don’ t understand why some characters are fine and other are not ?
Maybe some pb of timer in library ?

Thank you

I have had a similar issue when i had connected my 4 lines LCD for the first time.. yet the first line was always shown fine.. My first suggestion is that you look for the 4_bit library or 4_bit_mod library and try those. Then a question - whats that command sent at the beginning? Are you sure its the right initialisation?

Hi, Just now, *I have a correct result, In fact, I modified the library and I added a delayMicroseconds(50); just after each digitalWrite. Now I have a other pb :

For the moment I initiale the LCD with lcd.command(0x28); but the function set is documented for 1 or 2 lines.

How configure the LCD for 4 lines.

Thank you

Glad to hear that adding delays fixed the problem! I think you can initialise the LCD as if it was a 2-line type, and it'll work. I have a 4-line LCD that works fine. I also have a 1-line LCD that behaves a little strange because the LCD library always initialises it as a 2-line.

http://www.flickr.com/photos/anachrocomputer/3370942751/

Thank's for your answer.

So, if i want to address the 2nd line I need to put my cursor in 0,1 : lcd.setCursor(0, 1) and after lcd.print("hello, world 2 !");.

Could you confirm that ?

Once more, thank you for your help.

A french guy.

Yes, lines (rows) are numbered from zero, so you should be able to address the third row as:

lcd.setCursor(0,2);

Hi,

I try it and all is fine, the next step is a progressbar. If Someone has an idea ? Thank you


digitalWrite(13,HIGH); lcd.command(0x28); lcd.command(0x0D); lcd.clear(); lcd.home(); digitalWrite(13,LOW); lcd.print("ligne 1"); lcd.setCursor(0, 1); lcd.print("ligne 2"); lcd.setCursor(0, 2); lcd.print("ligne 3"); lcd.setCursor(3, 3); lcd.print("ligne 4/pos 3");