The recommended way to create an application is to build a startup executable. For more information on why this is the recommended way please see
LabVIEW Real-Time Startup VI vs Executable.
In LabVIEW Real-Time 8.0 and later, it is possible to configure a VI to start when the real-time (RT) target boots using the following steps:
- Create a Source Distribution with your VI. This ensures that all of the dependencies of the VI will be included so that it can be transferred to the hard drive of the RT target. Be sure to clear the check marks from the options to exclude VIs from vi.lib, instr.lib, and user.lib.
The steps to create a Source Distribution that contains the Startup VI are as follows:
- In the Project Explorer windows right-click on Build Specifications and select New»Source Distribution.
- In the Source Distribution Properties window take note of Destination directory. This is where your file will be once you have built your Source Distribution.
- In the Source Files category of the Source Distribution Properties window include the VI and dependencies that are required.
- In the Destinations category ensure that the Destination type is select as Directory. Depending on how your dependencies and VIs are referenced you may need to select Preserve hierarchy. With that selected, the folder structure of your project will be recreated.
- In the Additional Exclusions category, ensure that the Exclude files from vi.lib, Exclude files from instr.lib,and Exclude files from user.lib are unchecked. Also, ensure that Remove Unused Polymorphic VI Instances and Remove Unused Members of Project Libraries is enabled.
- Once the above steps have been completed left-click on the Build button to build the Source Distribution.
- Depending on which version of LabVIEW you are using, you can use either the LabVIEW project, FTP, or WebDAV system to transfer the source distribution output to the hard drive of the RT target.
- In the LabVIEW project, simply right click on your source distribution and select Deploy.
- More information on how to FTP is available in Transfer Files Using FTP Between Host and Real-Time Targets in NI MAX
- More information on how to use WebDAV is available in: Using WebDAV to Transfer Files to Your Real-Time Target
- Configure the RTTarget.StartupVIs token to point to the source distribution.
VxWorks(All Versions), PharLap ETS(All Versions), NI Linux RT (2014 and previous)
Add the RTTarget.StartupVIs token under the [lvrt] section of the ni-rt.ini file. If it has not been previously set, the token may not appear in the ini file. For VxWorks and PharLap, the token accepts a string of VI paths separated by semicolons and multiple VIs may be set to start.
Example for LinuxRT OS:
RTTarget.StartupVIs=/home/lvuser/natinst/bin/foo.viExample for PharLap OS:
RTTarget.StartupVIs=c:\ni-rt\startup\foo.viExample for VxWorks OS:
RTTarget.StartupVIs=/c/ni-rt/startup/foo.vi
NI Linux RT (2015 and newer)
Add the RTTarget.StartupVIs token under the [lvrt] section of the lvrt.conf file located at /etc/natinst/share/lvrt.conf. If it has not been previously set, the token may not appear in the configuration file.
Example for LinuxRT OS:
RTTarget.StartupVIs=/home/lvuser/natinst/bin/foo.vi
-
Reboot the target in order for the startup VI to be executed.
Additional Information
- Enabling a startup application (.rtexe) will override any startup VIs and only the executable will be run. The startup VIs will not attempt to run.
- Similar to a startup executable, the LabVIEW development environment cannot connect to a system running a startup VI without stopping the VI.
- It is not possible to remotely debug Startup VIs in the LabVIEW development environment, it is however possible to debug startup executables. Refer to Remotely Debugging Executables in LabVIEW for more details.