|
This schematic allows to sample an analog input as a sensor, but without taking care of the reference accuracy. By this way, you won't have to calibrate the sensor by software which means no end of line procedure for calibration.
Moreover, it could also avoid to have bad measures when several sensors are wired to a same reference and that the reference voltage decreases.
.
By computing the ratio between the two analog inputs, the result is independent from the accuracy of Vref because Vsig will always be a ratio of Vref. This means that whatever the value of Vref, the ratio won't change.
Let's take R1 = R3 and R2 = R4 to have the same gain on each input. Then, the sensor signal value becomes :
So, to keep low resolution, you could write in C :
u16SensorValue = (u8Asip_AN2 * 100) / u8Asip_AN1;
The result will then be a integer between 0 and 100 (i.e. 0 to 100%)
If more resolution is needed, you could write :
u32SensorValue = (u8Asip_AN2 * 10000) / u8Asip_AN1;
The result will have be an integer between 0 and 10000 (i.e. 0.00 to 100.00%)
|