Help needed on Hour-meter
Hi
How do you encorperate an hour meter in spin code? I just want to be able to keep track of the minutes and hours while powered on and display it to an LCD screen. I know how to display it. But I do not know how to set up the variables to count the minutes or hours while running.
Dermot
How do you encorperate an hour meter in spin code? I just want to be able to keep track of the minutes and hours while powered on and display it to an LCD screen. I know how to display it. But I do not know how to set up the variables to count the minutes or hours while running.
Dermot

Comments
VAR BYTE seconds, minutes, hours WORD days ' 179 years PUB Clock | wait wait := cnt REPEAT ' repeat forever waitcnt(wait += clkfreq) seconds++ IF (seconds => 60) seconds~ minutes++ IF (minutes => 60) minutes~ hours++ IF (hours => 24) hours~ days++If you want to do code that counts time without making a cog exclusive to counting time (integrating it into an existing loop)...I have code for that too, but this one is simpler to implement.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
Post Edited (Bobb Fwed) : 8/31/2009 4:30:21 PM GMT