06-28-2022 04:44 AM
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:
Laptop #2:
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