04-17-2009 01:33 PM
I am looking for a method of killing off an event thread once it is in the middle of executing. A description of my problem is below (I am using labview 8.2).
My main VI is reading my DAQ and constantly updating the main control panel with the data and logging the data at operator defined rates.
The user can then select different functions for the system to execute using an enumeration and a Boolean control.
When the user selects the Boolean control (run button) an event is triggered, the ENUM is read, and various sub-vi's execute to complete the function (none of the sub-vis have visible control panels all of them use some of the data from the main vi's controls/indicators passed by reference).
The user also has a stop button. If pressed another event is generated. I would like to kill the run event in this case, at any point in its execution (long delays in some of the sub-vi's). Then I can set the system back to default and continue on selecting another function in the enumeration and run button press.
I would also considering aborting the main vi and then restarting it as long as the front panel remains open.
04-18-2009 02:23 AM
You can not kill an event.
It must be finished before another can be executed.
One solution to your problem: Wire the Reference of the Stop button to all your subvis and continuously read it's state.
If it is false then stop executing and immediately stop the subvis
You must uncheck the "Lock front panel until event ends" option to work this
04-20-2009 09:09 AM
I appreciate the reply. I agree that the event cannot be killed, I have tried several "tricks". The code does go into the stop event while the run event/sub vi is executing.
I had the ref to the stop button wired into the sub-vi's already. Some of these vi's are fairly in depth, do you have a recommendation to continuously read its state without getting into every loop etc that is in the sub-vi? I was trying not to monitor this buttons state at every point in the sub-vi's block diagrams.
Thanks
04-21-2009 12:11 PM
You have to monitor something. The easiest way is to monitor a boolean.
Another approach is to register an event in your sub vi, for a value change, of the stop button of the main vi.
Then you have an event base program.