04-20-2018 01:48 PM
First of all, sorry if i'm posting on the wrong topic
I'm using nidaqmx module and python3 to get some data from a power supply through NI 9233 device.
However, I'm getting some errors:
--------------------------------------------------------------------------- DaqError Traceback (most recent call last) <ipython-input-2-7344b4d10409> in <module>() 1 with nidaqmx.Task() as task: 2 task.ai_channels.add_ai_voltage_chan("Dev1/ai0") ----> 3 task.read() c:\users\júnior\appdata\local\programs\python\python36\lib\site-packages\nidaqmx\task.py in read(self, number_of_samples_per_channel, timeout) 603 <type 'float'> 604 """ --> 605 channels_to_read = self.in_stream.channels_to_read 606 number_of_channels = len(channels_to_read.channel_names) 607 read_chan_type = channels_to_read.chan_type c:\users\júnior\appdata\local\programs\python\python36\lib\site-packages\nidaqmx\_task_modules\in_stream.py in channels_to_read(self) 221 break 222 --> 223 check_for_error(size_or_code) 224 225 return Channel._factory(self._handle, val.value.decode('ascii')) c:\users\júnior\appdata\local\programs\python\python36\lib\site-packages\nidaqmx\errors.py in check_for_error(error_code) 125 cfunc(error_buffer, 2048) 126 --> 127 raise DaqError(error_buffer.value.decode("utf-8"), error_code) 128 129 elif error_code > 0: DaqError: Task contains physical channels on one or more devices that require you to specify the Sample Clock rate. Use the Sample Clock Timing function/VI to specify a Sample Clock rate. You cannot specify a Sample Clock rate if Mode is set to On Demand. Task Name: _unnamedTask<0> Status Code: -201087
I was following the nidaqmx tutorial from its website (https://nidaqmx-python.readthedocs.io/en/latest/).
with nidaqmx.Task() as task: task.ai_channels.add_ai_voltage_chan("Dev1/a10") task.read()
04-24-2018 01:34 PM
This discussion continues at Leitura de dados de uma fonte através do dispositivo NI 9233 e Python3