LCD Display Error

Hello Everyone,

I've got a strange bug occurring with my new LCD. Its a 16x2 (http://www.ebay.com/itm/110827216147?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649), correctly wired up to an Arduino 2560 Mega. I can write certain characters for example, this code works perfectly (at any point on the screen, Row 0 or 1, 0 - 16).

// LCD RS pin to digital pin 26
// LCD Enable pin to digital pin 28
// LCD D4 pin to digital pin 30
// LCD D5 pin to digital pin 32
// LCD D6 pin to digital pin 34
// LCD D7 pin to digital pin 36
#include <LiquidCrystal.h>
LiquidCrystal lcd(26, 28, 30, 32, 34, 36);
void setup() {
  lcd.begin(16, 2);
}

void loop() {
  lcd.setCursor(0,0);
  lcd.print("HELL  W RLD");
}

however, this code causes the screen to go blank/display blocks (one or the other, its temperamental)

// LCD RS pin to digital pin 26
// LCD Enable pin to digital pin 28
// LCD D4 pin to digital pin 30
// LCD D5 pin to digital pin 32
// LCD D6 pin to digital pin 34
// LCD D7 pin to digital pin 36
#include <LiquidCrystal.h>
LiquidCrystal lcd(26, 28, 30, 32, 34, 36);
void setup() {
  lcd.begin(16, 2);
}

void loop() {
  lcd.setCursor(0,0);
  lcd.print("HELLO WORLD");
}

Any Ideas? even if i try lcd.print("O"); the screen fails to display correctly.

Regards,

Josh

Take the code out of loop and put it in setup.

Don

I would print all possible characters, and add a pause after each one (so you have an easier time catching when the problem occurs).
If you have that problem printing an "O", what happens printing a "P" ?

Have a look at the character table, and find out what might be unique to that "O" or look for similarities with other characters you might find to evoke this problem.

Also, check the soldering of the connector, are all pins soldered good ?
If in doubt, redo them.

As floresta states: the loop runs thousands of times per second.
Each time you are resetting the cursor position and sending characters to the display.
Perhaps this might crash your display.

Have a look at the character table, and find out what might be unique to that "O" or look for similarities with other characters you might find to evoke this problem.

Both the upper case O and the lower case o have the lower four bits xxxx1111. They share this pattern with the / ? _ and a back arrow. Is the problem just with the upper case O, or do it's 1111 cohorts have the same problem?

Thanks for the replies,

Moving the code to setup/adding a delay does not solve the problem,

Both lower and upper case "o"/"O" do not work (I'll try the /?_ when I get home).

If these do not work, what could be causing this issue? Maybe something wrong with the pin out. (D7).

I've done a continuity check, the connection on that last pin is fine.

I'll hook up the oscilloscope to the Arduino pin to confirm that is fine also.

Any other suggestions?

Regards,

Josh

Any other suggestions?

You want all of the code in setup because the information should only be sent to the LCD once.
You do not want any kind of loop for the same reason.
You do not need a delay for the same reason.
You do not have to set the cursor to (0,0) since that is the default position after initialization.

#include <LiquidCrystal.h>

//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);      // put your pin numbers here

void setup()
  {
  lcd.begin(16, 2);                          // put your LCD parameters here
  lcd.print("hello, world!");
  lcd.setCursor(0,1);
  lcd.print("it works!");
  }

void loop()
  {
  }
#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);                          // put your LCD parameters here
    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()
  {  
  }

Don

Hi Don,

Thanks for the reply.

Writing multiple times to the LCD is not a problem and as I said in the previous post, moving the code to setup produces the same error.

Same goes for setting the cursor, you are correct, that code is not needed, but also does not cause the problem (removing the code also produces the same error)

I've checked the Arduino pins with an oscilloscope, they all are working properly.

Could the LCD be damaged? I believe cattledog was on the right track, as per this image, http://www.nunoalves.com/pics/blog/lcd04.png when all four pins are active it is writing "o" or "O".

Any other suggestions would be appreciated.

Josh.

Try with other characters in the same row: ? _ /, to see if is that. If the problem is that, you must have problems too writing the characters in the last column too.

Did you try to change the pins that are connected to the LCD to other place?

The problem must be too in the bit b1. (H=1000; E=0101; L=1100) Try to write 3, C, S, c, s.

Hi Luisilva,

None of those characters worked... I went and bought another one, plugged it in, and it worked fine.

Thanks for the help everyone.

Josh