LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to reset Timer to Zero ?

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!   

 http://d.99081.com/a710756/Timer Test.rar

0 Kudos
Message 1 of 2
(2,908 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 2
(2,893 Views)