![GigaDevice Semiconductor GD32E23 Series Скачать руководство пользователя страница 169](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32e23-series/gd32e23-series_user-manual_2225794169.webp)
GD32E23x User Manual
169
It can handle multiple conversions and average them into a single data with increased data
width, up to 16-bit. The on-chip hardware oversampling circuit is enabled by OVSEN bit in
the ADC_OVSAMPCTL register.It provides a result with the following form, where N and M
can be adjusted, and D
out
(n) is the n-th output digital signal of the ADC:
Result =
1
M
∗ ∑
𝐷
𝑂𝑈𝑇
(𝑛)
n=N−1
n=0
(10-1)
The on-chip hardware oversampling circuit performs the following functions: summing and
bit right shifting.The oversampling ratio N is defined by the OVSR[2:0] bits in the
ADC_OVSAMPCTL register. It can range from 2x to 256x. The division coefficient M means
bit right shifting up to 8 bits. It is configured through the OVSS[3:0] bits in the
ADC_OVSAMPCTL register.
Summation units can produce up to 20 bits (256 x 12-bit), which is first shifted right. The
upper bits of the result are then truncated, keeping only the 16 least significant bits rounded
to the nearest value using the least significant bits left apart by the shifting, before being
finally transferred into the data register.
Figure 10-11. 20-bit to 16-bit result truncation
Raw 20-bit data
19
15
11
7
3
0
15
11
7
3
0
Shifting
Truncation and
rounding
Note
: If the intermediate result after the shifting exceeds 16 bits, the upper bits of the result
are simply truncated.
Figure 10-12. A numerical example with 5-bit shifting and rounding
example of the processing, from a raw 20-bit accumulated data to the final 16-bit result.