Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

setting ai.max and ai.min

I am using LV8.2 and a compact daq chassis.  i am trying to programmatically set the scaling for my analog inputs, to do this I am using the DAQmx property nodes as can be seen in the attached jpeg.  The issue that I am having is that after I set my AI.max and AI.min property nodes and save them, I read them back and they are not the same as what I just set them.  For example, I am setting the slope to 1, that will set AI.max to 10 and I have a 0 hard wired to AI.min.  When the values are read back they are 10 and -10.  If i set it to 2 I get 20 and -20.  When i check the values in MAX, I see that they are updating properly, ie: I am getting values of 10 and 0 or 20 and 0 as they should be.  My question is why is the AI.min value that I am reading back different than the actual value in MAX?
0 Kudos
Message 1 of 2
(4,284 Views)
bkling,

Let's suppose that you're using an NI 9215 and that you have set the linear scaling parameters to be slope=1 y-intercept=0. The NI 9215 does not support the 0V to 10V range in hardware, so when you specify AI.Min=0 AI.Max=10, DAQmx automatically coerces it to AI.Min=-10 AI.Max=10. However, it remembers that you originally specified that the input range was AI.Min=0 AI.Max=10. When you call DAQmx Save Global Channel.vi, the input range you specified gets written to MAX, not the coerced input range. MAX doesn't display the coerced input range.

Another thing to consider is that DAQmx scales AI.Min/AI.Max by your custom scaling parameters. For analog input, it applies the custom scaling parameters in reverse to the input range that you specified before finding the best hardware input range, and then it applies them forwards when it coerces the AI.Min and AI.Max properties. With the NI 9205, which happens to have a -5V to 5V range, specifying AI.Min=0 AI.Max=10 slope=2 would cause DAQmx to look for a hardware range that contains 0V to 5V. DAQmx would choose the -5V to 5V range, and then it would coerce AI.Min=-10 AI.Max=10. With the NI 9215, since there is no -5V to 5V range, DAQmx would choose the -10V to 10V range, and would finally coerce AI.Min=-20 AI.Max=20.

Also note that if you want to specify/query the hardware range directly in volts instead of the units defined by your custom scale, you can do so using the AI.Rng.Low and AI.Rng.High properties, which are in the DAQmx Channel property node under Analog Input > General Properties > Advanced > Range.

Please let me know whether this helps clear things up or just confuses the issue,
--Brad
---
Brad Keryan
NI R&D
0 Kudos
Message 2 of 2
(4,273 Views)