LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI not responding to Stop button

Solved!
Go to solution

Hello! I'm having some trouble stopping my VI with my stop button on the front panel.  I thought that I had wired my "whole VI" stop button to every possible while loop, but when I press the button the VI continues as if nothing had changed.  I realize the VI is kinda big, but if anyone has a free moment and could look it over, I would REALLY appreciate it.  It's attached.  I just need to know why my "Quit Program" button (on the far left of the VI) isn't stopping the program.  Thanks ahead of time for the help.

 

Matt

0 Kudos
Message 1 of 7
(4,365 Views)
Solution
Accepted by McMurray

Your stop button terminal is outside the loops, and thus will only get read once at the beginning of the program. The terminal needs to be in the innermost loop so it gets read with each iteration. (use a local varaible if needed).

 

0 Kudos
Message 2 of 7
(4,362 Views)
With nested while loops the out while loop will not iterate until all of its inner while loops have stopped.  Because your "Global Stop" lives in the top while loop it will not execute until one iteration (of the top loop) after it is pressed.  But the top loop cannot iterate until the inner loops stop, the inner loops cannot stop until until they recieve the stop command from the "Global Stop", and the "Global Stop" cannot be sent until after the top loop iterates...  This is the problem.  Have you considered using a case driven state machine for this application, it would be the best way to solve your problem (plus it would get rid of the flat sequence structure and your local variables).
0 Kudos
Message 3 of 7
(4,359 Views)

Looking at your VI, you should really refactor it from scratch as a simple state machine with a max of 2 parallel loops that fit on a single screen

 

You have while loops stacked knee-deep everywhere!

 

  • Use dataflow instead of sequences.
  • Don't operate on paths as strings.
  • It looks like the VI is unresponsive during many parts of the execution. a 30second wait in an inner loop seems out of place.
  • Your upper while loop uses 100% CPU while doing nothing until start is pressed.
  • ...

 

 

You clearly have some serious misconceptions about the nature of dataflow. Run your VI in execution highlithing mode to see what's (not)  happening on the diagram when you press quit.

Message 4 of 7
(4,355 Views)

I know, I know....  It's really really messy.  I have no excuses; I'm lousy at this.  It's not my job and I'm not a programmer by any definintion.  I'm actually a psychology graduate student, trying really hard to make my hardware work with minimal effort, and no money.  Thanks for the help.  The global variable worked like a charm.

 

Matt

0 Kudos
Message 5 of 7
(4,350 Views)

my stop button is not working..when i press my stop  button it doesn't stop my program.... ihave not used multiple of while loops... i have one while loop, event structure and some case structure in my program...so can u plz tell me the solution of dis?? rply asap

 

0 Kudos
Message 6 of 7
(3,780 Views)

Hi thakurshubh,

 

you already have been told to create your own thread, but you keep highjacking old, outdated and unrelated threads…

 

CREATE YOUR OWN THREAD!

(And attach your VI instead of just describing your problems.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(3,769 Views)