Pages: [1] 2   Go Down
Author Topic: 4 bit LCD library and Hitachi HD44780 compatible display  (Read 2734 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 77
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i have connected a compatible display to my arduino
using arduino ide 1.01
the display is a CU20025ECPB-U1J

only the following pins are connectedno other pins are connected
lcd     to   UNO
pin 1 ---   ground
pin 2 ---   5v
pin3 --- not con------contrast
pin 4 ---   uno pin 7  --- RS
pin5 --- not con ---- RW
pin 6---    uno pin 6  --- enable
pin7 --not connect ---db0
pin8 -- not conn --- db1
pin 9 --- not conn  --- db2
pin10 --- not conn  --- db3
pin 11 --- uno pin 5 ---- db4
pin 12 --- uno pin 4 ---- db5
pin 13 ---  uno pin 3 ---- db6
pin 14 --- uno pin 2 --- db7

the proble is hello, world is displayed as    h e l l o ,  w o r  (with spaces)

ok here are the exect printing and location

display location

 h e l l o ,   w o r    


any idea how i can fix this


here is the code

 
Code:
/*
  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, 6, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(20, 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);
}
« Last Edit: October 30, 2012, 08:34:21 pm by zarobhr » Logged

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

What we really need to know is:

1.  The specific display that you are using.
2.  The specific version of the Arduino IDE that you are using.
3.  The specific library that you are using.
4.  ALL of the connections to your display (did you connect pins 3 and 5?).
5.  ALL of the code that you are using.
6.  The exact contents of the display that resulted (did the quotation marks and exclamation point really disappear?).
7.  How you managed to get 22 characters displayed on a 20 character wide display.

Then we may be able to give some specific help.


Don
« Last Edit: October 30, 2012, 07:18:08 pm by floresta » Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 77
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What we really need to know is:

1.  The specific display that you are using.
2.  The specific version of the Arduino IDE that you are using.
3.  The specific library that you are using.
4.  ALL of the connections to your display (did you connect pins 3 and 5?).
5.  ALL of the code that you are using.
6.  The exact contents of the display that resulted (did the quotation marks and exclamation point really disappear?).
7.  How you managed to get 22 characters displayed on a 20 character wide display.

Then we may be able to give some specific help.


Don

modified above post to reflect the questions
Logged

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

What about #4?
Logged


Offline Offline
Jr. Member
**
Karma: 0
Posts: 77
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What about #4?
sry i only but connected ones here are the non connected ones

3- contrast
5-RW
7 DB0
8 DB1
9 DB2
10 DB3
Logged

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

Quote
modified above post to reflect the questions
This is really not a good procedure since the reasons for my original questions are now no longer part of the thread.  It makes me look like an idiot and it makes it hard for anyone who reads this in the future to follow the entire troubleshooting procedure.

Your answer to #6 does not mention anything about the second row of information.  Did anything appear?  Were there extra spaces?


Quote
sry i only but connected ones here are the non connected ones
I can't believe that your display shows anything with pins 3 and/or 5 floating.

Don
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 77
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
modified above post to reflect the questions
This is really not a good procedure since the reasons for my original questions are now no longer part of the thread.  It makes me look like an idiot and it makes it hard for anyone who reads this in the future to follow the entire troubleshooting procedure.

Your answer to #6 does not mention anything about the second row of information.  Did anything appear?  Were there extra spaces?


Quote
sry i only but connected ones here are the non connected ones
I can't believe that your display shows anything with pins 3 and/or 5 floating.

Don

sry for the modification i havent posted much here.

as for second row i did not send anything to  second row in the test 

now it get interesting

first i changed  the code to
Code:
lcd.begin(20, 2);
  // Print a message to the LCD.
  //lcd.setCursor(0, 0);
  lcd.print("hello, world!");
  lcd.setCursor(0, 1);
  lcd.print("byebye, world!");
this resulted in the first line still messed up but the second line perfect

next changed to
Code:
lcd.begin(20, 2);
  // Print a message to the LCD.
  lcd.setCursor(0, 0); //first line
  lcd.print("hello, world!");
  lcd.setCursor(0, 1); //second line
  lcd.print("byebye, world!");

this resulted in first line perfect and second line with spaces between each character sent
Logged

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

Let's get pins 3 and 5 taken care of first.  Most displays are blank with pin 3 floating (unconnected) and they will show unpredictable behavior with pin 5 floating.  Your display seems to behaving somewhat unpredictably.

Don
Logged

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

Quote
i have connected a compatible display to my arduino
...
the display is a CU20025ECPB-U1J
Can you point us to some documentation for this display.  As far as I can tell it is a VFD display, not an LCD so that changes things a bit. 

Don
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 77
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
i have connected a compatible display to my arduino
...
the display is a CU20025ECPB-U1J
Can you point us to some documentation for this display.  As far as I can tell it is a VFD display, not an LCD so that changes things a bit. 

Don
data sheet http://www.datasheetarchive.com/CU20025ECPB-U1J-datasheet.html

there are also other posts on the forum that i read where people are using the arduino library for the vfd. it is an lcd compatible vfd

Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

As floresta says, leaving the RW pin floating is asking for trouble. You need to connect it to ground.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 77
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As floresta says, leaving the RW pin floating is asking for trouble. You need to connect it to ground.

RW is now connected to ground, same results
Logged

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

Is jumper link J2 soldered or open?

Don
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 77
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is jumper link J2 soldered or open?

Don

i will check but i have been experimenting and here is what i found out(work arounds)

basically if i issue the lcd.setCursor command twice except the very first time, everytime it is used then everything works fine
example one
Code:
/*
  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, 6, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(20, 2);
  // Print a message to the LCD.
 
  lcd.setCursor(0, 0);
  lcd.print("hello, world!");
  //delay (10);
  lcd.setCursor(0, 1);
  lcd.setCursor(0, 1); // added second time here and it now works
  lcd.print("byebye, world!");
  //lcd.setCursor(0, 0);
  //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);
  //lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  //lcd.print(millis()/1000);
  //delay(50);
}

example 2
Code:
/*
  LiquidCrystal Library - Autoscroll
 
 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 demonstrates the use of the autoscroll()
 and noAutoscroll() functions to make new text scroll or not.
 
 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://arduino.cc/en/Tutorial/LiquidCrystalAutoscroll

 */

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

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

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(20,2);
  lcd.setCursor(0, 0);
}

void loop() {
  // set the cursor to (0,0):
  lcd.setCursor(0, 0);
  lcd.setCursor(0, 0); // added repeat
  // print from 0 to 9:
  for (int thisChar = 0; thisChar < 10; thisChar++) {
   lcd.print(thisChar);
   delay(500);
  }

  // set the cursor to (16,1):
  lcd.setCursor(20,1);
  lcd.setCursor(20,1); //added repeat
  // set the display to automatically scroll:
  lcd.autoscroll();
  // print from 0 to 9:
  for (int thisChar = 0; thisChar < 10; thisChar++) {
    lcd.print(thisChar);
    delay(500);
  }
  // turn off automatic scrolling
  lcd.noAutoscroll();
 
  // clear screen for the next loop:
  lcd.clear();
}


Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 77
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is jumper link J2 soldered or open?

Don
it looks like it is open
Logged

Pages: [1] 2   Go Up
Jump to: