Analog-to-Digital Converter (ADC) RM0046
584/936 Doc ID 16912 Rev 5
23.3.5 Programmable analog watchdog
Introduction
The analog watchdogs are used for determining whether the result of a channel conversion
lies within a given guarded area (as shown in Figure 284) specified by an upper and a lower
threshold value named THRH and THRL respectively.
Figure 284. Guarded area
After the conversion of the selected channel, a comparison is performed between the
converted value and the threshold values. If the converted value lies outside that guarded
area then corresponding threshold violation interrupts are generated. The comparison result
is stored as WTISR[WDGxH] and WTISR[WDGxL] as explained in Tabl e 29 2 . Depending on
the mask bits WTIMR[MSKWDGxL] and WTIMR[MSKWDGxH], an interrupt is generated on
threshold violation.
The TRC[THRCH] field specifies the channel on which the analog watchdog is applied. The
analog watchdog is enabled by setting the corresponding TRC[THREN].
The lower and higher threshold values for the analog watchdog are programmed using the
THRHLR registers.
For example, if channel number 3 is to be monitored with threshold values in THRHLR1,
then the TRC[THRCH] field is programmed to select channel number 3.
A set of threshold registers (THRHLRx and TRCx) can be linked only to a single channel for
a particular THRCH value. If another channel is to be monitored with same threshold values,
then the TRCx[THRCH] must be programmed again.
Note: If the higher threshold for the analog watchdog is programmed lower than the lower
threshold and the converted value is less than the lower threshold, then the WDGxL
interrupt for the low threshold violation is set, else if the converted value is greater than the
lower threshold (consequently also greater than the higher threshold) then the interrupt
Table 292. Values of WDGxH and WDGxL fields
WDGxH WDGxL Converted data
1 0 converted data > THRH
0 1 converted data < THRL
0 0 THRL <= converted data <= THRH
THRH
THRL
Analog voltage
Upper threshold
Lower threshold
Guarded area