This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

Error -200077 Using Analog Output Task in Python

Updated Nov 30, 2023

Reported In

Hardware

  • USB-6009

Driver

  • NI-DAQmx

Programming Language

  • Python

Issue Details

I'm trying to stream data from my Data Acquisition hardware with Python using the DAQmx™ driver, but I getting error -200077 when trying to write in an analog output task using the task.wirite method:
Request value is not supported value for this property. The property value may be invalid because it conflicts with another property. Property: DAQmx_AO_MAX Requested value: 10.0 Valid Values Begin with: 0.0 Valid Values End with: 5.0

This error is present even if I change the parameter of the task.write method. How can I solve this issue?

Solution

To solve this issue, when defining the task use the following syntax:

add_ao_voltage_chan(physical_channelname_to_assign_to_channel=u''min_val=-10.0max_val=10.0units=<VoltageUnits.VOLTS: 10348>custom_scale_name=u''

With parameters:
  • physical_channel (str) – 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 (Optional[str]) – 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.
  • min_val (Optional[float]) – Specifies in units the minimum value you expect to generate.
  • max_val (Optional[float]) – Specifies in units the maximum value you expect to generate.
  • units (Optional[nidaqmx.constants.VoltageUnits]) – Specifies the units to use to generate voltage.
  • custom_scale_name (Optional[str]) – 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 to this input and set units to FROM_CUSTOM_SCALE.
Be sure to define min_val and max_val, these parameters are -10 and +10 by default. If you are using a DAQ device that can not generate ± 10 V (example: USB-6009) you'll receive error -200077.

Example:
import nidaqmx
with nidaqmx.Task() as task:
task.ao_channels.add_ao_voltage_chan('Dev1/ao0','mychannel',-5,5)
print('1 Channel 1 Sample Write: ')
print(task.write(1.0))
task.stop()

Additional Information

For additional information, please refer to DAQmx in Pyhthon examples available here