Solution
When using the Python API with NI-DAQmx, it is necessary to specify the parameters in the function where the channel is declared, more specifically, the lower and upper ranges in the function constructor.
As an example, the next function has the min and max voltage values present on its parameters, taken from the NI-DAQmx Python Documentation API:
task.ai_channels.add_ai_voltage_chan("Dev1/ai0", min_val=-10.0, max_val=10.0)
The whole set of parameters that can be used for the method shown above is explained as follows. If some parameter labeled as optional is not declared inside parentheses, the function will work normally or will take the default value in the constructor definition:
- physical_channel: Specifies the names of the physical channels to use to create virtual channels. The DAQmx physical channel constant lists all physical channels on devices and modules installed in the system.
- name_to_assign_to_channel: Specifies a name to assign to the virtual channel this function creates. If you do not specify a value for this input, NI-DAQmx uses the physical channel name as the virtual channel name.
- terminal_config: Specifies the input terminal configuration for the channel. (Optional)
- min_val: Specifies, in units, the minimum value you expect to measure. (Optional, default value is -5)
- max_val: Specifies, in units, the maximum value you expect to measure. (Optional, default value is 5)
- units: Specifies the units to use to return voltage measurements. (Optional, default value is Volts)
- custom_scale_name: Specifies the name of a custom scale for the channel. If you want the channel to use a custom scale, specify the name of the custom scale in this input and set units to FROM_CUSTOM_SCALE. (Optional)