LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

conditional loops (while loops)

I am using a while loop to check a digital input. I would like to send the value to a true or false box to check another digital input. The problem is that the while loop is running continuously but not giving anything out through the connection. I am looking for something like "if this do that conditional". Is there a way to set this up?
0 Kudos
Message 1 of 5
(3,071 Views)
Not too sure how you are trying to accomplish your task by your description, what i am guessing is that you have a boolean wired to the edge (outside the loop) of your loop. if this is the case that boolean will only be updated when your loop terminates. try posting an example and i/we can take a look and possibly help you further.

Dan
0 Kudos
Message 2 of 5
(3,071 Views)
Hello!

The �if this, do that conditional� tools in LabVIEW are the Select function (All Functions >> Comparison subpalette) and the Case Structure (All Functions >> Structures subpalette), depending on the complexity of what you want to do �if this happens�.

Keep in mind that, as Dan said, whatever you have wired to the border (�as an output�) of the while loop will not be updated until the while loop finishes executing. Depending on what you want to do, you could have the Case Structure inside the while loop.

Hope this helps!

S Vences
Applications Engineer
National Instruments
Message 3 of 5
(3,071 Views)
Thanks for that suggestion. I have attached a picture of the loops as they are set up in the vi. I have taken out all of the extras to make matters simpler. The main problem is to connect loop number three to number one, so that whenever the value inside of the loop number three is true it is terminated and starts loop number one.
0 Kudos
Message 4 of 5
(3,071 Views)

From your attached diagram, it looks like you want to control the execution of second and thrid loops based on the state of the boolean in the first loop. Is this correct?

One nice way of achieveing this is by using queues. Take a look at the shipping examples located at:
..\examples\general\queue.llb

Hope this helps.

Khalid
0 Kudos
Message 5 of 5
(3,071 Views)