Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I obtain the coefficients m, b from MAX scale?

I use CWAI ActiveX for acquire data. Also, I use MAX to set the virtual channels for CWAI. When I try to use scale option of MAX (for exemple y = 0.5x + 3 to transforn volts in my phisics values) I obtain true data from ScaledData (phisics values), but I can't obtain true data from (BinaryCodes x GetScaleMultiplyer) + GetScaleOffset. How can I obtain true value from binarycodes?
How can I obtain m and b from ActiveX?
0 Kudos
Message 1 of 2
(2,342 Views)
drg,

The GetScaleOffset & GetScaleMultiplier refer to the hardware factors used by the driver to transform the binary values produced by the ADC converter to actual Voltage values (not physical units of the Virtual Channel).

The documentation (NI-DAQ 6.9.3) for the ScaleMultiplier property mentions this:

"Returns the slope in the linear scaling formula for converting the binary codes of the analog-digital converter to voltages. The CWAI control multiplies the binary code by the ScaleMultiplier and adds the ScaleOffset to convert a binary code to a voltage.

(BinaryCode * ScaleMultiplier) + ScaleOffset = Voltage"

If the signal range was, for example +/- 5 V, the multiplier for a 12 bit board would be approximately 0.00244141 so that:

2047 * 0.002441
41 = 5V

NOTE: The 12 bit range (4096 words) is divided into +2047 / -2048

Unfortuantely there is not a function or method in the CWDAQ API to obtain or set parameters from the Custom Scales used by the Virtual Channels.

The reason for this is probably due to the fact that once Virtual Channels are created, most users would read in scaled values directly rather than reading binary values, getting the scale constants and applying the custom scale themselves. Since the user specifies the values for the custom scales anyway, the application could as well store the scaling constants as part of its configuration.

Still, it would be nice to have this functionality so I thank you for pointing this out. I will create a suggestion indicating the need for such functions.

The ways to achieve the results you desire are:

1) Use Virtual Channels and read scaled data

or

2) Use the ScaleMultiplier and ScaleConstants to transform binary values into actual voltage values. Once
you obtain the voltage values you can manually apply the same custom linear scale you had created through MAX.

Regards,

Alejandro Asenjo
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(2,342 Views)