Problem with some letters on LCD with LiquidCrystal

Hello.
I've just started playing with 16-pin 20x2 LCD screen and encountered many problems from the very beginning.
There is a problem with displaying some letters. I've just uploaded SerialDisplay demo from the LiquidCrystal library and here is what happens: if i send "a" (or "A") -> everything's okay, it is displayed on the LCD. Same with b, c, d, e, f, g. The problems start with "h" (and "H"). When I send this letter via serial monitor, on the screen appears 40 white rectangles. The same problem is with i, j, k, l, m, n, o. Then it's all fine with p, q, r, s, t, u, w, v. When I send x, y, z there appears 40 rectangles again and I can't see anything on the screen. If I send "ah", I have 40 rectangles again. If I send "ha" then it works fine, so there's no problem with displaying the "h" and other symbols themselves because they are displayed well if I send "ha", "ja", "xa" etc.
I've tried many demos and codes online but I always have the same result. I have rewired it all hundred times with no effect. I tried it on different pins too. Here is the connection I use now (most comfortable for me):
LCD pin To
1 GND
2 VCC
3 GND
4 Ard-7
5 GND
6 Ard-8
11 Ard-9
12 Ard-10
13 Ard-11
14 Ard-12
15 VCC
16 GND
I use this code to initialize the library:LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
I use this touch screen: http://sklep.avt.pl/p/pl/71498/lcd+alfanumeryczny+20x2.html (in Polish) and here is the datasheet: http://sklep.avt.pl/photo/_pdf/BTHQ_22005VSS.pdf (in English).

I have no idea how to solve this problem and I've just run out of ideas. Do you have any suggestions?

Btw. I've also discovered some interesting fact with using LiquidCrystal: when I use this line lcd.begin(20, 2);the symbols on the LCD have black colour. If I don't use this line, they have white colour. Without the lcd.begin() line I I still can't display some letters. Why does the lcd.begin changes the text colour from white to black? White is much more visible on blue backlight. Is there a way to avoid it?

Daniel

... the symbols on the LCD have black colour. If I don't use this line, they have white colour. Without the lcd.begin() line I I still can't display some letters. Why does the lcd.begin changes the text colour from white to black? White is much more visible on blue backlight. Is there a way to avoid it?

I'll answer this part first since I know the answer and then work on the other part.

There are a few factors that are interacting here. If you do not use the lcd.begin() statement then the display is initialized as a 1-line display and when you use lcd.begin(20,2) it is initialized as a 2-line display. As a side effect this changes the duty cycle of the multiplexed display and hence the contrast. Normally you could adjust the contrast potentiometer to get the same contrast (and apparent text color) for either case but you are not using a contrast potentiometer since pin 3 is connected to GND.

The solution is to connect the end terminals of a 5K, 10K, or 20K potentiometer to +5V and GND and connect pin 3 of the LCD to the center terminal of the potentiometer. Now you should be able to adjust the potentiometer to get the desired white symbols.

Did you notice that you could not display any text on the second row of your display when you did not use the lcd.begin() statement?

Don

Thanks for your help and explanation. Now I understand why it happens. I'll add a pot as soon as I buy one. I suspected that the potentiometer could do the trick here but I couldn't test it since I don't have any right now.

Any clues with the main problem? I checked my connection many times and everytime I find out that it's correct...

As far as your other problem goes - you appear to be having trouble with your LCD DB7 line (pin 14), it is always low. This may be a problem with your soldering or with your breadboard.

Don

floresta:
As far as your other problem goes - you appear to be having trouble with your LCD DB7 line (pin 14), it is always low. This may be a problem with your soldering or with your breadboard.

Don

I've changed that wire on DB7 to new wire and it's the same. I don't use breadbord for the screen, screen is connected directly to Arduino. I also tried to connect DB7 to different pin on Arduino (and change the pin number in code of course) but with no result. I also don't think that the problem is that DB7 is always low. When I connected DB7 to GND I also couldn't get these "h" and other letters, but I wasn't having 40 white rectangles on the screen. When I connected DB7 to GND instead of this symbols which don't work the screen displayed other symbols like "p", "q" etc. When DB7 is connected to Arduino (pin 12 in my case) then instead of any symbols the screen displayed 40 white rectangles. So the LCD doesn't behave like DB7 pin is always low I think...

Problem solved. I've just had an idea of putting 10k resistor on DB7 line and it worked. Thank you so much Don for pointing me that the problem is in DB7 line. Without you I would have never guessed it.

Daniel