Very strange Serial 16x2 LCD Display problem (from Maplin)

I spent an entire day to figure out this problem with the display, but with NO RESULTS.

The display worked just fine until at some point (no particular reason) it did not show the messages anymore in their entirety, except the first two characters in each two rows of the display. This is the LCD display I am talking about:

I figured, rather than using the library, I will test it with low level commands. I was able to set the cursor to let say row=1 column=5 and display “abcde” no problem. It Displays it correctly starting at column 5. However, if I set the cursor to either rows and column=1 or 2, it no longer displays the message correctly only one character in each rows. It appears if column 3 would no longer be there and the display would only have 2 columns.

This is the simple code with witch I tested it.

#include <SoftwareSerial.h>
#include <serLCD.h>


serLCD lcd(16); // initialize the library

void loop() 
{

}

void setup() 
{    
   lcd.clear();
   lcd.setCursor(1, 1);
   lcd.print("abcde");
   delay(1000);
   
   for(byte i=0; i<5; ++i)
   {
     lcd.print(i);
     delay(1000);
   }

}

Running the code the following happens. It displays in row=1, column=1 the character “e”, and in row=2 underneath shows “d”.

Then as it writes the values for “i”, it rewrites the same positions with the corresponding numbers. So, in sequence it looks like this.

e      e      1      1      3      3
d      0      0      2      2      4

Note that there are only two characters on the display at any given time, and that is in the first column only. So, first I see e/d, then I see e/0, then 1/0, etc. And also note that, if I change the program to set the cursor at column 3 it works fine. So the display is not broken. I reset the display by sending a “ctrl-j”, and although the display says it is resetting, nothing changes, this problem persists.

I use the library:

/*
 serLCD.cpp - Library for controlling a SparkFun serLCD module.
	            Code written for firmware version 2.5
                    Created by Cody B. Null, September 9, 2011
                    Modified by Jordan Hochenbaum, Dec 5, 2011. (Version 1.5)
                    Version 1.4 - This version wrote specifically for 16x2 Display.
                    More display support coming in later version.
                    .....
                    .....
*/

Anybody ever experienced such a problem with the LCD display???

I'd like to add that the splash screen appears on power up with no issues. It is two lines, both starting at column 2 of the display.

Yet, after the splash screen is gone and a delay of 5 secs is introduced, setting the column to 2 at any of the rows will result in the previously described error.

The display behaves as it is only 2 columns and it wraps back to the beginning (1,1). If I set the cursor at 1,1 instead of 1,2 then it behaves as it is only a 1 column display. The text will wrap back from position 2,1 to 1,1 and keeps going until the end of the string being displayed.

Very strange indeed! I tried to reset the display or rather initialise it properly, but it did not work either.

Does anybody have a small piece of code or advise how to reinitialise the LCD display? Perhaps that will solve the issue.

By the way, I ordered a new display, so I will soon see if it is a display issue only.

One more information: if I write from right to left it will fill all columns with no problems. Then I write left to write again and the problem is there. It will wrap back after the first column. This is the code I tried:

     lcd.clear();
     lcd.setCursor(1,16);
     lcd.rightToLeft();
     lcd.print("1234567890abcdef");
     delay(1000);
     lcd.setCursor(2,1);
     lcd.leftToRight();
     lcd.print("1234567890ghijk");

The display results in this first:

fedcba0987654321

Then it concludes with this:

jedcba0987654321
k

Note that, the second string I attempt to display will start at row=2 and col=1 and the next character is wrapped back to row=1 col=1 and alternates between the two until j/k remains on the display.

Somehow the cursor does not seem to be advanced from column 1 or 2, yet it works fine with columns beyond 2. Also moving the cursor backwards seem to be working fine while displaying right to left.

I will post my findings, if I ever figure out what is going wrong here.

No takers?

I guess it is a very strange problem indeed!

I programmed a short routine that takes row, col, string, and if a special #ifdef LCD_BUG_FIX is set then it reverses the string and calculates the new position of the cursor to print it backwards. I use rightToLeft() for the display and to reverse the string use strrev(string). Note that the string is reversed in its place permanently, so you have to run strrev(string) to return into its original state if necessary. Most of the time it is no longer needed after it has been displayed though.

By the time I was finished the display is completely blank. The splash screen is still intact after powering up the LCD.

I shall remain puzzled until the new serial LCD display is shipped. This one seems shot.

Will be back with the next finding in a week or so.

Somehow the cursor does not seem to be advanced from column 1 or 2 ...

Regardless of which way you are going (right to left or left to right) you have to remember that the address counter proceeds through all of the addresses but your LCD is only capable of displaying what is in some of those addresses.

For a 16x2 display there are 32 displayable (without shifting) addresses and another 48 that are not. For a complete explanation follow the LCD Addressing link at http://web.alfredstate.edu/weimandn.

Don

That display is somewhat exotic, because it's backpack uses a serial interface through a PIC controller.
You connect it to pin D1 and send it serial commands to display things.

In your case i see you are including software serial so you'll be using another pin but i can't see what pin that would be.
That doesn't mean your problem is there, because you seem to be communicating with the module.
You are doing so using some library.
The linksprite site doesn't show that library (or i didn't look close enough).
Instead it shows some example Arduino code.

has been tested on Arduino IDE 1.0.1

Have you tried to do the same thing you are doing here, but following that example code?

I'm not sure how well you'll be helped by the LCD Addressing link floresta gave, because the PIC controller might mess things up.
However it won't do any harm and is good stuff to read.

... because the PIC controller might mess things up

The controller is not likely to cause a problem as long as you send it only 'displayable' ASCII codes (0x20 through 0x7E or 32 through 127).

Try sending it a string of 80 displayable characters without messing with any cursor positioning. If all 32 characters on your display are filled then you know that your display is functioning properly. The previously mentioned link will tell you what to expect.

In general you will want to make sure that you do all of your troubleshooting with your code in setup(). You want loop() to have nothing between the brackets so you don't rewrite the screen.

Don