Page 1 of 1

2 x16 lcd

Posted: Mon Aug 19, 2013 10:08 pm
by siliconchip
hi all when using a 2 x 16 lcd is it possible to have a caption something like for example " hello world " staying fixed on the top line while scrolling a seperate caption along the bottom line ?

thanks in advance

Re: 2 x16 lcd

Posted: Mon Aug 19, 2013 11:37 pm
by medelec35
Hi siliconchip,
There maybe an easier way, but right now I cant think of it.
So here is one version with adjustable speed delay
You did not state scroll direction, speed or haw many chars to scoll so I just made it up to show it can be done.
It maybe worth trying a different method e.g clear top line, scroll message by 1 then cursor 0,0 print Hello World etc.
Two ideas are better then none.

Martin

Re: 2 x16 lcd

Posted: Tue Aug 20, 2013 9:45 am
by medelec35
Here is an improved version.
It has the advantage of the scroll message can be any length within reason.
In this one I have limit the total scroll length to 50 Characters.
If you want it longer or shorter then you will need to edit total arrays for both.
ScrollString
and
FixedScrollString
Variables.

You you need to do is edit FixedScrollString Variable with any message from 1 to 50 characters then compile to target device.
whole of the message should then scroll on the bottom row of LCD
I would use V2 instead of Flowchart on the above post.

Hmm got me thinking.
Could come in handy for a menu system on a 2 X 16 LCD.
Scrolling all the options
Press # to Enter, * to clear etc
What I'm thinking of doing is using the keypad or RS232 terminal program to enable the user to Enter a message on the lower line, as I have created a flowchart that allows text entry via a numeric keypad.
Perhaps the upper line fixed with time and date?

I will work on this, then post in Programming Tips & Tricks

Martin

Re: 2 x16 lcd

Posted: Tue Aug 20, 2013 9:31 pm
by siliconchip
hi martin as always thanks for your input the program you attached works great and has given me something to work with thank you

Re: 2 x16 lcd

Posted: Tue Aug 20, 2013 10:55 pm
by medelec35
Hi Bob,
your welcome and thanks.
responses may be a bit slow as away for a few days holiday.
Currently typing from my laptop in a b&b :lol:
You mentioned in a pm about out breaking out of a loop.
Are you ok with that or need some help?

martin

Re: 2 x16 lcd

Posted: Wed Aug 21, 2013 8:31 am
by siliconchip
hi martin
i would be most interested on being shown how to break out of a loop

Re: 2 x16 lcd

Posted: Wed Aug 21, 2013 9:15 am
by medelec35
At what point would you want to break out of the loop. E.g when a switch changes state oe a variable reaches a certain value.
Or when last letter of message dissappears.
Then when broken out what do you want to happen?
Can you give as much detail as possibe please.

Re: 2 x16 lcd

Posted: Wed Aug 21, 2013 7:16 pm
by Spanish_dude
You can set a condition to your while loop.
Right now, the while loop in Martin's "Scroll one line V2.fcf" code is always true: while (1);

You can change that to a condition by clicking on the while loop icon and setting a condition.
For example, you could get out of the loop when the text finishes scrolling. To do this change the while loop condition to: "reverse <> 1 OR count <> 0" (without quotes).
Edit: The "<>" means "not equal".

First thing when entering the loop, variables reverse = 0 and count = 0 which makes the condition true (condition : true OR false = true).
Whenever count reaches 16, the reverse variable is set to 1 and the count variable set to "LengthScrollString-1", thus making the condition still true (condition : false OR true = true).

Now the program counts backwards from LengthScrollString - 1 to 0. Whenever the variable count gets to 0, the condition will be false (condition: false OR false = false) and you'll get out of the loop, thus ending the program.

Try it out !

- Nicolas

Re: 2 x16 lcd

Posted: Wed Aug 21, 2013 8:58 pm
by siliconchip
hi martin and Spanish_dude I have included the "scroll 0ne line v2" flowchart and changed it using loops and getting rid of the decisions, how would I incorporate a switch so that at any point of the loops I could stop the scrolling at any point and say light a LED for 5 seconds then revert back to scrolling for instance, im guessing after reading Spanish_dudes comments that this would involve comments in the loop or loops ???

Re: 2 x16 lcd

Posted: Wed Aug 21, 2013 11:05 pm
by medelec35
Hi Bob,
I don't mind you altering any code I post as that will help with the learning process.
However I reverted back to decisions branches since that means icons used to break out.
I have posted two flowcharts that should switch LED on for 5 seconds then back off again.
With the flowchart that uses timer interrupt it should be noted that stimulation time is far greater than real time (unless using V6, as simulation time is greatly reduced).
Also with int the scrolling message can continue for LED on duration.

These flowcharts can be taken a stage further by using port or int type interrupt for triggering breakout, but one step at a time.

Re: 2 x16 lcd

Posted: Thu Aug 22, 2013 1:09 pm
by siliconchip
hi martin I did experiment using a decision to break away from the scrolling but was wondering if and how to break out of the loops I had added to your code, would be interested in knowing about int type interrupt as well

Re: 2 x16 lcd

Posted: Mon Sep 30, 2013 7:23 am
by medelec35
Hi Bob,
Sorry missed the post above.
Is the using interrupt to break out, something your still interested in?

Re: 2 x16 lcd

Posted: Mon Sep 30, 2013 1:23 pm
by siliconchip
hi martin,
yes im still interested, for me its all part of the learning curve :D

Re: 2 x16 lcd

Posted: Sat Oct 05, 2013 2:31 pm
by medelec35
Hi Bob,
Do you want to stop scrolling and light LED for 5 seconds, then continue scrolling.
Or allow scrolling to continue and light LED for 5 seconds?

For using an interrupt to break out of a loop see flowchart posted:
http://www.matrixmultimedia.com/mmforum ... 985#p52405

Re: 2 x16 lcd

Posted: Sat Oct 05, 2013 8:27 pm
by siliconchip
hi martin,
would I be greedy in saying both :)

Re: 2 x16 lcd

Posted: Sat Oct 05, 2013 11:30 pm
by medelec35
Hi Bob, not a problem.
For Scrolling to continue and light LED for 5 seconds, its 'Scroll one line V3 time int.fcf' in the post above.
For stop scrolling and light LED for 5 seconds, then continue scrolling its attached flowchart, which also uses port B IOC (Interrupt On Change)

If you require any other message to be temporarily displayed for the message paused 5 sec duration, then let me know and I can modify flowchart to do that for you.

Martin

Re: 2 x16 lcd

Posted: Sun Oct 06, 2013 7:58 pm
by siliconchip
hi martin
thanks for the flowcharts, the one that does it for me is 'Scroll one line V3 time int, I shall dissect it to gain some under standing thanks