LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

starting and stopping a VI from another VI

Hello
 
 
I have to write a VI for starting and stopping a vi from another vi. I browsed the forums for an example but couldn't find one. If anyone has an example it would be of great help.
 
Thanks
 
Ankit
0 Kudos
Message 1 of 18
(6,547 Views)
You should look into the Open VI Reference function under Application Control.  Read the LabVIEW help files on it, and you'll be able to open the reference, tell it to start and stop, etc.  If you want to display it, you should also read up on Subpanels.
0 Kudos
Message 2 of 18
(6,540 Views)
What you are referring to is to call a VI dynamically. This will allow you to launch a VI and optionally abort it. However, the abort is the same as if you had pressed the Abort VI button on the toolbar, which isn't always a good thing. Normally it better to set some condition that the other VI will detect as a signal to stop. There are examples that ship with LabVIEW on dynamical calls, and if you search for this term on this forum as well as the NI site you will find examples.
0 Kudos
Message 3 of 18
(6,536 Views)
By calling the VI dynamically I am able to run the VI but the problem is the main vi ( which calls the other VI) stops executing for the time when the dynamically loaded VI is running. The purpose of my application is to run the two vis at the same time (one VI: main programme that does data acquisition and analysis, Second VI (which has to be started and stopped from the main VI) generates the sound signal.
 
I want to generate the sound signal for my data acquisition. The problem is when the sound generating VI is called dynamically it stops the data acquisition vi temporarily till the whole wave file has been played. And once the wave file stops the main vi starts again, however what I am trying to do is to keep both the VI's running at the same time.
 
Any suggestions???
 
Ankit
0 Kudos
Message 4 of 18
(6,503 Views)
You are probably not wiring a False constant to the Wait Until Done input of the Run VI Invoke Node:

That said, you should be able to accomplish what you want to do by using independent loops rather than resorting to calling the sound generation VI dynamically. One loop handles the sound generation, while the other loop does the data acquisition. This way the data acquisition can continue to run while the sound is being generated. Example:
0 Kudos
Message 5 of 18
(6,497 Views)

Since the VI now exists, it is probably easier to wire the False constant to "Wait Until Done" input, as smercurio mentionned.

RayR

0 Kudos
Message 6 of 18
(6,481 Views)
I may be throwing myself into a pot of boiling water here, but...

I don't think this method is called dynamically calling a VI. Going through the LabVIEW help says this about dynamically called VIs

"You can dynamically load VIs instead of using statically linked subVI calls. A statically linked subVI is one you place directly on the block diagram of a caller VI. It loads at the same time the caller VI loads.

Unlike statically linked subVIs, dynamically loaded VIs do not load until the caller VI loads them with the Open VI Reference. If you have a large caller VI, you can save load time and memory by dynamically loading the VI because the VI does not load until the caller VI needs it, and you can release it from memory after the operation completes. You also can use the VI Call Configuration dialog box to configure when to load the subVI."
and:

"Create a strictly typed VI reference to dynamically call a VI using the Call by Reference Node. The strictly typed VI refnum identifies the connector pane of the VI you are calling."
It seems that the advantage of dynamically calling a VI you can call DIFFERENT VI's with the same function on the block diagram as long as both are strictly typed to have the same connector pane. So say you have a VI that has a voltage input and a time input and calculates the rate of voltage change, could be replaced by a VI that takes the same inputs, but does something else with the data. And both VI's could be called by the same function depending of the reference passed to "Call by Reference."

I think the method of calling a VI and not caring about when it finishes is just an Invoke Node method.






0 Kudos
Message 7 of 18
(6,475 Views)

You're right about the definition.

It would not be necessary to use a call by reference node if all you want is to open a vi from within a running vi. 

You could open a reference and use the invoke node.. as shown below.

RayR



Message Edited by JoeLabView on 06-16-2008 10:25 PM
0 Kudos
Message 8 of 18
(6,461 Views)
Something else you can do is buffer the VI reference after you have gotten it and then use the buffered reference to run the plugin VI. In this way you only take the performance hit of loading the plugin the first time it's called. You can do this using an overall structure not unlike a functional global: when the VI is run it checks to see if the reference is valid. If so, it uses it to run the plugin. If not, it opens it, buffers the reference and then used it to run the plugin.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 9 of 18
(6,455 Views)

Thanks to all for helping me. I am able to start and stop my sound generating VI as I needed it to be.

Thanks once again.

Ankit

 

 

0 Kudos
Message 10 of 18
(6,439 Views)