Go Down

Topic: Serial 2004 20x4 LCD Module Shield displaying single charector (Read 6493 times) previous topic - next topic

tom15

Hello I recent purchased this screen http://www.sainsmart.com/sainsmart-iic-i2c-twi-serial-2004-20x4-lcd-module-shield-for-arduino-uno-mega-r3.html

  I have the screen somewhat working using the LiquidCrystal_I2C Library.  It is connected to a Arduino Mega 2560 and the SDA and SCL pins are connected to the SDA and SCL on the Mega.  However when I use the following code
Code: [Select]
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 20 chars and 4 line display

void setup()
{
  lcd.init();                      // initialize the lcd
 
  // Print a message to the LCD.
  lcd.backlight();
  lcd.print("Hello, world!");
}

void loop()
{
  lcd.print("Hello");
  delay(1000);
}

It only prints out the first character of the phrase.  I have tried a different phrase and it does the same thing. Prints "H"
Is the problem with the Library.
Any help appreciated Thanks

umejopa

Hello I recent purchased this screen http://www.sainsmart.com/sainsmart-iic-i2c-twi-serial-2004-20x4-lcd-module-shield-for-arduino-uno-mega-r3.html

  I have the screen somewhat working using the LiquidCrystal_I2C Library.  It is connected to a Arduino Mega 2560 and the SDA and SCL pins are connected to the SDA and SCL on the Mega.  However when I use the following code
Code: [Select]
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 20 chars and 4 line display

void setup()
{
  lcd.init();                      // initialize the lcd
 
  // Print a message to the LCD.
  lcd.backlight();
  lcd.print("Hello, world!");
}

void loop()
{
  lcd.print("Hello");
  delay(1000);
}

It only prints out the first character of the phrase.  I have tried a different phrase and it does the same thing. Prints "H"
Is the problem with the Library.
Any help appreciated Thanks
Sorry I have same problem it seems that the LCD.print only wright one "X" to get one more I have to set the lcd.setCursor(3,0); to next one
It may be the IED have read that some other have it to work in a other IED

floresta

Leave loop() empty while you are getting your LCD to work.  Let us know what you see on the display.

Don

tom15

I tried leaving the loop empty but it does not help.  Having the lcd.print("Hello"); in the setup just prints H out once on the screen, instead of continuous.  If I spell out each letter by itself per command I can get it to display the word I want but that is a waste of time.  Also the lines are messed up in the loop it fills one line then skips a line fills that, then returns to the line it skipped.  Does any one what is wrong?

floresta

I can help with this part:
Quote
Also the lines are messed up in the loop it fills one line then skips a line fills that, then returns to the line it skipped.  Does any one what is wrong?
Unfortunately there's nothing wrong with this behavior.  It's a 'feature' of the LCD controller.  For the full story follow the LCD Addressing link at http://web.alfredstate.edu/weimandn.


Now back to this:
Quote
I have the screen somewhat working using the LiquidCrystal_I2C Library.
Which library are you referring to?  There are lots of them, all with the same name.

I suggest you try the 'New LiquidCrystal Library' by Francisco Malpartida.  You can get it here: --> https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home

Don 

Paul__B

Which library are you referring to?  There are lots of them, all with the same name.

I suggest you try the 'New LiquidCrystal Library' by Francisco Malpartida.  You can get it here.
It's just a pity that the bloody-mindedness of the Arduino team is here exhibited in not including this most important library in the ever-bloated distribution of the IDE, preferring to include four versions of the useless one! :smiley-roll:

Or have I missed something?

fhpa

Minutes before I also opened a topic regarding this problem and wrote how i fixed the problem for me.

On my side i found this issue after upgrading from 1.6.1 to 1.6.6. After downgrading to 1.6.5 everything was OK again.


umejopa

It work for me to at downgrade 1.6.5 .  :)
The may be a path for this... can we hope

common_ground

No downgrade, you have other solution.

1. Use New LiquidCrystal Library by Francisco Malpartida as suggested by floresta .
2. Open issue to maintainer of LCD I2C library you use, it is easy fix.
3. I fix one of them ( they all have same name and code looks same )  - it works fine with 1.6.6. Just replace old one with the attachment lib.

bperrybap

Guys,
This sounds like it is possible that it is an issue not related to a library misconfiguration.
The posters are saying that the EXACT same code and sketch works with 1.6.5 and doesn't work with 1.6.6
the symptom being that only the first character shows up on the LCD with 1.6.6

If this is the case, then it is possible that there could be an I2C issue in 1.6.6

common_ground, you are saying that you have modified a library to make it work with 1.6.6 ?
What was the modification?

--- bill
NEVERMIND.
I see the problem.
While it is technically an issue in the lcd library, it is caused by a change in the IDE Print class code.
Team arduino.cc has decided to change the write() function to allow asynchronous i/o.
The way that they have done this is VERY bad and has MANY issues with print() functions.
I'll go jump on them and try to explain why they simply can not do the code this way.
i.e. you can't break print() functions. Those must be synchronous and not return until all their i/o is completed unless you have a class option to enable/disable it (which they don't').




common_ground

What was the modification?
--- bill
New IDE 1.6.6 Print function is different from previous versions , explained here :
LCD write() functon changes

Just small modification, but solve big problem.

bperrybap

New IDE 1.6.6 Print function is different from previous versions , explained here :
LCD write() functon changes

Just small modification, but solve big problem.
I saw that and while this specific issue was caused by some broken code in an LCD library,
there is a larger issue related to partial i/o in the Print class print() functions that needs to be dealt with.
I posted lengthy post in that thread about it.
--- bill

tom15

Ok guys thanks for all the feedback using an older edition of the Arduino IDE solved the displaying 1st letter problem however it did not solve the jumping lines problem.  Common_Ground's Library is awesome however it also has not solved the line jumping problem. Does anyone know how to fix this last problem?  Really appreciate all the advice.  As a I said above the display fills the first line skips and fills the third goes back to the second and then fills the fourth.   Thanks

bperrybap

As a I said above the display fills the first line skips and fills the third goes back to the second and then fills the fourth.
That is the way memory is laid out in the hardware. See Don's post in post #4:
http://forum.arduino.cc/index.php?topic=359482.msg2479296#msg2479296

Read the link in Don's post about how memory is mapped to the LCD screen.
It is not a s/w bug. That is the way the hardware works.

You can't fill the screen using linear memory addresses.
You have to use the cursor positioning calls to set the cursor to the beginning of each line.
When you do that, the library s/w will do the correct conversion to get the proper memory address for the line you want.

--- bill

tom15


Go Up