Serial LCD problem
RDL2004
Posts: 2,554
I'm having a problem with the Parallax serial LCD (2x16, backlit) that I can't figure out.
The LCD should be showing 3 consecutive 2 line screens...
Initializing
LCD Display
Loading custom
Character in LCD
Temperature5.BS2
2006 MyName Here
The problem is the first line in the last screen doesn't show.
Only the second line appears, and it will be on the first line instead of where it belongs.
Believe me, I have tried everything I can think of to fix this.
I've only been able to get it to work correctly by deleting one character out of the disappearing line.
If it's only 15 characters it works.
I've copied all the relevant code out of the original program and attached it.
The problem is duplicated for me when running just the attached code.
Most of the code is pretty much copy and paste out of the documentation, but I'm pretty new to this stuff, so I could easily be doing something wrong. I'd really appreciate it if some more experienced people could take a look at this. I've spent 3 hours fiddling with it already and it's giving me a headache.
- Rick
Post Edited (RDL2004) : 6/1/2006 3:28:17 AM GMT
The LCD should be showing 3 consecutive 2 line screens...
Initializing
LCD Display
Loading custom
Character in LCD
Temperature5.BS2
2006 MyName Here
The problem is the first line in the last screen doesn't show.
Only the second line appears, and it will be on the first line instead of where it belongs.
Believe me, I have tried everything I can think of to fix this.
I've only been able to get it to work correctly by deleting one character out of the disappearing line.
If it's only 15 characters it works.
I've copied all the relevant code out of the original program and attached it.
The problem is duplicated for me when running just the attached code.
Most of the code is pretty much copy and paste out of the documentation, but I'm pretty new to this stuff, so I could easily be doing something wrong. I'd really appreciate it if some more experienced people could take a look at this. I've spent 3 hours fiddling with it already and it's giving me a headache.
- Rick
Post Edited (RDL2004) : 6/1/2006 3:28:17 AM GMT
Comments
·· I would like to make a couple of recommendations which may help you.· The first is that I would define custom characters during the initialization section of the code rather than during splash screens.· This way the characters are already defined and you can just print data.
·· The second suggestion is that the documentation requires a pause of 5 ms after clearing the screen so I would add that since it can cause characters to be missed.· The example programs we have on our website provide excellent examples of both procedures as well as using pre-defined constants so that your code is easier to follow.· I hope this helps.
One final addition is that instead of multiple SEROUT statements, try a single SEROUT for a line of characters.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Yes, those are all good suggestions and the PAUSE commands should be in there after the formfeeds.
I actually had the PAUSE commands in there at one time, but it made no difference, but I will try again.
·
As a matter of fact, if you scroll to the right you will see a left-over comment from one of those that I missed when I was cleaning up the code before posting it.
I also had the entire custom character section commented out at one time, but that didn't fix the problem either.
In the original program, the SEROUT lines are combined, I separated them in this test code to see if the problem was related to that, but it made no difference, so I just left them separated.
I don't really *need* any of this code (other than the custom character), the main part of the program is working pretty well at this point. It's just that it bugs me because as far as I can tell it should work correctly but it doesn't.
·- Rick
·· I have found your problem.· What is happening is that in the last splash screen·you are printing to the last character position with the first line, which causes the cursor to move to the next line.· Then when you do a 13 (Carriage Return) it shifts the display up, so when you print your next line it's on line 1.· Remove the 13 and you should be okay.· I hope this helps and I would still implement the previous suggestions.· Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
You were right. I went home at lunch and tried it and it worked.
I see what was wrong now, and why it was only happening when I used the full 16 characters.
I knew it had to be something simple that I just couldn't see.
On the 4x20 display I would still need the CR right?
Thanks for your help. I'll be able to clean up this section of code in the actual program now.
- Rick
·· Yes, had this been a 4X20 you would still use the CR...Also if the line 1 was less than 16 characters.· Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com