LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to launch a VI within an other VI?

Hello everybody...
I am working on a project and I want to know a little thing.
I am developping 2 VIs (vi1 & vi2).
I first start vi1. When I type a text I put it into a global variable. If I typed "start" I want to launch vi2 but keeping vi1 'alive'.
Then vi2 reads the global variable, does its stuff, then writes in the variable "resume" that means its work is terminated, and finally stop.

Then I want vi1 reading the global variable during vi2 's processing and loop until it can read "resume", then vi1 follow its process.

I hope I was clear 😉
Which component I can use to launch vi2 like I want?
I tried with the component based in right click/all functions/select a vi.../vi2.vi but when it launch vi2, vi1 is stoppe
d.

Help me to resolve this (little) problem please...

P.S.: If you have any questions, don't hesitate!!

Thanks a lot
0 Kudos
Message 1 of 4
(2,809 Views)
Hello SebGAM...

Try the following on vi1:
1a] On Functions Pallette, Go to "All Functions" -> "Application Control" -> "Open VI Reference"
1b] Right Click "VI Path", then click "Create" -> "Constant"
1c] Right Click the path constant, then click "Browse for Path", then open vi2.vi

2a] On Functions Pallette, Go to "All Functions" -> "Application Control" -> "Invoke Node"
2b] Click "Method" -> "Run VI"
2c] Connect a False Constant to "Wait Until Done"

I hope that this works....

Good Luck....
Message 2 of 4
(2,809 Views)
Hello SebGAM,

my advice would be:
1) put a sequence in vi1 with 3 frames
2) in the 1st frame vi1 does it's stuff: the user types in the string and the value is copied to the global
3) in the 2nd frame you call vi2 and a while loop runs in parallel, in this loop you check the global and end the loop when it goes to "resume"
4) in the 3rd frame vi1 "follow its process"

If vi1 is doing nothing else in parallel, when vi2 is working, then you don't need a sequence (or anything else): just call vi2. vi1 is continuing work, when vi2 finishes, like any normal subvi call does.

Best regards,
GerdW
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 4
(2,809 Views)
Thank you very much!!
0 Kudos
Message 4 of 4
(2,809 Views)