07-02-2014 05:20 PM
Hi,
I have a subvi which has a while loop, and It is located in my main vi in a sequence structure, I want to stop the loop inside of the subvi using a boolean in main vi.
I tried global variable but It didn't work since the stop botton in my main vi doesn't get updated when the program is running...
could you please help me?
I appreciate any ideas 🙂
thanks:)
Darya
Solved! Go to Solution.
07-02-2014 05:27 PM
07-02-2014 05:49 PM - edited 07-02-2014 05:51 PM
Hi,
i have to use the sequence structure because the main vi controls 5 hardwares and I need delays between each action.
I could try pulling the while loop out of the subvi but If there is a way to stop the subvi from outside it would be better.
and I don't want to use the stop botton in subvi because I don't want too many windows open. and wanna control the program from the main vi.
Darya
07-02-2014 06:03 PM
07-02-2014 06:13 PM - edited 07-02-2014 06:17 PM
the sequence works so no problem with that.
the subvi graphs some values and I can get the graphs in main vi since I passed their references to the main vi. I don't need to have the subvi open while I run the main vi.
as for how the user knows how many windows are running, that doesn't matter.
I didn't want the user to go to subvi and stop from there.
If I take the loop out of the subvi and put it in main vi it works just fine.
if you can give me a tip for stopping the subvi while loop from main vi, I'll appreciate it.
Darya
07-02-2014 06:30 PM
07-02-2014 06:32 PM
Let me see if I understand this. You have a (probably bad) design, ask for help, and get suggestions from one of the real experts on this forum. Instead of saying "Thank you" or "I don't understand, could you please explain", you argue that "there's no problem with my desgn". Not to mention that you don't actually show any code, making it difficult to be really helpful.
I think of myself as a pretty good LabVIEW programmer. I almost never a sequence structure, and, in fact, would love to see it disappear. Except in extremely rare circumstances, it is not necessary, and only serves to clutter up the Block Diagram (in my humble opinion). But go ahead and use it ...
07-02-2014 07:12 PM
I'm sorry. I didn't mean to be rude I just didn't see the effect the sequence structure may have on the while loop problem.
I'm not saying my design is perfect! obviously not!
thanks for the replies
Darya
07-02-2014 08:30 PM
As a general rule of thumb, you should avoid using Sequence Structures. The reason being that they break data flow. If you can control the flow of data with wires, that is the most efficient way to make your program work. So the suggestion to get rid of your sequence structures is to make another subVI for your wait that also has an Error In and Error Out. Then you can use the error cluster to force the execution.
And having While loops inside of subVIs is a common beginner problem. If you are controlling when the loop ends based on a front panel control from the mainVI, then the loop really needs to be in the main VI.
I hope that was a good summary of what has been said.
07-02-2014 08:37 PM
Thanks!
I remove the loop then...