Go Down

Topic: can never get a LCD to work with UNO (Read 5105 times) previous topic - next topic

NickPyner

#15
Dec 09, 2012, 04:18 am Last Edit: Dec 09, 2012, 04:22 am by NickPyner Reason: 1

Quote
Just try the line

LiquidCrystal lcd(8,9,4,5,6,7);

Don't be tempted to re-write the number in order.


This is horrible advice.  

Your recommendation points out the fact that you really don't understand it's purpose.  Why don't you follow the links in reply #9 to find out?




No it isn't, I understand the purpose well, and it is very good advice.

I say this because:

1. While I have not read reply #9, I have read the original post, which I recommend to you, and the problem is very much like the problem I had, right down to the source of code that could be problematical.

2. The advice I gave actually works. Well, it did for me, indeed it is all I needed to do.

The advice was well-intended and simple enough to try, hopefully Knuckles will get the same result and, in that blessed event, we will all be glad to hear from you.

Oh, and guess what? I have also read the good news from Johannesburg in reply #8, which I also recommend. You might find it as entertaining as I do, although I guess you will not find it a pearl of wisdom.

floresta

Quote
...although I guess you will not find it a pearl of wisdom.


Well at least you got that part right.

Don

bperrybap



1. While I have not read reply #9, I have read the original post, which I recommend to you, and the problem is very much like the problem I had, right down to the source of code that could be problematical.


The problem really isn't the code, it is that the constructor that configures the pins used by the
LiquidCrystal library does not match how the lcd is wired up.
So in reality it is that the LCD is mis-wired. i.e. the LCD is not wired up the way the sketch told the library it was wired.
All the matters is that they match. You can wire the lcd up according the constructor or alter
the constructor in the sketch to match the wiring.

It is only 6 wires/pins. With careful attention to details it isn't that difficult to make sure the
constructor properly defines the pins for how the LCD is wired.

And as Don said, part of what makes this difficult is that the LiquidCrystal examples don't clearly show what
lcd pin/function each of the pins in the constructor is used for.

Once there is an understanding of the constructor arguments and which argument (pin) represents
each LCD function it becomes a simple matter of looking at which Arduino pin is assigned to each
LCD function and then wiring that Arduino pin up to the LCD pin for that LCD function.

--- bill




JimboZA

In fact Don, I vaguely remember reading about what those pins do, probably exactly where you pointed me. But it was certainly after the fact: I know I just used them as is without regard for what they do.
My hovercraft is full of eels.

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

NickPyner




1. While I have not read reply #9, I have read the original post, which I recommend to you, and the problem is very much like the problem I had, right down to the source of code that could be problematical.


The problem really isn't the code, it is that the constructor that configures the pins used by the
LiquidCrystal library does not match how the lcd is wired up.
So in reality it is that the LCD is mis-wired. i.e. the LCD is not wired up the way the sketch told the library it was wired.
All the matters is that they match. You can wire the lcd up according the constructor or alter
the constructor in the sketch to match the wiring.



The problem is the code inasmuch as that quoted was written for the LCD shield designed and sold by the code writer, Oxner of tronixstuff and, while there is nothing wrong with that, is not likely to work with anything else. The shield in question is looks like no other I know of.

The problem is also the code inasmuch that, if the LCD is on a shield as I suspect, it is the code that is going to be fixed.  

I can't imagine any variation in the wiring of the HD44780 but the distribution to the Arduino the pins is entirely down to the whim or convenience of the circuit-board designer.  Looking at my eBay cheapo shield, I can't really see why anybody would do it any other way and this might go quite go quite some way to explain why the pin sequence I quoted is in fact quite common - hence my recommendation, and indeed my lack of surprise in seeing it recommended by others here.

Having the intended relationship of the module's pins to Arduino commented in the sketch would certainly relieve a bit of stress amongst newbies like me, particularly since this can be easily determined on the shield itself. Still, it's all part of the game, and the 16x2 is child's play compared to the Nokia 5110. Knuckles is going to love one of them....



liudr

I am glad I missed this due to some full day teaching arrangement. So who are these well-intended advice givers without any regards what programming is about?

floresta

Quote
The problem is the code inasmuch as that quoted was written for the LCD shield designed and sold by the code writer, Oxner of tronixstuff and, while there is nothing wrong with that, is not likely to work with anything else. The shield in question is looks like no other I know of.


There is nothing in the original post that mentions anything specific about the LCD that he is using or the code that he is trying to run it with.  I don't see any mention about whether he is or is not using a shield as the word 'shield' appears nowhere in the post.

Here is a copy of the very first reply - it is still valid ...

"There have been dozens (it seems like hundreds) of posts similar to yours in this forum over the past few years.  It would only take a cursory look at them to see that we cannot help you unless you post the exact code that you used along with a clear photograph of your connections."
... except for the fact that the original poster has vanished.

Don

knuckles

#22
Dec 09, 2012, 09:15 pm Last Edit: Dec 09, 2012, 09:28 pm by knuckles Reason: 1
no he hasnt he is still here .

i keep trying the examples and checking things over and over with the various examples which are mostly the same ,ie the arduino cookbook example on page 365 which ties up roughly with the others such as the UNO library examples .obviously the data pinouts can change and the R/W on grnd ,and reset on 12  and E on 11
i have left the tronix example alone as that seems dated .
5v is taken from the 5v pin on the UNO ,i take it thats ok as shown in the example

the displays are parallel sparkfun LCD with 16 pins and 2x16

and a sparkfun 4x20 parallel display with 16 pins .

the prog i used is on page 366 of the arduino cookbook as thats recent and tried and tested i presume by michael margolis who wrote it

and here http://arduino.cc/en/Tutorial/LiquidCrystal

liudr

knuckles,

You got good spirit but you are simply repeating your mistakes until you get help. Follow the first reply you got from floresta. Best advice I've seen on this thread.

knuckles

the example on page 366

says LiquidCrystal lcd (12, 11, 5, 4, 3, 2); and thats what i have been using so far ...and wiring ties up with this setup but dont work ...

knuckles

this is it ,pretty standard in all sources with pin numbers as shown


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

knuckles

and from the book on page 366....

/*
  LiquidCrystal Library - Hello World

  Demonstrates the use of a 16 × 2 LCD display.
  http://www.arduino.cc/en/Tutorial/LiquidCrystal
*/

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

//constants for the number of rows and columns in the LCD
const int numRows = 2;
const int numCols = 16;


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

void setup()
{
  lcd.begin(numCols, numRows);
  lcd.print("hello, world!");  // Print a message to the LCD.
}

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

bperrybap

And now as Don mentioned in reply #7 we need a clear in focus photo
that is clear enough to show how everything is wired.

BTW, you have soldered the wires to the LCD module right?

--- bill

liudr

There was one time I shared apartment with a law school student. We were not happy we didn't get our deposit back and consulted some campus legal consul. The legal consul mentioned a legal term to us but was too quick. I was gonna ask him again how that term is written when my law school student roommate stopped me, saying, "Don't bother asking. That's all on the book!" Which book? I don't his book! I don't have your book let alone page 366. Can you understand English, such as post pictures? I hope your book has a section where ot teaches you how to ask for help on our forum.

floresta

#29
Dec 09, 2012, 10:54 pm Last Edit: Dec 09, 2012, 11:05 pm by floresta Reason: 1
Quote
the prog i used is on page 366 of the arduino cookbook as thats recent and tried and tested i presume by michael margolis who wrote it

I haven't seen him around for a long time, but he popped up in the Project Guidance section just a few days ago.  Maybe his ears will start burning and he will join us.

Quote
I don't have your book let alone page 366.

Neither do I.

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

We need the photograph to see if you did this properly.

Quote
BTW, you have soldered the wires to the LCD module right?

And we need it to check this, not only the presence of solder but also the absence of cold solder joints.

Quote
lcd chip is the HD44780 standard controller .

This reminds me that a link the datasheet for the LCD module would help us also.  Although the controller on the LCD module is standard the LCD module pinout is frequently, but not always standard.   The fact that you are using 'Sparkfun LCDs doesn't help because at any given time they may have several for sale and the ones they have today may not be the same as the ones you got from them yesterday.

Don


Go Up