Solution
When using
NI-DAQmx in Text-Based Programming Environments, the syntax can vary from language to language. Refer to the
DAQ-mx help documentation for your specific programming language.
If programming in C, the following code will create a task and an analog input virtual channel with a custom name:
DAQmxCreateTask("", &taskHandle));
DAQmxCreateAIVoltageChan (taskHandle, "Dev1/ai0", "Voltage", DAQmx_Val_Cfg_Default, -10.0, 10.0, DAQmx_Val_Volts, NULL);
The first line of C code creates a task. Refer to NI-DAQmx C Reference Help documentation for more information regarding Task Configuration and Control.
The second line of C code creates an analog input virtual voltage channel with the following properties:
- Task to which channel was created: taskHandle
- Physical channel name: Dev1/ai0
- Custom name assigned to virtual channel: Voltage
- Input terminal configuration: DAQmx_Val_Cfg_Default (default)
- Minimum expected input: -10.0
- Maximum expected input: 10.0
- Units of measurement: DAQmx_Val_Volts (volts)
- Custom scale name: NULL
Now that the virtual channel has been created and given a custom name, the name must be used when referring to it in other NI-DAQmx functions.