14.1.2 Offset and Slope [T-Series Datasheet]
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
.