/* Assume that the null input is 0.5V */
/* Assume that the desired LSB of the lowest weighted bit is 50µV */
Max Reading = 65535 x 50e-6 /* 3.27675 */
CNT1 = 0.5 / 50e-6 /* 10000 */
CNT2 = 0.90 x FS / 50e-6 /* 58981.5 */
/* The null input is 0.5V and the 90% of FS input is 0.9*3.27675 = 2.949075V */
Set the trim-offset-register to zero
Set Right Shift register to zero (typically zero. See Right Shifting section above..)
Scale_result = 0h
Clamp = FFF8h/2Right_Shift_Register
For n = 15 down to 0,
Begin
scale_result = scale_result + 2n
Force the 90% FS input (2.949075V)
Meas2 = read the digital result from the part
If Meas2 >= Clamp then
scale_result = scale_result – 2n
Else
Begin
Force the null input (0.5V)
Meas1 = read the digital result from the part
If (Meas2 – Meas1) > (CNT2 – CNT1) then
scale_result = scale_result – 2n
End
End
Set the Scale register to scale_result