Go Down

Topic: 4 bit LCD library and Hitachi HD44780 compatible display (Read 3766 times) previous topic - next topic

zarobhr

Oct 31, 2012, 12:58 am Last Edit: Oct 31, 2012, 02:34 am by zarobhr Reason: 1
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: [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, 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);
}

floresta

#1
Oct 31, 2012, 01:14 am Last Edit: Oct 31, 2012, 01:18 am by floresta Reason: 1
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

zarobhr


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


zarobhr


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

floresta

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

zarobhr


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: [Select]
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: [Select]
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

floresta

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

floresta

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

zarobhr


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


dc42

As floresta says, leaving the RW pin floating is asking for trouble. You need to connect it to ground.
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.

zarobhr


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

floresta


zarobhr


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: [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, 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: [Select]
/*
  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();
}





Go Up