LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI DAQmx scaling not working correctly

Solved!
Go to solution

I'm using a position sensor that outputs 0-to-10 volts for 0-to-75 mm distance. The 0-to-10 volt signal is applied to channel 14 and AGND of a  PCI-6351.  I have no problem reading and displaying the signal in my LabVIEW 2016 32-bit program.

 

I thought I would use "custom scaling" in NI-Max (v 19.5) task set up for the position sensor to automatically convert the voltage to distance with the equation  Y=7.5*X.  Unfortunately, the conversion is way off.  For example, for 3.21 volts, the DAQmx Read VI outputs a value of 15.84 instead of 24.075.

 

The DAQmx task is configured with "signal input range" min at -10, max at 10. The terminal configuration is set to "RSE".  For now, I've turned off scaling, set "scaled units" to "volts", and am converting the value from the DAQmx Read VI in code.

 

Is there a setting I'm missing to get scaling to work?

 

Thanks,

Ron

0 Kudos
Message 1 of 7
(2,895 Views)

Hi mysticfree,

 

unfortunately you forgot to attach any code (aka VI) to your message.

You also forgot to attach a screenshot of the scaling settings you have configured in MAX. (I would create the scale in the VI…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(2,852 Views)

Short answer: when using built-in DAQmx scaling, the input range should be specified as the *post-scaling* values.  In your case, that'd be +/- 75 (for mm) rather than +/- 10.

 

Longer answer: when you wired in +/-10, DAQmx figured, "the max value *after* scaling will be 10.  The scaling equation tells me that the voltage for that max value will be 10/7.5.  So I'll need to use the internal gain corresponding to my available voltage range +/-2 V.

     Now your real voltage signal will get clipped to something near a +/- 2V range.  (Actual clipping happens just beyond the nominal range, but accuracy and linearity aren't guaranteed out there.)   It looks to me like the actual clipping point is about 2.11 V.   Any input voltage above that would end up reporting the same scaled result 15.84.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 3 of 7
(2,848 Views)

Sorry about that.  Here is are screenshots of code and NI-Max configurations.

2020-07-29 11_30_25-.png2020-07-29 11_32_16-get position sensor in mm.vi Block Diagram.png

0 Kudos
Message 4 of 7
(2,845 Views)

So the "pre-scaled" should be the distance and the 'scale' set as the voltage read by the DAQ? 

0 Kudos
Message 5 of 7
(2,842 Views)
Solution
Accepted by topic author mysticfree

@mysticfree wrote:

So the "pre-scaled" should be the distance and the 'scale' set as the voltage read by the DAQ? 


You have that backwards.  The scale is applied to the voltage to give you a scaled value, in your case mm.  However, when you set the Max and Min of a channel, it needs to be set based on the post-scale values.  In your specific case, it is 0mm to 75mm.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 7
(2,835 Views)

Hi mysticfree,

 

like this:


Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 7
(2,785 Views)