LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Run two VIs at the same time

Hello!
I want to know how i can run two VIs at the same time.
I mean that i want to run a second VI ( N.2) while another VI (N.1) is in
execution without suspend it (N.1)
If anyone has suggestions, please help me!

Thank you very much.
roby.
0 Kudos
Message 1 of 4
(3,261 Views)
Hello Roby

The best way to do it is to call those vis dynamically. Search for "Dynamic Load Example.vi" in LV help. Although it is not the best example, you should find a way how to call vi dynamically.

Personally I do not like to use the "call by reference node" as it is in this example. Instead I open a vi reference, set all controls via "invoke node" and run the vi in the same way.

hope it helps
Pawel
0 Kudos
Message 2 of 4
(3,261 Views)
If your calling vi calls the two vis in parallel then the two vis will run in parallel. LV will not wait for the first vi to complete before running the second vi unless there is a data dependency. If you want to have the ability to call the second vi on demand while the first vi is running then put it in a separate control loop.

In order for this to work properly you need to make sure that neither of your vis are hogging all of the processing time. This means that your processing loops inside your vis will need to have some wait time built in.
0 Kudos
Message 3 of 4
(3,261 Views)
If you say "run a vi", I assume that you have the VI open in LabVIEW, then press the run button. (Some of the earlier answers taks about programmatically calling VIs, which I don't think is the focus of your question)
You can run as many VIs as you want at the same time. Simply press the run button of the second VI and they will both run.

Of course you should ensure that they don't use the same resources (e.g. DAQ device, or listen on the same TCP port, etc.) In these cases, the second VI might fail. (Also if the second VI is a subVI of the first VI, you won't be able to run it seperately, because it will be already running.)
0 Kudos
Message 4 of 4
(3,261 Views)