LabVIEW 2009 and later:
Starting in LabVIEW Real-Time 2009, the startup.rtexe can only be run as a startup executable. This is because the startup.rtexe is now a zipped version of an LLB that is unzipped at boot. This behavior was changed with size limitations in mind.
In order to programmatically launch a VI on an RT target, you must make your project into a source distribution and deploy the source distribution to your target.
To create a source distribution:
1. In the project containing your VI, right-click on Build Specifications
and select New»Source Distribution
2. In the Source Files
category, select your VI and press the arrow pointing right to move it into the Always Included
3. In the Destinations
category, designate where you would like the VI to be placed by modifying Destination path
4. Click Build
on your source distribution and select Deploy
. (In 2009, this is not an option and you will need to manually FTP the files needed for your VI to the real-time target)
Now that there is a source distribution with the VI you want to launch on your target, you can continue by following the steps below for LabVIEW 8.6.1 and previous. In step 2 make sure to point to the top level VI of the source distribution.LabVIEW 8.6.1 and previous:
These are the basic steps to launch an already embedded executable on the RT controller from the host computer through VI Server:
1. Place an Open Application Reference function on the block diagram and wire the name or IP address of the RT Controller to the Machine Name input.
2. Place an Open VI Reference function on the Block Diagram. Use it to open a reference to the top-level VI in the executable. In the case of a top-level VI called RT Engine.vi, the path to open for the default executable location would be C:\ni-rt\startup\RT Engine.vi
3. Use an Invoke Node or a Call By Reference Node to run the remote VI. To create an Invoke Node, right-click the VI Reference output of the Open VI Reference and click Create»Method for VI Class»Run VI.
4.When you no longer need the VI to run on the Real Time target, close the VI reference, then the LabVIEW application reference. Note that the dynamically called VI can only run on the real time target while the reference remains open, and that closing the reference will stop the VI on the Real Time target.
Note, there are some instances when using the path data type does not provide sufficient location information to open the VI reference and will return Error -1445. If this occurs, wire a string constant containing the name of the VI to the vi path input of the Open VI Reference function. For this example, a string constant containing the top level VI name, RT Engine.vi would be used as an input.
When using VI Server functions, it is important to ensure that VI Server security permissions are set appropriately, or errors may occur. Open the properties of the real time controller and choose the VI Server section on the left hand side of the window. Make sure that TCP/IP
is checked. Note that the default Port is 3363. If this is not done you may get an error 63
pop up when you try an execute your VI.
For source distributions that use VIs from libraries (DAQmx, VISA, etc.), ensure those libraries are included in the distribution (otherwise the VI not run). To achieve this you can open the distribution property window and, in the Additional Exclusions
the options as shown in the picture below. Now when the executable runs all the VIs inside the libraries will be available on the Real-Time controller