Page 1 of 1

continuous scrolling text, multiple questions

Posted: Fri Apr 26, 2013 1:15 pm
by hyperion007
I have a hard time getting to grips how I should make a String scroll back and forth on a LCD display and still be able to let the PIC do other things.

I am using a PIC18F4550 running at 48Mhz with no divide. I want to move the String being displayed on the LCD one step every 100ms

While the text is scrolling I need to be able to send a byte over USB as soon as a button is pressed

Also I need to display a number on the second line of the display and it is interrupt driven from an optical encoder so it has to be able to change quickly without noticeable delays.


I would like to do all this with just one PIC but I guess if I have to I can use more than one PIC and somehow have them communicate with each other.

Re: continuous scrolling text, multiple questions

Posted: Fri Apr 26, 2013 3:27 pm
by Benj
Hello,

A timer interrupt should sort this all out for you. I will make you an example.

Re: continuous scrolling text, multiple questions

Posted: Fri Apr 26, 2013 3:39 pm
by Benj
Hello,

Here you go this should work ok,
LCD_Timer_Text.fcf
(14.64 KiB) Downloaded 499 times
Edit spotted a bug in the timer interrupt macro.

The idx = idx + 1 calculation icon should be before the idx >= length decision icon rather then after. The program should then work correctly when restarting the line of text.

The program could be made better by having a lead in as well so the string scrolls in rather then just appearing and then the first character is almost immediately gone. If you need help making it do this then give me a shout. Simple way to do this is to padd your strings with leading spaces but is a bit wasteful.

Re: continuous scrolling text, multiple questions

Posted: Fri Apr 26, 2013 4:06 pm
by hyperion007
Thanks Ben!

Is there a way to only scroll one line of a LCD?
I would like to have "Volume: XXdB" on line 0 and "Artist - Title" scrolling on line 1

Re: continuous scrolling text, multiple questions

Posted: Fri Apr 26, 2013 4:56 pm
by Benj
Hello,

I'm only scrolling 1 line in the current example, Print whatever you like to line 2 and it will remain fixed in place.

Re: continuous scrolling text, multiple questions

Posted: Sat May 10, 2014 5:41 pm
by JensS
Benj wrote:The program could be made better by having a lead in as well so the string scrolls in rather then just appearing and then the first character is almost immediately gone. If you need help making it do this then give me a shout. Simple way to do this is to padd your strings with leading spaces but is a bit wasteful.
I'm already searching after the solution without adding extra spaces, but i can't get it working.