The routines described here read the position of a potentiometer by a ratio technique. The measured value is scaled to a value between 0 and max, using a successive approximation technique.
The two halves of the pot are measured and the two measured values are added togther to get the range. These values vary due to component tolerences and variation in supply voltage. However these are greatly nullified by the scaling routine.
Starting with the measured value of range, it is itterated down to the measured value of B. The same itteration decisions are applied to Max value, resulting in value so that:
value = MaxValue * B / range
Tests show that the ratio: ( value / position of Pot ) can be much more accurate than the component tolerences would suggest. The values of A and B are measured by the circuit below.
Visit Here for more.