LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to run a sub vi

Hi,

my problem is that i am developing a program with different levels of subvi. I want that when i press a button on the front panel of the main VI a subvi opens up. And when i press a button on that subvi another subvi inside it opens up. This has been achieved. But what i want now is to run this last subvi at will. However, the front panel of the subvi (inside the other subvi) shows a different sort of run button and says "subvi waiting to run". How can i solve this?

 

I tried using the invoke node method but that way even the front panel does not show up.

 

Is it even possible to run a subvi at will inside the main program? If not, then how can i go around this problem.

 

 

0 Kudos
Message 1 of 4
(3,578 Views)

You seem to be asking two different questions here.

 

The first is how to launch a VI dynamically. You seem to know how to do this already, except for the fact that you forgot to make the front panel visible. When you run a VI using the VI server it will not automatically open the front panel - it has no reason to do so. You either have to set up the properties within the VI to do so, or you can use the VI server to set the Front Panel to be visible.

 

The second question has to do with the text on some button, and I have to admit that I didn't follow your description, nor do I understand why it should say "subvi waiting to run" in the first place. Please clarify. If you cannot upload your code because of its size, or proprietart reasons, then upload a trimmed down version to show the issue.

0 Kudos
Message 2 of 4
(3,565 Views)

Hey,

Sorry to be unclear. Here is the attached file.You will understand my problem better if u follow the procedure as under:

1. open MAIN.vi and run it

2. Click on the button named 'Antenna and RF'. A front panel will open up.

3. Now click on the button 'Antenna Control Unit'. This button has a subvi in it that is used to transmit information to another computer using GPIB. (The GPIB code is working fine seperately). Clicking it will open the sub vi but not run it.

 

HOWEVER . . .

I want that the front panel of this 'Antenna Control Unit' does open on clicking and it can be run at will whenver i want to transmit data. (with the main.vi still running). However, it cant be done because the run button says 'subvi waiting to run'.

 

Please help me out.

0 Kudos
Message 3 of 4
(3,527 Views)

Put  a wait statement in your main VI's loop.   Right now that will run as fast as it can doing nothing.  A wait statement will yield some time for the processor to do some other tasks like handle that mouse and do screen updates.  Better yet, use an event structure so that nothing happens until a button is pressed.

 

Make sure your terminal labels in the block diagram visible.  Looking at the VI, it is impossible to know which terminal is connected to which button by looking at it.

 

If you press a button, your main VI will pause until the subVI finishes running.  If you want other things to happen, you will either need parallel loops, or call the subVI's dynamically with the option to Wait until Done set to False.

 

As for your ACU Commands.vi, when it runs it will execute very quickly and finish all in one shot.  If it is meant to be a subVI with user interaction, you need to have a while loop in there that keeps the subVI running until the user is finished working with it.

 

 (By the way, in that subVI you have a ring control where several times Equipment is spelled with a number one rather than a letter I.)

0 Kudos
Message 4 of 4
(3,503 Views)