5 years, 7 months ago.

Rolling display LCD screen

I am attempting to display keyboard entries in real time by the user, which is displayed on the Tera terminal and the LCD simultaneously. I have the program partially, but I need to copy or shift the contents from the bottom row to the top row when the bottom row gets filled. I have tried filling an array as the loop goes around then displaying it at location(0,0) at character 16, I'm not sure if that would work, I've been trying it but it doesn't seem to. If anyone has anything that would be great.

1 Answer

5 years, 7 months ago.

I assume you are using the standard TextLCD lib. This lib wraps the cursor around from the first to the second line and from the second line to the top line. So keep track of where your cursor is. When you have written the 16th char on the second line, the cursor will be at (0,0) already. When a new char needs to be shown, first clear the whole screen (cursor will be at (0,0) again). Write the last 16 chars again so they show on the top line, cursor will now be at start of second line. Write your new char. When all 16 positions are filled again you repeat the above. You just need to keep the last 16 chars in memory. Things will get more messy when you have carriage returns in your console input.