continuous scrolling text, multiple questions

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

continuous scrolling text, multiple questions

Post 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.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: continuous scrolling text, multiple questions

Post by Benj »

Hello,

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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: continuous scrolling text, multiple questions

Post 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.

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

Re: continuous scrolling text, multiple questions

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: continuous scrolling text, multiple questions

Post 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.

JensS
Posts: 4
Joined: Tue Jan 14, 2014 6:27 pm

Re: continuous scrolling text, multiple questions

Post 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.

Post Reply