Pages: [1]   Go Down
Author Topic: Arduino is writing to LCD, I can find no errors, but no LCD-text. What is wrong?  (Read 1418 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is my setup.

Arduino Leonardo. Arduino IDE 1.0.3. A MIDAS LCD (8x2). Here is a link to the datasheet: http://www.farnell.com/datasheets/1485442.pdf

I have connected the board like this:

.

I have connected everything exactly like above, there are no short circuits, and I measure the correct voltages on all the pins.

This is my code:

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

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

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

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);
}

The sketch is uplaoded to the Arduino without errors.

I measure correct voltages at 3V3 and 5V pins. The Arduino is writing to the LCD on the 4 data-lines (counting up seconds), I have verified this on the oscilloscope in my laboratory, but no text on the display.

What is wrong?

Thank you for your time.

Kind regards,
Marius
« Last Edit: January 30, 2013, 05:43:46 pm by kingoslo » Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 47
Posts: 2169
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It looks like it is wired according to the book. Does it light up? Have you twiddled the pot in order to get the contrast?
Logged

Offline Offline
Newbie
*
Karma: 3
Posts: 34
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks like the LCD display is backlit - connect pin 15 to +5v and pin 16 to GND

(EDIT)  also check the value of the pot - needs to be at least 10k.
I have found I could replace the pot w/ pin 3 connected to ground w/ a 9k resister
« Last Edit: January 30, 2013, 08:26:31 pm by JD3 » Logged

That little black caterpillar you just stepped on will set you back a few bucks....

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4245
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have connected the board like this:
No you haven't.  The board in the drawing has a single row of 16 pins, the board in your datasheet has two rows of eight pins.

You have posted a drawing of how the first type of display should be connected.  Now we need a photograph of how you actually connected yours.  In that photo we have to be able to unambiguously follow each of the wires from one end to the other.

The proper sequence of steps is:
1.  Get the backlight working first (pins 15 and 16).
2.  Connect the power and the contrast next (pins 1, 2, and 3).  Any potentiometer between 5K and 50K will work.  With the potentiometer at one end of it's range the display will be blank and at the other end you should see boxes on the top line of the display.  Adjust the potentiometer until the row of boxes is visible, but dim.  The voltage at pin 3 should be around 0.5v at this point.  If you do not get this behavior then it makes no sense to continue since no amount of programming will fix things.
3.  Connect the other seven pins (4, 5, 6, 11, 12, 13, and 14) and load up your sketch.


Quote
The Arduino is writing to the LCD on the 4 data-lines (counting up seconds), I have verified this on the oscilloscope in my laboratory,
It would be interesting to find out how you accomplished this.

Don
« Last Edit: January 30, 2013, 10:15:33 pm by floresta » Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 47
Posts: 2169
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is my setup.

Arduino Leonardo. Arduino IDE 1.0.3. A MIDAS LCD (8x2).
What is wrong?

Thank you for your time.


Just idly looking at your post again, you describe the LCD as an 8x2, and your code states that. Your picture shows a typical 16x2 display.  The library in the  code is for LCDs using the Hitachi HD44780 driver, and what one would expect for the LCD in your picture.  The first thing you need to do is check that the 8x2 LCD uses the  Hitachi HD44780 driver. if so, your code may be kosher - almost, but your wiring may not be, and your picture is not telling the whole story. 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Kingoslo, I think you're sending too many commands to the LCD each second.  You might try a delay(200) in your loop, and count up using a variable instead of trying to display milliseconds.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Kingoslo, I think you're sending too many commands to the LCD each second.  You might try a delay(200) in your loop, and count up using a variable instead of trying to display milliseconds.

Thanks, that fixed my problem! smiley

Kind regards,
Marius
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4245
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Kingoslo, I think you're sending too many commands to the LCD each second.  You might try a delay(200) in your loop, and count up using a variable instead of trying to display milliseconds.

Thanks, that fixed my problem! smiley

Kind regards,
Marius

You are using the sketch from the LiquidCrystal tutorial, a sketch that has been used for several years by hundreds or more with no problems so the changes that you have made to make this sketch work may not be helpful in other situations.

Since the extra delay seems to have fixed your problem that indicates that you have a slower than normal LCD controller, perhaps even one that is out of spec.  The LiquidCrystal library seems to have a problem with these slow displays so you may want to look into one of the new, improved versions.

I suggest you look into the latest version of the LiquidCrystal440 library.  The latest version, for the Arduino 1.0, is called LiquidCrystal1.0.  To get a copy start here:--> http://code.google.com/p/liquidcrystal440/ and follow the Downloads link to get to the latest version.


Don

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Actually, Floresta, this is a funny coincidence because I had never seen the Setcursor sketch example before.  The way that it is written in the original includes a delay(200).  My recommendation, although i didn't know it at the time, put it back the way it was originally written. 

Kingoslo, I'm glad I could help.
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4245
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Actually, Floresta, this is a funny coincidence because I had never seen the Setcursor sketch example before.  The way that it is written in the original includes a delay(200).  My recommendation, although i didn't know it at the time, put it back the way it was originally written. 

Kingoslo, I'm glad I could help.
The purpose of the delay(200) in that sketch is so that a human being can see that the letters are being displayed sequentially.  Without the delay all of the letters would appear to be written simultaneously (and there would be no reason to put that code in a loop either). 

Don
Logged

Pages: [1]   Go Up
Jump to: