12-05-2012 08:14 AM
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?
12-05-2012 08:32 AM
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.
12-05-2012 08:36 AM
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.
12-05-2012 09:01 AM
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)
12-05-2012 09:25 AM - edited 12-05-2012 09:28 AM
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.