Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Python script: Getting an Error with newer nidaqmx versions

Hi,

I'm using python and the nidaqmx python-module. I'm using the NI Hardware cDAQ-9178 + NI9213 + NI9219. The following script is working on an older Laptop (#1) but throws an error on a newer Laptop (#2).

 

import nidaqmx
from nidaqmx.constants import ThermocoupleType, AcquisitionType, ExcitationSource, ResistanceUnits, ResistanceConfiguration

try:
    task = nidaqmx.Task('logger')
    task.ai_channels.add_ai_thrmcpl_chan(physical_channel='cDAQ1Mod1/ai0', thermocouple_type=ThermocoupleType.K)
    task.ai_channels.add_ai_resistance_chan(physical_channel='cDAQ1Mod2/ai0', min_val=100.0, max_val=1000.0, units=ResistanceUnits.OHMS, resistance_config=ResistanceConfiguration.TWO_WIRE, current_excit_source=ExcitationSource.INTERNAL, current_excit_val=0.0005)
    task.timing.cfg_samp_clk_timing(rate=10000, sample_mode=AcquisitionType.FINITE, samps_per_chan=6)
    task.start()
    data = task.read(nidaqmx.constants.READ_ALL_AVAILABLE)
    print(data)
    # print('{:.2f}°C'.format(data[0][0]))
    # print('{:.2f}Ohm'.format(data[1][0]))
    task.stop()
    task.close()

except (KeyboardInterrupt, SystemExit):
    print('*** Exit ***')
   
except Exception as e:
    print('*** Error ***')
    print(e)

Laptop #1:

  • nidaqmx 0.5.7
  • NI-DAQmx (not sure, where can I check this?)
  • NI MAX 20.0.0f0

 

Laptop #2:

  • nidaqmx 0.6.3
  • NI-DAQmx 21.8
  • NI MAX 21.5.0f239

Attempt to get property failed, because you specified multiple channels, and the property has different values for different channels.

Get this property one channel at a time.

Property: DAQmx_AI_MeasType

Task Name: logger

Status Code: -200657

0 Kudos
Message 1 of 1
(172 Views)