PDA

View Full Version : Scrolling Message on a LCD



Marsupial
October 13th, 2002, 03:55 PM
Ok here is a tip for those who have LCD which can display (for instance) winamp's currently playing song.

Ifever your songname is longer than the size of your LCD, you only see a part of it.

Here is how I managed scrolling

1- using DVD-Spy, I collect the songname, put it to a string "filename"
2- once per second (using time server plug-in) I run the song checkup

---
Song Chek-up: Ifever the stored name is different than my previously "oldname" I consider it a new song, else I consider it the same song.


oldname == filename;

---
new song: I store the name in "oldname".
I store the name (with pretty modifications to look good) into another string "displayname".
I send "displayname" to LCD for display

oldname = filename;
displayname = filename;

---

Old song: I verify if "displayname"'s lenght (GVMS) if it is longer than my LCD size, I scroll, else I sent it to LCD for displayal (no scroll needed for small names)

strlen(displayname) > 20;

---

Scroll: I put the 1st character into a string "charOne", I cut the "displayname" to remove 1st char, and I add "charOne" at the end.
I send the new "displayname" to LCD for display

charone = cut(displayname, 0, 1);
displayname= cut(displayname, 1, ((strlen(displayname))-1)) + charone;


---
Hope his helps.

Marsupial
October 13th, 2002, 03:55 PM
or you can download the newly made LCD version 2.

scrolls like a charm with HD44780 LCDs.

:)