10-31-2005 11:36 AM
11-01-2005 02:03 AM
Well, it depends on how often you must check your process during test execution. In any case Delay () is not a good function to use in this case.
If you must pay the maximum attention to the process being executed, you can embed it in a for loop without the Delay (); in the loop you must insert a ProcessSystemEvents () to permit processing of other controls' callbacks so that pressing the Stop button is got. In the Stop button callback you can rise a global flag that is tested in the test loop and causes its end.
In the same approach, you could use a toggle button as the Stop and GetCtrlVal of this button inside the loop (always after a ProcessSystemEvent is called), this way preventing the use of a separate callback and a global variable.
If you can survey the process at a lower degree of detail, you can use a timer fired a few times per second, accumulating into the timer callback eventData2 values (time passed from previous execution of the callback). In this approach, the timer callback could be structured as a state machine based on a global "state" variable that describes what the equipment is doing: idle, ready for test, test execution, test stopping (this last in case some long process is necessary to end the test). In this approach, the system is free to test the stop button without any other action from you; in the stop button callback you must manipulate the global state variable and initiate test stopping.
Hope this helps
Roberto
11-01-2005 11:44 AM
11-02-2005 11:00 AM
To clarify: the Delay function has never processed UI events. The Delay function causes your thread to sleep in chunks of time up until the total time has expired. Internally, it does not call ProcessSystemEvents, or GetUserEvent, or any similar function.
I hope we have never given the impression that CVI callbacks would be called during a call to Delay. To ensure that callbacks would be called, you will have to essentially do a "sleep with GUI" loop as you describe.
Luis
NI
11-02-2005 05:00 PM
11-03-2005 10:38 AM
01-27-2006 12:12 PM
Thanks for the good info.
We happen to have a dual processor hyperthreaded Xeon PC running XP Pro (OS treats as four CPU's). I've noticed that a nominally single-threaded CVI app reports four threads in this situation. Do you know what's happening here? Is the CVI RTE creating a thread for execution on each CPU? Do we know that all the CVI libraries will work properly in such a case?
Hayes
01-27-2006 02:38 PM
01-27-2006 03:01 PM