07-03-2012 09:39 AM
I don't fully understand why I need the stop and quit labview vi. When a program finish running, doesn't it stop automatically? Why is the stop vi needed? If vi stops automatically when it is done, couldn't the programmer write the program in such a way that would cause the vi to stop when needed without using the stop vi?
When a program is running in exe, why is quiting labviw needed? Doesn't everything quit at the end of the program? In development, there is really no reason for the developer to want the LabVIEW to quit automatically, right?
Solved! Go to Solution.
07-03-2012 09:44 AM
I want my "exe" to close when finished. If they don't, then the "VI look window" sits there and confuses users ( well some users ).
Personally I don't use quit labview in my development environment.
07-03-2012 10:04 AM
The other option is to simple close the front panel using an invoke node at the end of your program. Here's some good reading material on the subject.
07-03-2012 10:56 AM - edited 07-03-2012 10:57 AM
@jyang72211 wrote:
When a program finish running, doesn't it stop automatically? Why is the stop vi needed?
You never need the stop.vi. Its function is similar to the abort button, unconditionally stopping the VI, even if it is trapped in a parallel loop that cannot be stopped directly due to incorrect coding. Since the current state of other code parts is random when stop is called, the outcome might be very unpredictable and the program might stop without a proper shutdown sequence, leaving your instrument spinning or the hight voltages turned on.
For more details, read the online help. I never use it!
"Quit LabVIEW" has similar problems. You don't really want to use it during development, because, you might have unsaved changes.
My larger applications don't have a stop button, and can only be stopped with the [X] in the upper right corner. (Like any typical program: When was the last time you had to first "stop" internet explorer or MS word? :d) I use a filtering event to catch it, discard it, initiate a clean shutdown, and after everything is done, either stop in the development system or quit labview in the case of a built application (see code image).
07-03-2012 11:08 AM
@altenbach wrote:
My larger applications don't have a stop button, and can only be stopped with the [X] in the upper right corner. (Like any typical program: When was the last time you had to first "stop" internet explorer or MS word? :d) I use a filtering event to catch it, discard it, initiate a clean shutdown, and after everything is done, either stop in the development system or quit labview in the case of a built application (see code image).
Oh good. I'm not the only one. I was jumping for joy when I figured out that trick. Technicians and non-LVers always go for the [x] in order to quit a program. The way the programs were written, all that did was close the front panel, The VI was still running. And you couldn't see the stop button anymore either. So when I discovered the filter event, I shocked some programmers because they couldn't figure out how to stop the program.
The only difference I do from Altenbach is that I use the conditional disable structure instead of the property node and case structure.
05-09-2016 09:14 PM
05-09-2016 09:18 PM
05-09-2016 09:33 PM
Think of subVIs as functions. They should be quick calls you make to help the main VI. If you're working to find ways to abort these, you're making your overall architecture more complex than it needs to be.
The Property Node you reference just tells the program running if it is in the development environment or if it has been compiled into an executable. While closing out LV makes sense in an executable, it's pretty annoying to debug a VI that closes out LV after each execution. You should start with googling "Learn LabVIEW in 3 hours" before trying to jump into these examples. You'll set yourself up a bit better for success.
05-09-2016 09:46 PM
05-09-2016 09:57 PM
@blessedk wrote:
2. Second question was to find out how to "interrupt" a program ( not stop the loop or exit the program (
And it does not have to be by stopping Subvis). For example let's say I am running a SubVi that takes 20 mins to execute and I just realized that I entered a wrong value for one of the controls to that SubVi.
I wouldn't want to wait for 20mins before entering the right value and execute the same SubVi again. -
That would depend on your architecture. If you are using a state machine, it is easier. I have used Queues, Occurances, Notifiers, and User Events to tell a module to abort running of a test.