LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dr. Damien's Development - Running Top Level VIs III - Launching Multiple Interacting Executables

The Run method can be used to launch multiple VIs into the same run–time system, allowing you to create an executable with multiple top–level VIs which communicate through standard protocols (e.g. queues and notifiers). The key is to open a particular application instance specified by a TCP/IP port, then launch the VIs into that application. By default, LabVIEW uses TCP/IP port 3363.


Attached is a set of VIs which implement this functionality. They currently use port 3363, so they can be run under LabVIEW without change. If you make an executable, this should be changed to an unused port for your machine. Unzip the code into the directory of your choice. Open Main.vi and run it. Watch it launch the final VI (actually a VI Template, to facilitate launching multiple copies) through a splash screen. Do it again. You should have two identical VIs running together. Changing the DBL value on one changes the DBL value on the others. Communication is via notifiers. Launch as many as you wish.


Now change the TCP/IP port number in Launcher.vi and in Main.ini to an open port on your machine. Open the build process and change the build location to a valid location on your machine. Now build. When done, launch the executable by double clicking it. Do this a couple more times. Notice that the multiple VIs interact just like they did in the development environment, indicating that they are in the same application.


The key to this behavior is launching the VI into a specific application. This is done in Launcher.vi. Note the Open Application Reference primitive which opens the application. This is then used as an input to the Open VI Reference primitive. The INI file entries are key to making this work. They enable TCP/IP and set the port which the run–time engine will use.


The launch process is more complex than it needs to be to enable expected usage. This includes showing the splash screen without launching anything and launching another version of the application from a currently running one. The splash screen VI has an input to allow it to run in either launch mode or splash screen mode. However, it must always be run using the Run method. If it is statically linked into the MainCode.vi, then the splash screen could not launch MainCode.vi. See if you can implement showing the splash screen without launching. Also try launching another copy of MainCode.vi from MainCode.vi. Be careful. It is trickier than it may first seem, since you cannot open a VI reference which calls code already running top level.


Have fun!


Previous Installments

This account is no longer active. Contact ShadesOfGray for current posts and information.
Message 1 of 1
(4,610 Views)