Generating Code in LabVIEW
This section describes what happens during code generation in LabVIEW and how to generate code using the DAQ Assistant.
Types of Code Generation
You can generate all three types of code in LabVIEW. For general information about the types of code and special considerations, refer to Generating Code.
- Example—This option adds to the VI you are working in.
- Configuration—The I/O constant/control is replaced with a subVI that contains VIs and property nodes used for physical channel creation and configuration, timing configuration, and triggering configuration used in the task or global virtual channel.
Caution Although generated configuration code includes code to create global virtual channels and tasks, it does not include code to create scales. If you generate configuration code for deployment of applications that include scales, you must ensure that the scales are configured in the target computer. Refer to Deployment in the NI-DAQmx Help for deployment options. - Configuration and Example—This option generates both Configuration code and Example code for the task or global virtual channel in one step.
Generating Code in LabVIEW
Complete the following steps to generate code:
- Place either the DAQmx Task Name control or DAQmx Global Channel control on the front panel.
- Click the pull-down menu and select the task or global virtual channel from the list.
- Right-click the control and select Generate Code»Example, Configuration, or Configuration and Example.
Generating Code in LabVIEW Using the DAQ Assistant Express VI
If you configure a task using the DAQ Assistant Express VI, you can right-click the VI and select Generate NI-DAQmx Code to generate configuration and example code. The code replaces the DAQ Assistant Express VI.
Note When you configure a task using the DAQ Assistant Express VI, the task is local to the application and cannot be saved to MAX for use in other applications. You can convert the DAQ Assistant Express VI to an NI-DAQmx Task to save the task to MAX for use in other applications. |