LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I stop a while loop

Right click on the event structure, case [1].  Select - Edit Events Handled By This Case.  In the pop up window, select Stop3 on the left side, and Value Change on the right side.  What you did here was to define what this event case will react to.  In your vi, the event case was not defined.  See attached vi.

Message Edited by tbob on 09-12-2005 11:59 AM

- tbob

Inventor of the WORM Global
0 Kudos
Message 11 of 18
(2,135 Views)


@aurelia wrote:
Thank you very much. I made some changes to loop MOD. In loop 2 there is a continue if true linked to a true / false. I need loop 2 to stop when I stop loop1. However, I have a message error for event structure and event data node. Do you know what I did wrong? Thanks again


You need a "stop if true" in loop 2 or it will terminate right away after one iteration, right? You deleted the stop button that was linked to the event and added a new button. You need to reassign the event to the new button as mentioned by tbob.
 
Remember, you can always click the broken run button and you'll get a detailed explanation of all errors. It will help you find the problem easily. 🙂
 
0 Kudos
Message 12 of 18
(2,218 Views)
Thank you very much. My program looks actually like the one in attachment. In the main loop I have a "continue if true". In this case, do I have to select stop3 on the left side and value change on the right? Also do I have to do it for loop 1 and 3? Thanks again
0 Kudos
Message 13 of 18
(2,108 Views)
..since getting 7.1, I have gone giddy replacing my While loops with the new sychro timed loops.  Besides being able to prioritize and stagger multi-loop apps, the fact that each loop has a name, and can be stopped from elsewhere (ie another loop) gets rid of all that stop button local-vs-queue stuff.  I save my queues and/or notifiers for actual communication, instead of monitoring their error status to close other loops.  The fact that each loop also has access and can change its own timing info, as well as know how itself dies is icing on the cake.  Nice upgrade, NI....
0 Kudos
Message 14 of 18
(2,104 Views)
(Loop 2) Well, you "logical AND" your stop button with a TRUE diagram constant, which just returns the state of the stop button, then you invert the output. It is unecessarliy complex to do all this boolean gymnastics! Just wire the button straight to the termination terminal and set it to "stop if true". Same difference, but MUCH easier to read and debug.
 
Loop 1 and loop 3 have a data dependency via the error cluster, thus loop 3 cannot start unless loop 1 terminates. Since at this point, the stop button has been pressed, loop 3 will terminate immediately. It will never spin more than once!
 
Your code is very confusing and makes little sense from a practical point of view. Could you explain in more general terms what you actually are trying to achieve?
 
Yes, both event structures should have a value change event for "stop 2". Loop 2 does not need it, because it reads the button directly.
 
Run your VI with execution highlighting enabled, it might help you understand dataflow better. 🙂
 
0 Kudos
Message 15 of 18
(2,104 Views)
The program is actually more complicated. I put it in attachment. In the stacked sequence structure there are two true/false loops. When the stacked sequence structure is in 0 and both case structures are False, we can see one big while loop (with a continue if true condition) runing in parallele with 3 linked while loops. I would like to be able to stop the program (i.e go to stacked sequence structure
1) when I stop the big while loop. Thanks again
0 Kudos
Message 16 of 18
(2,091 Views)

Forgive me but I came across this post while trying find out how to stop two parallel loops.

I am wondering why there is an empty sequence block attached to the beginning of the first loop. What happens if this is not there?

 

Jeff

0 Kudos
Message 17 of 18
(1,962 Views)

Hello Jeff,

It looks like its just an empty case structure and does absolutely nothing.  It is just there to provide a place to put an initialization VI to set up the processes that are running inside of the loops.  Normally the VI that sets everything up will have an error cluster out to let the loops know if there was an error in initializing.  Since the error cluster wire will go from the first VI to the first while loop, there really isn't much need for a sequence structure there.  I hope this explains things a little better for you.  I would recommend checking out the LabVIEW 3 hour tutorial and 6 hour tutorial if you get a chance.

I hope this helps.

Steven T.

0 Kudos
Message 18 of 18
(1,929 Views)