LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

i need to run some functions continuosly using a ring control and command button.i need to do it using the timer controlto set for the time the user has specified.

the functions selected has to run continuously for the time specified by the user.i need to user ytimer control.how to set the start time and end time parameters in it.
0 Kudos
Message 1 of 2
(2,464 Views)
You can use a timer control.
Look at the CVI help topic "Programming with Timer Controls" and the timer.prj sample project.
Set the timer interval (ATTR_INTERVAL) based on user input using SetCtrlAttribute.
In a callback function for the timer, on EVENT_TIMER_TICK, set a global true, e.g. bStopFunction = 1.
In each function (or in the loop that calls the function), check the global, bStopFunction. If bStopFunction is true, gracefully end the function (or loop). If the continuous run is not programmed by a loop, you need to periodically check the global.
When the user presses the command button, set the bStopFunction global false (bStopFunction = 0), call ResetTimer() and SetCtrlAttribute to enable the timer (ATTR_ENABLED). Then start your (continuous) function.
0 Kudos
Message 2 of 2
(2,464 Views)