LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I run 2 or more VIs simultaneously?

Hi. I'm trying to create an application, where I need two or more VIs running at the same time. My problem is that when I call a subVi, my main VI is frozen until the subVI finishes. Does anyone know how to programmatically call/open/run a VI or subVi without freezing the main VI?
 
- Thanks alot in advance.
0 Kudos
Message 1 of 16
(7,726 Views)
Hi
 
There are different approaches to help you on your problem.
You could design your main vi using the producer-consumer pattern, run your sub vi in parallel to the main loop (if it is a continuous operation) and there a more.
 
How does your application look like? Could you post the vis or a screenshot (please no *.bmp-files)?
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 16
(7,710 Views)

Hi again...

It sounds like what I want to do is to run them in parallel... How do I do that???

I can't seem to upload the screenshots... But my main VI consists of 7 units (water tanks), each of which I want to have it's own front panel. I need to be able to open a particular unit's VI and run some things on it, while still running the main VI, and possibly some of the other units too... Can you tell me any way to do this?

Thanks... 

0 Kudos
Message 3 of 16
(7,694 Views)
Hi
 
I attach you a simple example. One subvi used 4 times, all of which using different interrupt times. One main vi, which contains the four sub vis.
 
If you push the button "show dialog" a window appears. If you then watch the numeric indicators, you can see that indicator "numeric" (the one from the main vi) does not count up, because the main vi is blocked by the dialog, but the other ones still count up.
 
Hope this is what you are looking for. To exchange data, I used references, but also there are different ways (global variables, functional globals, references, queues).
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 4 of 16
(7,688 Views)
Hi. That was a big help with how to run parallel, but a big part of my problem is that I need the front panel of a subVI to be shown when I push a button, and then hidden again (but still running) when I push a button on the subVI's front panel... I am trying to get a user interface for each subVI, and be able to switch between them while they are running... Do you have any idea on how to do this? 
0 Kudos
Message 5 of 16
(7,684 Views)
There you have to possibility to either open them as separate windows or you could use the sub-panel. Browse the examples for the usage of the sub-panel.
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 6 of 16
(7,681 Views)

That looks promising. Thank you very much!!! As a last thing could you tell me how to open them in seperate windows? You have been a great help sofar, and I really apreciate it! Smiley Happy

Thanks again!

0 Kudos
Message 7 of 16
(7,662 Views)
Hi
 
Are your subvis of the same type? If yes, this makes it a little bit more tricky.
 
I changed the library to meet this problem. You can use VI-Server to open the vis. If they are all of the same type, you have to make a template and open it. You also could provide different vis. Then you don't need them to be templates.
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 8 of 16
(7,641 Views)
Great! Thanks... I'm getting closer every time 🙂 but actually the subVIs are different. I have 7 different subVIs. On the main VI I have 7 buttons, one for each subVI, and when button1 is pushed, subVI1 should be displayed as maximized (the same for button2 and subVI2 and so on...). On every subVI I want a button called Show Main, and when that button is pushed I need the front panel of the main VI to be displayed, without shutting down the subVI.This is the thing that I can't figure out... Is this even possible???
I hope you can help...  Thanks so much for all your help so far.
0 Kudos
Message 9 of 16
(7,636 Views)
You have to pass a reference of your main vi.
 
Have a look at the changed library.
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 10 of 16
(7,630 Views)