Generating Code
If you are using NI application software version 7.x or later, you can generate code for use in your applications. You can generate code in LabVIEW 7.x or later, LabVIEW SignalExpress 2.x or later, LabWindows/CVI 7.x or later, and Measurement Studio 7.x or later from any task saved in MAX. You also can generate code from a global virtual channel in LabVIEW 7.x or later.
Any changes you make to the generated code apply only to the task in the application and are not saved back into the task or global virtual channel in the DAQ Assistant.
Types of Code Generation
There are three options for generating code in your NI application software from a task or global virtual channel:
- Example—Generates all the code necessary to run the task or global virtual channel, such as VIs needed to read or write samples, VIs to start and stop the task, loops, and graphs. Choose this option if you want to run the task or global virtual channel you created to verify that it works or to use your configuration in a simple application. The generated code is a simple NI-DAQmx example that you can then modify for your application.
- Configuration—Generates the code that replicates the configuration of the tasks and global virtual channels. Choose this option if you want to deploy your application to another system. Refer to Deployment in the NI-DAQmx Help located at Start»All Programs»National Instruments for more information.
When you generate Configuration code, the link between the application and the DAQ Assistant is lost. Any changes you make to the configuration code are not reflected in the DAQ Assistant. You can regenerate Configuration code from the DAQ Assistant, but the regenerated code does not maintain previous changes that you made to the code.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—You must use LabVIEW to generate this type of code. Choose this option if you want to create a portable, complete application that can run on other systems.
Note If you right-click the DAQ Assistant Express VI and select Generate NI-DAQmx Code, you generate both configuration and example code. |
Generating Code in Your Application Software
Select your NI application software for more information on the types of code you can generate and how to use the DAQ Assistant to generate code.