LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stop button is not working.

Solved!
Go to solution

Hi. How to stop vi using stop button in front panel? I tried using stop button inside while loop but when vi is running and if i press button on front panel the vi will not stop. I have to stop manually. My vi have two event structures. I have even tried quit buton. The button will stay pressed but vi won't stopDoes the program wait till both get executed for the stop button to work.

I have attatched different variation of vi.

Thank you.

Download All
0 Kudos
Message 1 of 7
(5,300 Views)

Hi madara,

your stop button doesn't work, because your Event Structure doesn't have a timeout case and it executes only when the "Insert Step: Value Change" event happens (so it doesn't check whether you pressed the button or not).

So you can either configure a timeout case, or configure another event triggered by the value change the stop button.

 

It is also generally not a good idea to have two Event Structures in one loop, because they will block each other.

0 Kudos
Message 2 of 7
(5,292 Views)

You're emisunderstanding the EVENT structure.

 

Your code says to:

A... Wait on an event.  If it's the INSERT STEP button, do some stuff, else do nothing.

B... Wait on another event.  If it's the OK button, do some stuff, else do nothing.

C... Check the STOP button. if it's ON, stop, else go to A

 

Except it won't necessarily do them in that order.

 

You need to have ONE event structure inside the WHILE loop, and have 3 cases:

INSERT STEP value change

OK value change

STOP value change.

 

Examples should help you out.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 7
(5,284 Views)
Solution
Accepted by topic author madara77

You only need one event structure in your program.  Add an event in it for pressing the quit button and stop your while loop with that even.

Remove the sequence structure.  It is not needed. 

Move your VISA init function outside of the while loop because you only need to do that once. 

Move the VISA close outside the while loop.  You only need to do that once.

Don't EVER use the Exit Labview function. 

aputman
Message 4 of 7
(5,280 Views)

Don't EVER use the Exit Labview function. 

 

I dislike dogmatic statements.  To be clear, the EXIT LABVIEW function does have a clear and valid use.  This isn't it, but it is useful.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 5 of 7
(5,265 Views)

@CoastalMaineBird wrote:

Don't EVER use the Exit Labview function. 

 

I dislike dogmatic statements.  To be clear, the EXIT LABVIEW function does have a clear and valid use.  This isn't it, but it is useful.


Opinions are like noses......Smiley Wink

aputman
0 Kudos
Message 6 of 7
(5,262 Views)

@CoastalMaineBird wrote:

Don't EVER use the Exit Labview function. 

 

I dislike dogmatic statements.  To be clear, the EXIT LABVIEW function does have a clear and valid use.  This isn't it, but it is useful.


On the other hand, the red button to eject the warp core is also useful, and you would probably use it just slightly less than the Stop Sign.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 7
(5,249 Views)