LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

want to call and run a vi that is not in memory

I have a vi  (say Sub1.vi) that I want to call and run from another vi (Say Main.vi). Sub1.vi is not loaded into memory, when Main.vi is started. From within Main.vi I want to load Sub1.vi and run it. But I don want Main.vi to wait for completion of sub1.vi - sub1.vi needs to run continuously in the background.
So I tried calling the sub1.vi using the Open vi Reference and the Invoke Node to run the vi. This works only if Sub1.vi is already loaded in memory.
Next I tried Open vi Reference, Invoke Node to Open FP and then another Invoke Node to Run the vi. This works when the sub1.vi is not loaded in memory but it opens the FP of sub1.vi.
But I dont want the FP to open and be displayed - I want sub1.vi to run in the background.
How do I achieve that?
0 Kudos
Message 1 of 6
(2,894 Views)

Hi,

      You've probably figured this out by now; if not, maybe this will help!

 

Message Edited by tbd on 07-12-2006 11:07 PM

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
Download All
0 Kudos
Message 2 of 6
(2,882 Views)

Thanks for your reply!

Unfortunately, I have LV 6.0.2
Could you post a screen shot of the block diagrams of the main and subvi?

 

Regards,
Niren

0 Kudos
Message 3 of 6
(2,869 Views)
It's really quite simple. If you don't want to open the front panel, don't use the OpenFP method. OpenFP means to open the front panel and you do not have to call this.
 
Now, without the front panel open, you are going to have to have something in your program to stop the subVI. I'm assuming that the subVI has a while loop wired to a front panel Boolean and it would probably be best to use the Set Control Value method to set this control as opposed to using the AbortVI method.
 
0 Kudos
Message 4 of 6
(2,859 Views)
But if I dont have the Open FP method in there, and the vi is not loaded into memory, then it doesnt run. 😞
Here's what I did. I used the Open FP method to open the FP of the subvi, then use the Run VI method to run it.
And within my subvi, I have the first frame of a sequence close its own FP (after creating a reference to itself).
This makes the FP appear for a fraction of a second and then disappear and it continues to run in the background.
I do have global tied into the subvi to stop it.
Is there a better way to load and run the subvi in the background - without opening and then closing it again as I am doing?
0 Kudos
Message 5 of 6
(2,855 Views)

The following works for me. Why don't you post the main VI and the subVI you are trying to run if you continue to have problems.

Message Edited by Dennis Knutson on 07-13-2006 09:35 AM

0 Kudos
Message 6 of 6
(2,850 Views)