08-09-2017 08:47 AM
Hello,
I want to set all controls and indicators to zero just before aborting execution.
Regards,
08-09-2017 08:58 AM
You can use the 'Reinitialize to default' method of the VI class.
08-09-2017 09:06 AM
08-09-2017 09:15 AM
How do you know when you are aborting your program?
Normally I stop or exit an application, never abort.
08-09-2017 11:57 AM - edited 08-09-2017 11:58 AM
I don't understand why you would need to do this. Perhaps if you shared the reason why you want to do this, we might be able to suggest a better way to accomplish it... 🙂
08-09-2017 01:30 PM
Because I am controlling a voltage using labview. I want the voltage going back to zero when the user stops the vi.
08-09-2017 02:10 PM
Hi idir,
why do you want to set controls to zero - instead of setting the voltage output to zero???
(Why do you need to clear indicators too?)
Using a proper state machine might help, but even a simple DAQmxWrite after your main loop could be sufficient...
08-09-2017 02:32 PM - edited 08-09-2017 02:32 PM
Don't allow the VI to be aborted. Code cannot predict when an abort will happen, and once the VI is aborted, it is too late to do something about it.
Create a conditional event for "panel close?", discard it, and initiate the shutdown code instead. After this has completed, have the VI stop itself normally by simply running out of code. 😄 Let us know if you need help with that. Maybe show us your code.
08-09-2017 11:38 PM - edited 08-09-2017 11:39 PM
Share the VI/Code Snippet for better suggestions,
Aborting an Application will end up in Problem mainly when interfacing with hardware so to make hardware idle. Handle the Shutdown case properly (As Suggested by others) by Setting the voltage level as expected before quieting the application.