LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do exit a program just by pressing a stop button

Hi me newbie,
I want to exit my labview program immediately regardless whether is it still running or not? Is it possible?Please help me thanks you..
0 Kudos
Message 1 of 7
(4,930 Views)

@keeper wrote:
Hi me newbie,
I want to exit my labview program immediately regardless whether is it still running or not? Is it possible?Please help me thanks you..




Ahh, a weird idea : how to exit even a not-running program ?
I suppose that you have read the "Getting started" LV manual ? If not, try to get a bit more familiar with LabVIEW. There are hundreds of examples shipped with LV.

The options exposed below are answers to questions that you didn't ask explicitely, such as "how to stop a running vi when I can't access its front panel window ?", or "How to stop a vi stuck in an infinitely-running loop ?"
Such situations arise frequently during application development.

Possible solutions :

1/ include a separate while loop in the program, running in parallel, with a boolean "Stop" control wired to a Stop function (found in the "Application Control" sub-palette). This will stop the vi, regardless of what's going on in the other parts. Don't forget to put a "Wait" function, with a reasonable delay (300 ms) in the loop to leave some time to other processes;
2/ same, using the "Exit LabVIEW" function. The effect is more drastic, but this as an advantage over the previous option : it can be used in a separate vi. BTW, it works also on non-running vis !
3/ more sophisticated, the attached tool stops all running vi's. It scans and abort all the vis in memory. Should stay on your deskstop, to be launched at will, since this is sometimes the only solution to stop a fool vi without loosing all your work !
4/ Unplug the computer, or remove the battery.

I believe that solution 4 is the most effective REVERSIBLE solution, since it works even when LabVIEW is not running.
If you accept also irreversible solutions, I have a lot of innovative ideas, using steamrollers, flamethrowers...

CC 😄
Chilly Charly    (aka CC)
Message 2 of 7
(4,908 Views)
I have chosen yr first choice it think it is that way if i am not wrong but when i implement it in my project it cant stop my project ...the thing is that i want it to run when open
0 Kudos
Message 3 of 7
(4,904 Views)
Two big mistakes in your vi :
1/ The stop button in not inside a loop. Means that it will be read only once, at start time, then ignored.
2/ Your loops do not have a time delay. Means that they will run full speed, never leaving any time for other processes to run. That's just a waste of power, and you could find your computer apparently blocked. Include in each loop, a Wait function, with a reasonable delay. For a loop dedicated to user interface management, a 200 ms is a correct value. Means that the loop will run 5 times per sec.

Apart these HUGE mistakes, your vi is poorly structured : Too many parallel loops, that could be gathered in a single loop for user interface management.

CC
Chilly Charly    (aka CC)
0 Kudos
Message 4 of 7
(4,897 Views)
I agree with Chilly Charly that you should reduce the number of parallel while loops. There is no reason that all of these things should be running in separate loops. Your diagram is very hard to follow. You have wires running under controls/indicators and running in the wrong direction (they should go left to right). If you'll put the stop button in your single user interface loop with an appropriate wait time included everything should work properly.
0 Kudos
Message 5 of 7
(4,892 Views)
Hi,
Thanks alot guys both of you do me a big flavour as i m still a super newbie therefore alot of stuff is still super fresh to me..Thanks you again ..
0 Kudos
Message 6 of 7
(4,876 Views)
Stay connected with this forum. You will learn a lot.
Happy wiring ! 🙂

CC
Chilly Charly    (aka CC)
0 Kudos
Message 7 of 7
(4,868 Views)