LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Run sub-vi in background

I have a main vi which calls a sub-vi.  The sub-vi requires user interaction and then performs some time intensive tasks.  Is there a way to have the sub-vi run in the background after the appropriate user interaction, allowing the main vi to proceed in its operation (not wait for the sub-vi to complete)?  I have tried setting a self-reference in the sub-vi to hide the front panel, but this does not allow the main vi to proceed, i.e. the main vi still waits for the sub-vi to complete before continuing.
0 Kudos
Message 1 of 8
(3,719 Views)
you are using only one while loop in your main vi, right?

to do what you want, i use two or more loops (while loop and/or timed loop), and then exchange data between loops with global variables to call your subvi

i hope it helps 😉
Message 2 of 8
(3,710 Views)
Using two while loops does not seem to work.  The loop containing the sub-vi will not run simultaneously with the main while loop which means that the sub-vi doesn't get called until after the main loop has completed.  There are no wires connecting the two loops.  Is there a more robust way to accomplish what I want?
0 Kudos
Message 3 of 8
(3,703 Views)
This is something I also wish to achieve The closest I have gotten is using projects and Classes
- there is always an easy way, but it is always the hardest to find
0 Kudos
Message 4 of 8
(3,697 Views)
I don't understand the problems you are having. Running two separate while loops has worked for as long as I have been programming in LabVIEW. Please post some code that demonstrates what you have tried and doesn't work.
0 Kudos
Message 5 of 8
(3,691 Views)
here is my example using a projext and class
- there is always an easy way, but it is always the hardest to find
0 Kudos
Message 6 of 8
(3,688 Views)

Further improvements

PS make sure to change path constant on the in C.vi to where you have A.vi saved

- there is always an easy way, but it is always the hardest to find
0 Kudos
Message 7 of 8
(3,676 Views)
I apologize; it does work.  I had messed something up on my first implementation of the two while loops.  This solution works very well in conjuction with the sub-vi property FP.state set to hidden.  Thanks.
0 Kudos
Message 8 of 8
(3,663 Views)