11-11-2008 09:26 PM
Hi, everyone
I want to do a function as:
When I press a button, the timer count will be set to zero.
I do a program, but when I press a button, the timer count doesn't set to zero.
Could someone help me to slove this question?
Thank you!
11-12-2008 01:49 AM
ResetTimer only resets the scheduling interval for the specified timer but does not influences its count.
I suggest you to use eventData parameters on the timer callback: eventData1 holds the total time from program start, while eventData2 holds the time from the previous call of the timer callback, so you can accumulate it on the time value to show the time count. To reset this time you can simply force previous value to zero. I'm attaching a modified copy of your project to show you this solution.
BTW, this mechanism will survive if you want to switch in the future to asyncronous timer, since their callback is structured in the exact same way as standard UIR callback.