LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Execution conflict between a SubVI and a while loop

Hi,

 

I have wired the conditional terminal of a while loop with a boolean control. The same boolean control is responsible to terminate a SubVI (not inside the while loop) which also contains a while loop (I am using a reference to the control here). When I first use the boolean control, the SubVI is being terminated, but the while loop in the main VI is not. In order to terminate the main VI, I have to use the boolean control once more. In order to avoid that, I created a "status"-indicator within the SubVI, which is set to true once the SubVI is terminated, and wired that from outside the main VI's while loop to its conditional terminal. Of course, now the while loop does only execute once the subVI transmits the status value.

 

The thing is, I want both the while loop to execute before the status value is being transmitted (so, only the conditional terminal is supposed to wait for the value) and use the boolean control only once in order to terminate the VI.

 

Any ideas?

0 Kudos
Message 1 of 5
(2,807 Views)

It is difficult to figure out what you are trying to do by your description.  Please attach your VI's so we can see them.

0 Kudos
Message 2 of 5
(2,797 Views)

Can you post your code?  This can be extremely difficult to debug without looking at the code.

 

There are couple of possibilities.  Does the subVI reset the control value?  Is the main loop using an event structure?

 

Again, I really just need to see code.


GCentral
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 5
(2,793 Views)

I can only post parts of my code, so I hope this helps...

 

On the SubVI: It contains a stacked sequence, the last frame only contains a boolean value that is wired to a boolean indicator, which transmits the value to the main VI. (Status SubVI)

0 Kudos
Message 4 of 5
(2,782 Views)

Ok.  I kind of expected to see this.

 

First of all, change the "Control: Mouse Down" event into "Control: Value Change".  DO NOT USE  A LOCAL VARIABLE!!!  Wire the result straight out to the termination terminal.  You want something like this:

 

Your writing to a local is a race condition.  The control was read before you wrote to it.  Therefore the loop was going an extra time around.


GCentral
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 5 of 5
(2,763 Views)