I'm having a problem with my LCD screen and can't seem to find an answer online so I'm hoping someone here can help.
The problem is that my LCD won't display anything after the first SPACE character in a string. Here's my code...
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 2, 3, 4, 5, 6, 7, 8, 9, 10);
void setup() {
// set up the LCD's number of rows and columns:
lcd.begin(16, 1);
//lcd.init(); //initialize the LCD
digitalWrite(13,HIGH); //turn on an LED for debugging
}
void loop(void){
lcd.clear(); //clear the display
delay(1000); //delay 1000 ms to view change
lcd.print("Hey dude");
delay(2000);
lcd.clear();
lcd.print("You da man");
delay(3000);//delay 1000 ms to view change
} //repeat forever
This is a 16 character, 1 line LCD screen.
The timing is perfect, but when it's supposed to say "Hey dude" is just says "Hey"... then at the switch it changes to "You" instead of "You da man"
Any thoughts on this? Everything appears to be hooked up correctly and I put a pot on the contrast pin to tweak the display...
Try printing the same character for all 16 character locations. This should tell you if the LCD is working properly. From the sound of it, I think your LCD may have a problem. You may find that there are certain locations that won't print while others will. Please let us know what you find out.
Most 16x1 LCD displays actually function (internally) as 8x2 displays. Use lcd.begin(8,2); in setup (and then remember to do a 'SetCursor' after the eighth character). See how your program works with this lcd.begin() statement before you try any more troubleshooting.
Try printing the same character for all 16 character locations.
An even better test is to print 80 different characters.
In the case of an 8x2 that is masquerading as a 16x1 you will see the first eight characters on the left half of the display, the next 32 characters will not display, the next eight will be on the right half of the display, and the rest will not display. For a complete explanation go to http://web.alfredstate.edu/weimandn and follow the LCD Addressing link.
This code resulted in the following outputs to the LCD
"AAAAAAAAaa"
and
"aaaaa"
It's as if the LCD interprets the space as a termination of the string. I've read through the panel manufacturer's spec sheet and can't find anything relative to the problem I'm seeing here, so I'm wondering if maybe this is a configuration problem?
I've double checked the wiring and I am indeed wired correctly.
For reference, the LCD screen I'm using is...
Model: DMC-16106A
Display Format: 16 x 1
Character Font: 5 x 11
Duty: 1/11
I don't think it has anything to do with your wiring or the LCD module. That leaves the LiquidCrystal library and specifically the lcd.print function.
I assume you are using the version of LiquidCrystal that comes with Arduino v0018. If not, that's the first thing to try.
Virtually everyone uses the library in the 4-bit mode without the R/W line so it has probably not been wrung out in the 8-bit mode especially with R/W.
Here's what to try next:
(1) Remove the R/W connection from the Arduino and connect it (LCD pin 5) to ground. Remove the pin reference from LiquidCrystal lcd() and try running your program.
(2) Remove the lower four data connections and the corresponding references in LiquidCrystal lcd() and try running your program.
Model: DMC-16106A
Display Format: 16 x 1
Character Font: 5 x 11
Duty: 1/11
You have an unusual display, one of the few that can display the 5x11 font. I've never used one of these and I'm not sure how it reacts to the fact that the library sets it up for the 5x7 font.
How do you feel about modifying your library to test this out? What you need is a function set command that will set bit 2. The info is in Table 3.1 on page 39 of your manual.