Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Anyone know how to set analog input resolution in nidaq-mx via python

I'm trying to work out how to tell a USB-6216 to change an analog input resolution via Python using nidaq-mx library. Does anyone know how to do this? The documentation for nidaqmx is completely opaque on this aspect.

Thanks /A

0 Kudos
Message 1 of 6
(2,751 Views)

Hi AdMico, I don't have much experience in Python but can answer your question.

USB-6216 has 16bit ADC and you can make smaller the resolution by configuring "AI Range".

 

Case1:

Range = +/-10V

Resolution = (+10-(-10))/2^16

 

Case2:

Range = +/-5V

Resolution = (+5-(-5))/2^16

Certified LabVIEW Developer
There are only two ways to tell somebody thanks: Kudos and Marked Solutions

GCentral
0 Kudos
Message 2 of 6
(2,708 Views)

Thanks, but that's the problem, I know that bit, I just can't find in the nidaq-mx documentation where it tells you how to issue that command via Python. Is there a nidaq-mx support or board that I should post this to instead?

0 Kudos
Message 3 of 6
(2,703 Views)

Excuse me, I may not understand what are you looking for.

You can configure the range with method below.

https://nidaqmx-python.readthedocs.io/en/latest/ai_channel.html#nidaqmx._task_modules.channels.ai_ch...

 

ni-daqmx provides the support and you can configure it on all NI DAQ devices.

Do I have any misunderstanding?

Certified LabVIEW Developer
There are only two ways to tell somebody thanks: Kudos and Marked Solutions

GCentral
0 Kudos
Message 4 of 6
(2,694 Views)

Sorry, but that's still not helping me much. It has a command with 15 million options, and no information about how to structure the command to set any of them. It's like documentation that was written by an engineer with no idea how unintelligible it's going to be to someone who isn't an expert already on the system.

 

Is there something, somewhere, that tells me in an understandable way how to implement a change in *any* of those 15 million options there? I can probably work from one to any of the other 14,999,999 options, but my problem is, what's on that page, is completely useless in terms of someone slightly new to the software knowing how to actually use it.

 

/A

0 Kudos
Message 5 of 6
(2,683 Views)

Hi AdMico, the input range will automatically adjusted based on the expected max and min value specified. For example, if you have the code: 

 

import nidaqmx
task = nidaqmx.Task()
task.ai_channels.add_ai_voltage_chan("Dev1/ai0", min_val=-2, max_val=7)

The AI range will change to ±10 V, which is one of the supported range for USB-6216

 

But if you still want to manually change the range. You can use the code below to configure ai_rng_high property:

 

import nidaqmx
task = nidaqmx.Task()
a = task.ai_channels.add_ai_voltage_chan("Dev1/ai0")
a.ai_rng_high = 10.0
-D
Message 6 of 6
(2,662 Views)