LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stop a while loop

Hi,

 

I am trying to stop a while loop within a stacked sequence. I am monitoring a voltage every 2 seconds, if the voltage I am moniotring differs in value to the set point voltage, I wish to stop the while loop. I have created a true/false case statement to break the loop but I also wish to be able to stop the loop by pressing a stop button on the front panel

Can anyone help with this problem??  

0 Kudos
Message 1 of 7
(3,312 Views)

We need to see the entire vi, not a picture of it.

0 Kudos
Message 2 of 7
(3,305 Views)

Your code looks confusing.  I couldn't understand what you are saying from just a picture.  But just from your description, it sounds like you just need to add a stop button and use some simple boolean logic to the loop termination node.  I'm thinking NOT(stop button) AND (monitor result) to keep with your Continue if TRUE setup.



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 3 of 7
(3,300 Views)

Mrrf...

Crossrulz beat me to it...

0 Kudos
Message 4 of 7
(3,295 Views)

What's the significance of the code on the left and the code on the right?

Why are none of your terminals connected to anything??

What do the event structures do? Does the front panel accept inputs if the events are executing?

 

Typically, you would set a loop condition to "stop if true", because it is conceptually simpler. Now you simply OR the two stop conditions and the loop will terminate if any of the conditions are met.

 

In any case, we really need to see the code, because ther could be quite a few surprises. Seems to suffer from severe localitis and sequenceitis.

 

0 Kudos
Message 5 of 7
(3,287 Views)

Sorry guys.. Here is the Vi I have been working on..

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

As suspected, your event is configured to lock the front panel until the event completes, meaning the button cannot be read while the event executes. You have a deadlock! Change that!

 

You should also use "stop if true" if you want to stop when the button is pressed. (The upper boolean gymnastics is pure gibberish. Why are you building and empty array from a single scalar followed by "or array elements"?? What do you expect as outcome 🐵

 

Also notice that the small loop on the lower left uses 99.9% of the CPU at all times.

0 Kudos
Message 7 of 7
(3,276 Views)