« Close

Datasheets and User Guides

App Notes

Software & Driver

 

14.1.2 Offset and Slope

Overview

AIN#_EF_INDEX: 1

This Offset and Slope Extended Feature automatically adds a slope and an offset to analog readings.

Configuration

To configure, write to the following registers.

AIN#_EF_CONFIG_D - Slope: Custom slope to be applied to the analog voltage reading. Default is 1.00.
AIN#_EF_CONFIG_E - Offset: Custom offset to be applied to the analog voltage reading. Default is 0.00.

Remarks

The normal analog input settings are used for negative channel, resolution index, settling, and range.

Results

For results, read AIN#_EF_READ_A.

AIN#_EF_READ_A - Returns the calculated voltage:

measured volts * slope + offset

Only reading AIN#_EF_READ_A triggers a new measurement.

Example

To configure Offset and Slope AIN-EF for AIN3:

AIN3_EF_INDEX = 1         // feature index for Offset and Slope
AIN3_EF_CONFIG_D = 2.0    // slope
AIN3_EF_CONFIG_E = -0.5   // offset

Now each read of AIN3_EF_READ_A will return (AIN3 volts * 2.0) - 0.5.

5 comments

Please specify range for slope and offet. I seem to have a problem with negative offsets.

Can this EF be used to convert LM34CAZ (10mV per Fahrenheit) readings into Centigrade values?

Any 32-bit float should be fine, but I just tested (easy to do on Analog Inputs tab of Kipling3) and get an Invalid Value error when I try to write a negative offset.  We will follow up. 

I tested using eWriteName and eReadName in LabVIEW and negative offset works fine, so perhaps a problem in Kipling3.  We will follow up.

Kipling3 (version 3.0.2) is now updated to work with negative slopes and offsets.

Edit: Added version.

*WOW*

Thank you very much for this immediate response.

Not just a reply, but also a bug-fix in less than 24 hrs!

Greetings from Germany,

Martin