Go Down

Topic: Problem with connecting an LCD 16x2 (Read 4675 times) previous topic - next topic

Yaro

Mar 07, 2012, 11:56 pm Last Edit: Mar 08, 2012, 12:07 am by Yaro Reason: 1
As title, i have a problem to connect an LCD 16x2 ( JHD162A ) to my Arduino Diecimila. I've used this guide for connection http://www.ladyada.net/learn/lcd/charlcd.html. When i power up my lcd seems to work all, i can change contrast with potentiometer, backlight work and logic(second line black squares) work too. But when i upload "HelloWorld" sketch( and update line LiquidCrystal lcd(7, 8, 9, 10, 11, 12); ) LCD don't print nothing, i've tryed different sketchs but still does not work. I've checked connection and seems all to be right. Where can be the problem?

Yaro

Here i've found datasheets:
http://www.geeetech.com/Documents/LCD1602%20White%20Datasheet.pdf

Connections are the same in the guide.

Techone

Look at this line :

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

LiquidCrystal(rs, enable, d4, d5, d6, d7);

Did you connect the pins at the right place ?   example : pin 7 to rs, pin 8 to enable, etc

The link is a standard LCD display. The LCD library should work. It work with me. I have IDE 022. And I have different LCD displays too, but the pins out are standard LCD display. As long the pins correspond to the pins inside the function, and the code is correct, it should work.   

woody_unreal

Dont forget the PoT ,, or you wont see a thing :)

Yaro


Look at this line :

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

LiquidCrystal(rs, enable, d4, d5, d6, d7);

Did you connect the pins at the right place ?   example : pin 7 to rs, pin 8 to enable, etc

The link is a standard LCD display. The LCD library should work. It work with me. I have IDE 022. And I have different LCD displays too, but the pins out are standard LCD display. As long the pins correspond to the pins inside the function, and the code is correct, it should work.   


I've connected pins from 7 to 12 to lcd like in the guide, so yes. I need to add line LiquidCrystal(rs, enable, d4, d5, d6, d7); too?


Dont forget the PoT ,, or you wont see a thing :)

As i said, i have connected pot and power, and seems all working, i can change contrast with pot.

When i start arduino, lcd seems inizialize(for 1 sec the second row have black squares, after they disappear and lcd don't print nothing).

floresta

Quote
i've tryed different sketchs but still does not work.

Perhaps if you posted the sketch that didn't work we could help. 

Do not post a link to the sketch that you think you used, we need a copy/paste version of the sketch that you actually used.


Don

Yaro

Here:
Code: [Select]
/*
  LiquidCrystal Library - Hello World

Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.

This sketch prints "Hello World!" to the LCD
and shows the time.

  The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)

Library originally added 18 Apr 2008
by David A. Mellis
library modified 5 Jul 2009
by Limor Fried (http://www.ladyada.net)
example added 9 Jul 2009
by Tom Igoe
modified 22 Nov 2010
by Tom Igoe

This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/LiquidCrystal
*/

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}

floresta

Lets get rid of all of the irrelevant stuff and the changing data and see what happens.

Try the following sketch.  It doesn't matter which Arduino pins you use, just make sure that the pins in the LiquidCrystal lcd() comment match up with the numbers in the actual LiquidCrystal lcd() statement.


Code: [Select]
#include <LiquidCrystal.h>

//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup()
 {
 lcd.begin(16, 2);
 lcd.print("hello, world!");
 lcd.setCursor(0,1)
 lcd.print("it works!");
 }

void loop()
 {
 }


Be aware that if you initially have blocks on the second row of your display then you will have to stand on your head to read the text.

Don

Yaro

Doesn't work, tomorrow i will post photo of connections, lcd backgroud and a video of what i see.

May  be the voltage too high? i've connected all vcc to arduino +5V(and a 10k pot to contrast). On datasheet i've found that:
Code: [Select]
6.ELECTRICAL SPECIFICATIONS(Ta=250C,Vdd=5.0V)
Item Symbol Condition Standard Value
Min Type Max
Unit
Supply Voltage for logic Vdd-GND - 4.5 5.0 5.5 V
Supply Current for logic Idd - 1.0 - mA
Driving Current for LCD Iee - 0.6 - mA
Driving Voltage for LCD Vdd-V5 4.2 4.5 4.8 V
Input Voltage H level Vih 2.2 - Vdd V
Input Voltage L level Vil
Vdd=5V
-0.3 - 0.6 V
Output Voltage H Voh Ioh=-0.205mA 2.4 - - V
Output Voltage L Vol Io1=1.2mA - - 0.4 V

Yaro

Here some photo:

http://i41.tinypic.com/r8sd9h.jpg

http://i43.tinypic.com/9gvimd.jpg

http://i43.tinypic.com/mikia1.jpg

http://i43.tinypic.com/3581479.jpg

http://i42.tinypic.com/4tsdn9.jpg

http://i39.tinypic.com/2vdqwj9.jpg

http://i40.tinypic.com/33u2uqu.jpg

http://i40.tinypic.com/13zzig6.jpg

And here two video:

First it's what i see when i power arduino and lcd:

http://www.videoweed.es/file/ald2kx5v8kxzm

Second it's what i see when is powered and i adjust contrast with pot:

http://www.videoweed.es/file/26p3ums5on0yx

Sketch is "HelloWorld" with pins changed.
I've cheked again all pins with an ohmeter from lcd directly to arduino pins, connections work and i don't have any short-circuit.

justone

After you load the sketch hit the reset button and see what happens. On my Uno (r2) if I have any of the lcd pins hooked up to either pin 3 or 7 then it will not run. It will work if I move to any of the other pins. The new Uno(r3) has fixed this by building a better reset circuit.

floresta

#11
Mar 09, 2012, 06:41 pm Last Edit: Mar 09, 2012, 06:43 pm by floresta Reason: 1
Your photographs are not very helpful because there is no single picture where I can trace the wires between your Arduino and your LCD module.  

I do not trust those video download links so I have not seen the videos.

From what I can see in the '9gvimd' picture you have not interpreted the pins correctly.  Pin 1 is near the outside edge of the PC board and pin 16 is near the center.


Don

tin solder is notorious bad with these row headers.

Do you have any other display?

Have you tried to use it in 8bit mode + measured all signals directly on the LCD (if anything arrives at all)?
I also have PIC related web domain.

floresta

Quote
Have you tried to use it in 8bit mode + measured all signals directly on the LCD (if anything arrives at all)?

It doesn't matter what mode he uses it in and what signals are sent to the data pins if he doesn't provide power to the IC controller via pins 1 and 2.

Don

Yaro

#14
Mar 09, 2012, 08:36 pm Last Edit: Mar 09, 2012, 08:40 pm by Yaro Reason: 1

Your photographs are not very helpful because there is no single picture where I can trace the wires between your Arduino and your LCD module.  

I do not trust those video download links so I have not seen the videos.

From what I can see in the '9gvimd' picture you have not interpreted the pins correctly.  Pin 1 is near the outside edge of the PC board and pin 16 is near the center.


Don

Sorry, i thought they were more understandable, i will try to do better photos.

As you see in the photo '2vdqwj9' i've powered pin 1-2 with two wire above the board, external are gnd and internal are +5 volt, the third pin from right is for contrast(pin3), next are rs(pin4), mass(pin5), enable(pin6), 4 unused pin(pin7-10), and db4(pin11), db5(pin12), db6(pin13), db7(pin14), they go to arduino in, rs (arduino pin 7 ), e (arduino pin 8 ), from arduino pin 9-12 are db4-db7. If i had not power them i shouldn't see "black" squares when i power arduino.

Videos are uploaded on videoweed, it's a streaming video site, just click on bottom left 'symbol play' in the video window, not in center like youtube. If you want i can upload it on another site that you tell me.


tin solder is notorious bad with these row headers.

Do you have any other display?

Have you tried to use it in 8bit mode + measured all signals directly on the LCD (if anything arrives at all)?

I don't have any other displays, and as i said i check all wires form lcd to arduino with an ohmeter, so signal should arrive.


After you load the sketch hit the reset button and see what happens. On my Uno (r2) if I have any of the lcd pins hooked up to either pin 3 or 7 then it will not run. It will work if I move to any of the other pins. The new Uno(r3) has fixed this by building a better reset circuit.

Nothing, i can try to move pin 7 to pin 6, i'll say you what happen. But i don't think this is the problem, because in the guide he use an arduino duemilanove, and i've an arduino diecimila.

I'm going angry with this lcd.

Go Up