Analog-to-digital converters (ADC)
RM0365
323/1080
DocID025202 Rev 7
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
and
Offset
An offset y (y=1,2,3,4) can be applied to a channel by setting the bit OFFSETy_EN=1 into
ADCx_OFRy register. The channel to which the offset will be applied is programmed into the
bits OFFSETy_CH[4:0] of ADCx_OFRy register. In this case, the converted value is
decreased by the user-defined offset written in the bits OFFSETy[11:0]. The result may be a
negative value so the read data is signed and the SEXT bit represents the extended sign
value.
describes how the comparison is performed for all the possible resolutions for
analog watchdog 1.
When reading data from ADCx_DR (regular channel) or from ADCx_JDRy (injected
channel, y=1,2,3,4) corresponding to the channel “i”:
•
If one of the offsets is enabled (bit OFFSETy_EN=1) for the corresponding channel, the
read data is signed.
•
If none of the four offsets is enabled for this channel, the read data is not signed.
,
and
show alignments for signed and unsigned
data.
Table 90. Offset computation versus data resolution
Resolution
(bits
RES[1:0])
Substraction between raw
converted data and offset:
Result
Comments
Raw
converted
Data, left
aligned
Offset
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”