LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I detect if a VI is aborted?

Is there a way to detect if a vi has been aborted and have it execute a command if so? Here is the scenario. I am running an app that sets a watchdog timer once a second with a 30 second timeout(this is the max the watchdog timer can be set to). This app loadsautomatically at system starup.The computer running the app(Windows NT 4.0) is connected to a smart signaling UPS. When the UPS is low, it signals windows to shut down, thereby closing the application. However, this does not let me shut down the watchdog timer. So I get a system shutdown, then a reboot 30 seconds later(due to the watchdog), then the UPS shuts down while the computer is rebooting. Therefore, I need to be able to shut down the watchdog timer if the app is killed. Si
nce Cin nodes allow an OnAbort function, I was wondering if this is natively supported in Labview without using a Cin. The application running on the target machine is a compiled executable. I am using Labview 6.0.2 but have 6.1 available if this feature is newly implemented.
0 Kudos
Message 1 of 6
(3,497 Views)
Find attached example. I think that my watchdog implementation is different but it's the same regarding the way you check if main application is still running. Therefore, I assumed that the watchdog will "get" an invalid signal while main application is not "working properly".

In a similar manner you can use Windows API to search for main app's window. Let me know if you need details.

Hope this helps
Download All
0 Kudos
Message 2 of 6
(3,497 Views)
I appreciate your help. Unfortunately this is not exactly what I am looking for. Here are some further clarifications. THe watchdog timer is a hardware watchdog timer. Once turned on, it expects to receive a signal from my apllication at least every 30 seconds, or the machine will reboot. This is accomplished by using OutPort and writing to a certain memeory address. The issue that I'm having, is that when my app is terminated by windows, I need to be able to send it another command in order to turn it off.
0 Kudos
Message 3 of 6
(3,497 Views)
In this case you may want to consider some event-driven environment like Visual Basic, where you can use the "Unload" event to perform a last command.
I attached an executable (made in VB) that shows you a message when Windows tries to close it.

Let me know if it's working
0 Kudos
Message 5 of 6
(3,497 Views)
Actually, upgrading to Labview 6.1 solved the issue. I was able to use the event structure to execute a command upon the application being told to close.
0 Kudos
Message 6 of 6
(3,497 Views)
With the new Event Structure in 6.1, you can capture the Application Exiting and/or the Panel Closing event. If you 'capture' one of these events you might be able to execute a function/command before LabVIEW closes.

Chris_Mitchell
Product Development Engineer
Certified LabVIEW Architect

Message 4 of 6
(3,497 Views)