LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Having the main VI open and close another vi

Here is my problem I need help with.

I have a main VI, it has in it a DNET I/O assembly that is reading inputs from a PLC, one of the inputs is connected to a key switch, when that key is turned I want to open another VI then have that VI close down when the switch is turned off. The problem I'm having is that once the second VI is open the main VI does not run and the PLC data isn't being read. Is it possible to have the main VI running in the background?

Also the second VI cannot just be shutdown it need to write files to the HD before closing, so it must accept a command to shut down and not be forced.

Thanks

Ron

0 Kudos
Message 1 of 2
(2,528 Views)
Use the VI Server to launch the subVI. The subVI will need to have an internal loop that keeps running until some condition is met, be that a front panel "Stop", or it reading a global variable that tells it to stop. This global you can set via your main VI. You can check the examples that ship with LabVIEW. They show you how to use the VI Server to accomplish this. It's pretty straightforward. If you need more help ask and an example can be posted, but it's usually better to try it yourself first.

Note: When you launch the subVI just make sure you set the property "Wait for Completion" (or something like that) to be False.

Message Edited by smercurio_fc on 04-25-2006 04:45 PM

0 Kudos
Message 2 of 2
(2,524 Views)