07-29-2020 07:24 AM
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
Solved! Go to Solution.
07-29-2020 09:59 AM
07-29-2020 10:09 AM
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
07-29-2020 10:34 AM - edited 07-29-2020 10:35 AM
Sorry about that. Here is are screenshots of code and NI-Max configurations.
07-29-2020 10:44 AM
So the "pre-scaled" should be the distance and the 'scale' set as the voltage read by the DAQ?
07-29-2020 11:07 AM
@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.
07-29-2020 01:16 PM - edited 07-29-2020 01:17 PM