Page 1 of 1

24 hour clock issue

Posted: Mon Apr 06, 2009 7:01 am
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

Re: 24 hour clock issue

Posted: Mon Apr 06, 2009 9:22 am
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)

Re: 24 hour clock issue

Posted: Mon Apr 06, 2009 11:23 am
by ianyork
thanks steve i shall give that a try this evening!

anyone able to help for the input control side??

Re: 24 hour clock issue

Posted: Sat Apr 11, 2009 1:58 pm
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

Re: 24 hour clock issue

Posted: Mon Apr 13, 2009 8:59 pm
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.

Re: 24 hour clock issue

Posted: Tue Apr 14, 2009 4:27 pm
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)