English
Language : 

RM0366 Datasheet, PDF (222/868 Pages) STMicroelectronics – This reference manual targets application developers
RM0366
Analog-to-digital converters (ADC)
12.3.26 Data management
Data register, data alignment and offset (ADC_DR, ADC_DRx, OFFSETx,
OFFSETx_CH, ALIGN)
Data and alignment
At the end of each regular conversion channel (when EOC event occurs), the result of the
converted data is stored into the ADC_DR data register which is 16 bits wide.
At the end of each injected conversion channel (when JEOC event occurs), the result of the
converted data is stored into the corresponding ADC_JDRx data register which is 16 bits
wide.
The ALIGN bit in the ADC_CFGR register selects the alignment of the data stored after
conversion. Data can be right- or left-aligned as shown in Figure 53, Figure 54, Figure 55
and Figure 56.
Special case: when left-aligned, the data are aligned on a half-word basis except when the
resolution is set to 6-bit. In that case, the data are aligned on a byte basis as shown in
Figure 55 and Figure 56.
Offset
An offset x (x=1,2,3,4) can be applied to a channel by setting the bit OFFSETx_EN=1 into
ADC_OFRx register. The channel to which the offset will be applied is programmed into the
bits OFFSETx_CH[4:0] of ADC_OFRx register. In this case, the converted value is
decreased by the user-defined offset written in the bits OFFSETx[11:0]. The result may be a
negative value so the read data is signed and the SEXT bit represents the extended sign
value.
Table 37 describes how the comparison is performed for all the possible resolutions for
analog watchdog 1.
Table 35. Offset computation versus data resolution
Resolution
(bits
RES[1:0])
Substraction between raw
converted data and offset:
Raw
converted
Data, left
aligned
Offset
Result
Comments
00: 12-bit DATA[11:0]
OFFSET[11:0]
signed 12-bit
data
-
01: 10-bit
DATA[11:2],00
OFFSET[11:0]
signed 10-bit
data
The user must configure OFFSET[1:0]
to “00”
10: 8-bit
DATA[11:4],00
00
OFFSET[11:0]
signed 8-bit
data
The user must configure OFFSET[3:0]
to “0000”
11: 6-bit
DATA[11:6],00
0000
OFFSET[11:0]
signed 6-bit
data
The user must configure OFFSET[5:0]
to “000000”
DocID025203 Rev 2
222/868
273