From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Changeing "DAQmx_AI_Excit_Src" in python lib

Solved!
Go to solution

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

0 Kudos
Message 1 of 3
(211 Views)
Solution
Accepted by topic author fmesnnhsr

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)

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 3
(169 Views)

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!

0 Kudos
Message 3 of 3
(160 Views)