Pages: [1] 2   Go Down
Author Topic: Newhaven LCD help  (Read 1628 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I have been using a 16x2 LCD from Adafruit and the tutorial worked great (http://www.ladyada.net/learn/lcd/charlcd.html). The issue I had was that the display was too big to fit the application I needed. So while reading the tutorial I noticed that it said that the code and wiring should work for any character LCD. So I found a 20x2 display from Newhaven and I am having fits with this thing. I was wondering if anyone has any insight into what is going on.

Here are some images of what I am seeing.



Here is an image of my wiring.



If I change the "lcd.begin(16, 2);" to "lcd.begin(20, 2);" it doesn't change anything. Also if I set the LCD cursor to 0,1 or 0,2 the display doesn't change.

The LCD has pinouts that match the 16x2 LCD I was using (http://www.adafruit.com/products/181, data sheet http://www.adafruit.com/datasheets/TC1602A-01T.pdf). The data sheet for the LCD I am trying to use is http://www.newhavendisplay.com/specs/NHD-0220FZ-FSW-GBW-P.pdf

I am completely stumped. If anyone has anything I am all ears.

Thank you
Logged

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

Quote
If I change the "lcd.begin(16, 2);" to "lcd.begin(20, 2);" it doesn't change anything.
This is normal.  I should refine this to say that this is normal operation for the LiquidCrystal library as it is currently written.  It does not use the first argument at all and only checks to see if the second value is greater than 1.

Quote
Also if I set the LCD cursor to 0,1 or 0,2 the display doesn't change.
I would suspect that this should have a big effect since your display has only two rows of characters and they are numbered 0 and 1

Many of the New Haven displays have capabilities that are different from the run-of-the-mill LCDs and therefore have some unique programming requirements.  This one, aside from the duplicate set of pins, appears entirely normal.

Try the following sketch and see what happens.  Check out the LCD Addressing link at http://web.alfredstate.edu/weimandn if you aren't sure what should be displayed.


Code:
#include <LiquidCrystal.h>

//LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
  LiquidCrystal lcd(12, 11, 5, 4, 3, 2);       // put your pin numbers here

void setup()
  {
    lcd.begin(20, 4);
    for (int i=47; i<127; i++)                 // send 80 consecutive displayable characters to the LCD
    {
    lcd.print(i,BYTE);
    delay(100);                                // this delay allows you to observe the addressing sequence
    }
  }
void loop()
  { 
  }

Don
Logged

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

It doesn't seem to like the "BYTE".



Thank you for the quick response. This thing is driving me batty.
Logged

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

Another casualty of Arduino 1.0 I guess.  See what happens with lcd.write(i);  (Just guessing, I'm not a 'C' programmer.)

Don
« Last Edit: March 10, 2012, 11:31:41 am by floresta » Logged

Dallas, TX USA
Offline Offline
Edison Member
*
Karma: 47
Posts: 2328
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Because of the way the print class is implemented you will now have to cast the value to
have it treated as a character if you pass it an int.

There are two options. (both work in either pre 1.0 or 1.0)

Either cast the argument like this:
Code:

for (int i=47; i<127; i++)                 // send 80 consecutive displayable characters to the LCD
{
       lcd.print((char) i);
       delay(100);                                // this delay allows you to observe the addressing sequence
}

Or don't declare i as an int but a char instead.
Code:
for (char i=47; i<127; i++)                 // send 80 consecutive displayable characters to the LCD
{
       lcd.print(i);
       delay(100);                                // this delay allows you to observe the addressing sequence
}

If the argument to print() is an "int" then the print class assumes you want
to see the int value and will convert it to the ascii characters that represent the decimal
value rather than outputting the character value of the integer.

--- bill


Logged

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

This is what I get when I use bperrybap's altered code.

void setup()
  {
    lcd.begin(20, 4);
for (char i=47; i<127; i++)                 // send 80 consecutive displayable characters to the LCD
{
       lcd.print(i);
       delay(100);                                // this delay allows you to observe the addressing sequence
}
  }
void loop()
  { 
  }



It looks as though it is completely skipping the first 4 characters. And it doesn't like 7's.

Any ideas?
Logged

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

Thank's Bill.  I'll revise my example, load up Arduino 1.0, dig out a real Arduino board and check it out sometime soon!

Scoop (or is it poop): I'll take a closer look at the bit patterns but meanwhile could you check out your four data wires.  You could have open or shorted wires and still be able to initialize the LCD and write some characters.
   

Don
Logged

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

I would say you have a bad LCD controller.  

Not only are you missing the first four columns of characters (20 columns of bits) but you are also missing three out of the five columns of bits in the column with the 7 and the underscore.

Note that you see only part of the 7, part of the underscore below the '7', and part of the 'o' in 'world'.


Don
« Last Edit: March 10, 2012, 03:56:59 pm by floresta » Logged

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

I actually do have another LCD of this same model and I am wiring it up now.

I did do a wire test and it seems to be ok.

I will post once I have the other lcd ready.

Thanks
Logged

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

wired up the 2nd one. It is better but still is missing half of the first character line.

So I squeezed it and lo and behold all of the characters lit up. There is something to the case around the LCD that is jacked up. If I squeeze it along it's length the characters change. Very strange.

Thank you for your help.
Logged

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

You guys will love this one...

So, I took a pair of pliers and pinched the tabs tighter against the sides and voila, it works completely now.



Weird (unless you understand why it did this).
Logged

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

And in conclusion, I took the original LCD and pinched those tabs, wired it back up and blam, it's perfect.

What a crock, it was never the code, never the wiring, it was all in shotty manufacturing!

Oh well, turns out when you get mad at components and squeeze them out of frustration sometimes good things can happen.

Don, Bill, thank you so much for helping me run this to ground.

Josh
Logged

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

I was out soaking in my spa and thought about pressing on the glass.  I see you found that out without me.  Well, at least we got a corrected version of the test sketch out of the deal.

Don
Logged

Dallas, TX USA
Offline Offline
Edison Member
*
Karma: 47
Posts: 2328
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was out soaking in my spa and thought about pressing on the glass.  I see you found that out without me.  Well, at least we got a corrected version of the test sketch out of the deal.

Don

Maybe each living species has a collective consciousness
and your thoughts resonated on top of the Earths Schumann Waves over to Scoop.  smiley-lol

( ~7 -  8 Hz, the frequency of human brain waves and the natural earth frequency
Schumann Waves, can easily travel vast distances with very little power. )

--- bill
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6889
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Good to know your problem was solved by force  smiley-wink

FYI, some diagrams. I bet it was the conductive rubber.


* lcd_connector_rubber.jpg (23.99 KB, 660x306 - viewed 27 times.)

* lcd-compressed.jpg (30.08 KB, 450x338 - viewed 26 times.)
Logged


Pages: [1] 2   Go Up
Jump to: