Hi guys,
I have a DEM16217 16x2 LCD hooked up to a boarduino. I have a simple temperature sketch running, but I can't seem to get the LiquidCrystal library to print a full line of text.
When I write 16 characters exactly to the frst line of the LCD, it seems to replace the last letter with a random character.
The last "*" is replaced with a "z". I have also had the same problem using a line of text "Room Temperature" is displayed as "Room Temperaturu" (letter "e" at the end is replaced with "u").
I guess this was just the function that caused the issue. It's called straight away so I didn't think the rest of the sketch mattered (everything else works just fine). I will post it when I get home.
I tried that - but I still get the random character.
Is the character truly random or is it just incorrect? In other words - does a final '*' always result in a 'z' and does a final 'e' always result in a 'u'?
Is it always the last character that is affected or is it only the 16th character? In other words - what happens with a 10 character message and what happens with a 20 character message?
Just from what I remember (am @work at the moment):
It's a 16x2 character display. For 15 or less characters, the last character is blank (as expected). For 16, it replaces the last character with something random (but the random character is always the same for a specific letter - * does result in a z and e does give a u)
For more then 16 characters, I seem to remember the last character being the same - determined by the 16th character.
I will post my sketch - but could this be related to the boarduino AtMega168 (I will run the same sketch on my duemilanove AtMega328 just to check)
For more then 16 characters, I seem to remember the last character being the same - determined by the 16th character.
I take it that this means that the 16th character is correct.
but could this be related to the boarduino AtMega168
I doubt it. I use a Boarduino, a Bare Bones Board, a Real Bare Bones Board, and an Arduino interchangably. Each of these is essentially a microcontroller, resonator, and power supply. The electrons don't care who assembled and sold these components.
but the random character is always the same for a specific letter
So it's not random, it is incorrect - a big difference.
The 16th character is incorrect when I try and print 16 or more characters to a line. The incorrect (previously called "random") character seems to be determined by the 16th character.
OK, so it seems to follow a pattern
a : q
b : r
c : s
etc
j : z
k : {
l : |
m : }
n : ->
This also only seems to cause trouble on the top line of the LCD. If I type 16 characters on the lower row - they all display fine :o
The Datasheet for the LCD is here: http://www.maplin.co.uk/media/pdfs/N27AZ.pdf (Character set is at the bottom). It seems to shift the character over by one column? I'm sure it's something simple.
EDIT: I also just re-checked my wiring, and changed the pin-outs to exactly match the tutorial: http://arduino.cc/en/Tutorial/LiquidCrystal but it's still doing the same thing
It seems to shift the character over by one column?
Your test is inconclusive although it does provide some clues. All of the characters that you tried this tiime have a binary value of 0110xxxx and the resulting incorrect characters all start with 0111xxxx. BUT previously you said that the '*' which is 00101010 gives 'z' which is 01111010. This implies that the leading nibble is always set to 0111. It would be interesting to see what the numbers and the capital letters give. Take a look at a good ASCII chart such as the one you will find by following the Decimal - Binary - Octal - Hex - ASCII Conversion Chart link at http://web.alfredstate.edu/weimandn to see what i am getting at.
I'm sure it's something simple.
So am I. I have a feeling that this due to some interaction between 'LiquidCrystal' and 'serial.print'.
Does your splash screen display correctly during the 3 second delay before loop() is invoked? Does your splash screen display correctly if the contents of loop() are commented out? If the answer is yes then you have to start uncommenting the previously commented out steps in loop() until it breaks again.
Thanks for sticking with me on this one. I played around with some capital letters - I'll post a list when I have it all hooked up again.
I also tried 16 characters inside my loop() and that seems find for bith lines. Also, if I moved the lcd print statement directly into the setup() functio, it would also display all 16 characters correctly. The errer seems isolated to that splash screen function.
Apologies for my ignorance with all this - I'm still very much on the bottom rungs of the ladder!
I don't see how that messed up the splash screen as it was called after the setup.
The splash screen was probably initially OK and the last character on the first line got overwritten later. That's why I asked if the splash screen was displayed correctly during the 3 second delay before loop() was invoked. Was it?
No, the splash screen was wrong in those 3 seconds before the loop. That's what I find strange. I then commented out the content of the loop and it was fine. I then added lines back in as you had suggested and found that Serial.print line was causing it to break.
I can't see why that line would have broken the splash screen?