LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stop and Quit LabVIEW Vi

Solved!
Go to solution

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?

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 33
(12,978 Views)

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.

-------
Mark Ramsdale
-------
Message 2 of 33
(12,973 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 33
(12,965 Views)
Solution
Accepted by topic author jyang72211

@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).

 

 

Message 4 of 33
(12,953 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 33
(12,947 Views)
I am interested in this discussion and would be glad to have some more explanation.

Please bear with me as I am new to LABVIEW.

My objective is to be able to stop and exit Labview in a built application by clicking on a Boolean button on my front panel.

Looking at the way Altenbach did it it looks to me like a this Boolean control will have to be placed inside the event structure and the value change will send a "true" to the while loop conditional button as well as the "EXIT" inside the case structure. ( Am I right? )

What is this App.kind property node and what does it do please. Where was it gotten from?

[BADGE NAME]

0 Kudos
Message 6 of 33
(11,465 Views)
Also how do I interrupt an execution ( just like stopping a running SubVi ) but not stopping or exiting the main vi

[BADGE NAME]

0 Kudos
Message 7 of 33
(11,462 Views)

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.

0 Kudos
Message 8 of 33
(11,456 Views)
1. First part of my question was confirming if there should be a Boolean control inside the event structure that Altenbach provided.

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. -

[BADGE NAME]

0 Kudos
Message 9 of 33
(11,450 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 33
(11,446 Views)