English
Language : 

AN1711 Datasheet, PDF (8/40 Pages) STMicroelectronics – SOFTWARE TECHNIQUES FOR COMPENSATING ST7 ADC ERRORS
SOFTWARE TECHNIQUES FOR COMPENSATING ST7 ADC ERRORS
2 SOFTWARE TECHNIQUES
2.1 AVERAGING TECHNIQUE
Averaging is a simple technique where you sample an analog input several times and take the
average of the results. This technique is helpful in eliminating the effect of noise on the analog
input or wrong conversion.
As we take the average of several readings, these readings must correspond to the same an-
alog input voltage. You should take care that the analog input remains at the same voltage
during the time period when the conversions are done. Otherwise you will add digital values
corresponding to different analog inputs and introduce errors.
In other words the analog input should not change in-between the different readings consid-
ered for the averaging.
It is better to collect the samples in multiples of 2. This makes it more efficient to compute the
average because you can do the division by right-shifting the sum of the converted values.
This saves CPU time and code memory needed to execute a division algorithm.
For example take 8,16, 32 samples etc., and then take the average.
Figure 1. Graphical representation of Averaging technique
Digital
Output
Average
Value
Number of Conversions
Practical measurement
To obtain the results, this averaging technique is used to measure the voltage on one of the
microcontroller’s analog input pins. A total of 16 conversions is taken and the average is cal-
culated. This is done in a loop in the firmware.
8/40