Product Specs

Table Of Contents
38 COMP Comparator
Page
394
Restriction: Depending on the device, not all the analog inputs may be available for each MUX.
Figure 110: Comparator in differential mode
VIN+
VIN- + (V
DIFFHYST
/ 2)
VIN- - (V
DIFFHYS T
/ 2)
t
Output
Figure 111: Hysteresis enabled in differential mode
38.3 Single-ended mode
In single-ended mode, VIN- is derived from the Reference Ladder.
The Reference Ladder uses the reference voltage VREF to derive two new voltage references, VUP and
VDOWN. VUP and VDOWN are configured via THUP and THDOWN in the TH register. VREF can be
sourced from any of the available references sources as illustrated in Figure 112: Comparator in single-
ended mode on page 395. This is configured via EXTREFSEL and REFSEL.
When the comparator core detects that VIN+ > VIN-, i.e. ABOVE as per the RESULT register, VIN- will
switch to VDOWN. When VIN- falls below VIN- again, VIN- will be switched back to VUP. By specifying VUP
larger than VDOWN, a hysteresis as illustrated in Figure 113: Hysteresis example where VIN+ starts below
VUP on page 395 and Figure 114: Hysteresis example where VIN+ starts above VUP on page 396 can
be generated. In single-ended mode, the PSEL, MODE, EXTREFSEL, REFSEL and TH registers must be
configured before the COMP is enabled via the ENABLE register.
Restriction: Depending on the device, not all the analog inputs may be available for each MUX.
Writing to the HYST register has no effect in single-ended mode, and the content of this register is ignored.
PSEL
ISOURCE
VIN+
VIN-
+
-
MODE
Comparator
core
RESULT
Output
0 = BELOW (VIN+ < VIN-)
1 = ABOVE (VIN+ > VIN -)
MUX
MUX
EXTREFSEL
ABOVE BELOW
(VIN+ > (VIN- + V
DIFFHYS T
/2)) (VIN+ < (VIN- - V
DIFFHYS T
/2))
ABOVE
(VIN+ > (VIN- + V
DIFFHYS T
/2))
BELOW
SAMP LE
READY
STOP
DOW N
START
CROSS
AIN0
AIN1
AIN2
AIN3
AIN4
AIN5
AIN6
AIN7
UP
AIN0
AIN1