LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can i terminate a labview program programatically based on certain conditions

How can i terminate my labview program after checking certain conditions. Like in Java we have
System.exit(0) command, or in C/C++ we have exit(0) to terminate.
0 Kudos
Message 1 of 5
(6,014 Views)
On the Application Control palette you have two functions - Stop, and Quit LabVIEW. I always use the Quit LabVIEW function in built apps along with the property node Application:Kind. If it's "Run Time System" the VI stops and exits. Doing it this way, I don't have to worry about exiting LabVIEW during debug.
Message 2 of 5
(6,014 Views)
can you explain it further. I didnt understand. I dont want to quit during debug. I want to quit while user is giving inputs and the program is executing. Like if user gives me an empty list of files I want to quit the Labview program (its not a stand alone application, it still requires labview to run) right there rather than going ahead and getting other information and then the program ending on its own because it didnt have anything to process.
I hope I am conveying myself clearly.

Thanks,
0 Kudos
Message 3 of 5
(6,014 Views)
The Stop function I mentioned operates the same way as the front panel abort button but you have to use it correctly. You have to design your program to properly terminate on an error condition. If you use a state machine architecture, on an error do whatever cleanup is necessary like closing files and references first and then terminate the while loop. If you have a series of VIs connected by the error in/out clusters, you could surround the code by a case statement. Only if there is no error in would it get executed. Some types of LabVIEW code are difficult to exit prematurely like a sequence structure or a for loop. If you posted an example of your program, I or someone use could get a little more specific. There's also a lot of examples
on user interface programming that you might want to look at. Check the shipping examples and the development library at NI's Developer Zone.
0 Kudos
Message 4 of 5
(6,014 Views)
Try this VI...




Copyright © 2004-2024 Christopher G. Relf. Some Rights Reserved. This posting is licensed under a Creative Commons Attribution 4.0 License.
Message 5 of 5
(6,014 Views)