2 x16 lcd

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

2 x16 lcd

Post 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

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: 2 x16 lcd

Post 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
Attachments
Scroll one line.fcf
(12.32 KiB) Downloaded 409 times
Martin

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: 2 x16 lcd

Post 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
Attachments
Scroll one line V2.fcf
(12.94 KiB) Downloaded 445 times
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: 2 x16 lcd

Post 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

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: 2 x16 lcd

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

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: 2 x16 lcd

Post by siliconchip »

hi martin
i would be most interested on being shown how to break out of a loop

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: 2 x16 lcd

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

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times
Contact:

Re: 2 x16 lcd

Post 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

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: 2 x16 lcd

Post 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 ???
Attachments
modified Scroll one line V2.fcf
(11 KiB) Downloaded 372 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: 2 x16 lcd

Post 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.
Attachments
Scroll one line V3 no time int.fcf
(16 KiB) Downloaded 396 times
Scroll one line V3 time int.fcf
(18.31 KiB) Downloaded 392 times
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: 2 x16 lcd

Post 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

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: 2 x16 lcd

Post by medelec35 »

Hi Bob,
Sorry missed the post above.
Is the using interrupt to break out, something your still interested in?
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: 2 x16 lcd

Post by siliconchip »

hi martin,
yes im still interested, for me its all part of the learning curve :D

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: 2 x16 lcd

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

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: 2 x16 lcd

Post by siliconchip »

hi martin,
would I be greedy in saying both :)

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: 2 x16 lcd

Post 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
Attachments
Scroll one line V3 time and IOC int .fcf
(21.02 KiB) Downloaded 328 times
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: 2 x16 lcd

Post 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

Post Reply