24 hour clock issue

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
ianyork
Posts: 4
Joined: Thu Mar 26, 2009 12:55 pm

24 hour clock issue

Post by ianyork »

morning all,

having a few issues which im hoping i could get some assistance with.

ive managed to get the clock to display on a LCD display, however i notice that when the timer cycles through the second digit remains at "9" and does not clear and i cant get the units to display as "09" etc (for example, the time shown is 1:19:19, but it should be 1:1:1)

my question is how can i get the timing units to display in double units ie 01:01:01 and would this resolve the issue im having?

in addition to this i am having a few difficulties creating the necessary inputs to allow the time to be changed. i am wanting to have A0 as the config button (ie 1 pressed, hours can be set, 2 presses, minutes can be set etc) with A1 and A2 being used to set the times up and down.

hope the above makes sense and someone can help as programming isnt my strong point!

cheers

ian

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: 24 hour clock issue

Post by Steve »

When you display a number, add a decision and if the number is less that 10 you should first display a leading zero. Something like this:

Code: Select all

DECISION: If X < 10
  Output '0' to LCD (using PrintASCII macro)
END DECISION
Output X to LCD (using PrintNumber macro)

ianyork
Posts: 4
Joined: Thu Mar 26, 2009 12:55 pm

Re: 24 hour clock issue

Post by ianyork »

thanks steve i shall give that a try this evening!

anyone able to help for the input control side??

ianyork
Posts: 4
Joined: Thu Mar 26, 2009 12:55 pm

Re: 24 hour clock issue

Post by ianyork »

afternoon steve,

im still having abit of difficulty, if figured the input side out so im happy with that, its just this display problem.

do i need to put the decision within the counter or where i call up the display? ive tried both ways i think your trying to tell me and all it does is shift over by one to the right (only tried the seconds so far) and carries on counting?

this is what i have so far

any help is greatly appreciated.

ian
Attachments
configurable digital clockv2.fcf - Main.JPG
(124.11 KiB) Downloaded 1333 times

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: 24 hour clock issue

Post by Benj »

Hello Ian

I would put the decision right at the bottom before your call to print the seconds variable as a number on the LCD.

Decision Icon - Second_var < 10

Yes - Print Number 0
No - Nothing

Then after the decision print the seconds variable as usual.

You should be able to repeat this for minutes and hours without changing any of the main part of your program.

ianyork
Posts: 4
Joined: Thu Mar 26, 2009 12:55 pm

Re: 24 hour clock issue

Post by ianyork »

TOP BANANA!

thank you very much ben, first program down, 4 more to go

(this is the first working program i have written using flowcode)

Post Reply