LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While loop in subVI

Hello
I have a doubt about using while loops in VI and subVI. I have a VI, with two loop that are executed in parallel, and stoped with the same button, by using property nodes and references. One of the while loop executes a subVI.
If the Block Diagram of the subvi there is a while loop covering all the code, it's the same to put it in the main VI with another while loop, or it's not necessary?
it's the same if this subVI has a while loop covering itself that if the subvi doesn't have this while loop because the loop is in the same VI?
Thank you very much
0 Kudos
Message 1 of 3
(2,447 Views)


Hello,

I hope I understood you correctly... In general, it's better to use sub VIs to organize and modularize your code. So, if you can separate part of the code into a sub VI, do it.

And if your main VI is calling the sub VI in a loop, the sub VI executes every iteration of the loop. So, you do not need a loop in sub VI, normally. But it depends on what exactly you are trying to do.

Use the Execution Highlight mode (the light bulb on the diagram toolbar) to see how the code gets executed, and make changes accordingly.

Regards,

Khalid


Message 2 of 3
(2,447 Views)
Thank you, that is exactly what I was asking.
I will use the Execution Highlight mode, I didn't know this mode exists
Thank you again!!
0 Kudos
Message 3 of 3
(2,447 Views)