04-03-2024 03:44 AM
Hello Community,
I am currently writing a python program with the NI-DAQmx Python Lib (v. 0.9.0) using a "cDAQ-9178" with a "NI 9216". I wan to read out the temperature, but I can't get the "ExcitationSource" in the code set. With the NI-Max it is working.
I am running Win10 with a python 3.12.2 .venv. I got the following Error:
nidaqmx.errors.DaqError: Requested value is not a supported value for this property. The property value may be invalid because it conflicts
with another property.
Property: DAQmx_AI_Excit_Src
Requested Value: DAQmx_Val_External
Possible Values: DAQmx_Val_Internal
Device: cDAQ1Mod1
Task Name: _unnamedTask<0>
Status Code: -200077
When I try to change from External to Internal, following the Doc. The Code looks like this, but I can not enter the "AIChannel" inside the Lib:
import nidaqmx
pp = pprint.PrettyPrinter(indent=4)
with nidaqmx.Task() as task:
task.ai_channels.add_ai_rtd_chan("cDAQ1Mod1/ai0")
task.channels.AIChannel(ai_excit_src=10200)
print("1 Channel 1 Sample Read: ")
data = task.read()
pp.pprint(data)
With this I got this error:
AttributeError: module 'nidaqmx.task' has no attribute 'channels'. Did you mean: 'Channel'?
nidaqmx.task.channels.AIChannel(ai_excit_src=10200)
this produces the same error.
cheers,
fme
Solved! Go to Solution.
04-03-2024 07:39 AM
Try this, not sure where you got the value 10200 though.
import nidaqmx
pp = pprint.PrettyPrinter(indent=4)
with nidaqmx.Task() as task:
task.ai_channels.add_ai_rtd_chan("cDAQ1Mod1/ai0", ai_excit_src=10200)
print("1 Channel 1 Sample Read: ")
data = task.read()
pp.pprint(data)
04-03-2024 09:01 AM
thanks for the reply Santhosh.
not sure where you got the value 10200 though.
I got it from here, it is the value behind the enum. But the hint was correct, I changed the code to following:
import nidaqmx
from nidaqmx.constants import ExcitationSource, ResistanceConfiguration,RTDType
pp = pprint.PrettyPrinter(indent=4)
with nidaqmx.Task() as task:
task.ai_channels.add_ai_rtd_chan("cDAQ1Mod1/ai0",
current_excit_source=ExcitationSource.INTERNAL,
current_excit_val=0.001,
rtd_type=RTDType.PT_3750,
resistance_config=ResistanceConfiguration.FOUR_WIRE)
print("1 Channel 1 Sample Read: ")
data = task.read()
pp.pprint(data)
Thanks!