LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

is it possible to run sub vi and main vi at same time from startup?

Is it possible to run both my main vi and my two sub vi`s from startup, all of them continuously? I have to sub vi`s that are supposed to take in measurements from two different instruments continuously. I manage to make a program where I can open up and close the sub vi`s, but when my sub vi`s are closed, nothing is happening in them...and they start to run again when I open them...and I have to close them if my main VI is supposed to run. So the data in the chart is only from the periodes when the sub vi has been open.
 
Thanks in advance for your help!
0 Kudos
Message 1 of 8
(3,872 Views)


Is it possible to run both my main vi and my two sub vi`s from startup,

Yes, two options. Option 1: Have two independent loops in your main VI in which you have your subVIs placed inside. Option 2: Use the VI server to launch your subVIs when you run the main VI. Check the examples that ship with LabVIEW.



I manage to make a program where I can open up and close the sub vi`s, but when my sub vi`s are closed, nothing is happening in them...and they start to run again when I open them...and I have to close them if my main VI is supposed to run. So the data in the chart is only from the periodes when the sub vi has been open.


How are you opening and closing the subVIs? Are you using the VI Server? It sounds like you have the subVIs set up to "run when opened". Do the subVIs have a loop that keeps them running or are you using the "continuous run" button? If using the VI Server you would need to create a "launch" VI that will check to see if the subVI is already running. You can do this with the VI Server VIs. Again, check the examples or search these boards, as there are plenty of examples that show you how to do this.
0 Kudos
Message 2 of 8
(3,850 Views)
I will send my labview programs. "Hovedprogram" is my main vi, "front" and "front 2" is my sub vi`s. I am also using global variables. I have already searched the discussion forum trying to find an answer to my problem, but I haven`t quite managed yet...
My sub vi`s are not connected to any instrument now, but I have inserted a sinewave-generator and a chart in "front"(my sub vi) so I am able to see that the sub vi actually stop running when i close the window.

 
Download All
0 Kudos
Message 3 of 8
(3,844 Views)
and here is the global variables...
0 Kudos
Message 4 of 8
(3,841 Views)
Your VIs were difficult to follow because of all the global variables floating around. I simplified the code using the "loop" method for running subVIs continuously. The main idea is that the subVIs are called by virtue of being independent (no wires) connected to your main loop. A single global boolean is used to close everything. The attached is for demonstation purposes to see how to do this using the loop method. Is this closer to what you're trying to accomplish?

I'm running 8.0.1 and I'm not sure if you can open that in 8.0. I think you can, but just in case I included a 7.1 version.
Download All
0 Kudos
Message 5 of 8
(3,831 Views)
Thank you for the help. I am using labview 8.0. Now both of the sub VIs are running from startup, that`s really good, but I want them to run all the time even when they are closed.And i want them to be closed when I start my main VI and open them when I want to study the detalis, end then close them and open them again later, when it is necessary.
 
-Mari
0 Kudos
Message 6 of 8
(3,819 Views)
I think we have a terminology issue here. You were talking about opening your subVIs at the same time as you open your main VI and "close" them when you "close" the main panel, and be able to "close" the subVIs. That's precisely what I provided to you. When you "close" a VI you stop it running. It seems that what you're really asking for is to be able to close the front panel only, but keep the VI running. In this case, why can't you just minimize the front panel? The VI will keep running, and you can display it simply by selecting it from the taskbar. If you're afraid of it being closed accidentally, you can set up the VI to not show the close box, as well as hide the toolbar. This is done in the VI Properties - check the LabVIEW documentation on how to do this.

The other solution is to mess around with the VI server to open and close the front panel of the target subVI from the main VI.

To me, simply minimizing the window seems like the simplest solution.
Message 7 of 8
(3,808 Views)
Yes you are right...I am messing with my terminology.Yes I want the sub VIs to run all the time, but open and close the front panels. I think I will try to minimize them...that`s a good idea. Thanks for your help!
0 Kudos
Message 8 of 8
(3,800 Views)