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.
continuous scrolling text, multiple questions
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- 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
Hello,
A timer interrupt should sort this all out for you. I will make you an example.
A timer interrupt should sort this all out for you. I will make you an example.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- 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
Hello,
Here you go this should work ok,
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.
Here you go this should work ok,
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- 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
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
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
- 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
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.
I'm only scrolling 1 line in the current example, Print whatever you like to line 2 and it will remain fixed in place.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: continuous scrolling text, multiple questions
I'm already searching after the solution without adding extra spaces, but i can't get it working.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.