English
Language : 

C8051F124-GQR Datasheet, PDF (100/350 Pages) Silicon Laboratories – Mixed Signal ISP Flash MCU Family
C8051F120/1/2/3/4/5/6/7
C8051F130/1/2/3
7.3. ADC2 Programmable Window Detector
The ADC2 Programmable Window Detector continuously compares the ADC2 output to user-programmed
limits, and notifies the system when a desired condition is detected. This is especially effective in an inter-
rupt-driven system, saving code space and CPU bandwidth while delivering faster system response times.
The window detector interrupt flag (AD2WINT in register ADC2CN) can also be used in polled mode. The
ADC2 Greater-Than (ADC2GT) and Less-Than (ADC2LT) registers hold the comparison values. Example
comparisons for Differential and Single-ended modes are shown in Figure 7.6 and Figure 7.5, respectively.
Notice that the window detector flag can be programmed to indicate when measured data is inside or out-
side of the user-programmed limits, depending on the contents of the ADC2LT and ADC2GT registers.
7.3.1. Window Detector In Single-Ended Mode
Figure 7.5 shows two example window comparisons for Single-ended mode, with ADC2LT = 0x20 and
ADC2GT = 0x10. Notice that in Single-ended mode, the codes vary from 0 to VREF*(255/256) and are
represented as 8-bit unsigned integers. In the left example, an AD2WINT interrupt will be generated if the
ADC2 conversion word (ADC2) is within the range defined by ADC2GT and ADC2LT
(if 0x10  ADC2  0x20). In the right example, and AD2WINT interrupt will be generated if ADC2 is outside
of the range defined by ADC2GT and ADC2LT (if ADC2  0x10 or ADC2  0x20).
Input Voltage
(AIN2.x - AGND)
REF x (255/256)
ADC2
0xFF
REF x (32/256)
REF x (16/256)
0x21
0x20
0x1F
0x11
0x10
0x0F
AD2WINT
not affected
Input Voltage
(AIN2.x - AGND)
REF x (255/256)
ADC2LT
AD2WINT=1
ADC2GT
REF x (32/256)
REF x (16/256)
ADC2
0xFF
0x21
0x20
0x1F
0x11
0x10
0x0F
AD2WINT=1
ADC2GT
AD2WINT
not affected
ADC2LT
0
0x00
AD2WINT
not affected
0
0x00
AD2WINT=1
Figure 7.5. ADC2 Window Compare Examples, Single-Ended Mode
100
Rev. 1.4