41.6.10.9 Programmable Hysteresis

Each OPAMP can be configured as an inverting or non-inverting comparator with programmable hysteresis. Applying hysteresis will prevent constant toggling of the output, caused by noise when the input signals are close to each other.

In both inverting and non-inverting comparator configurations the positive input is connected to the resistor ladder. When OPAMP is configured as an inverting comparator with programmable hysteresis, the input voltage must be applied to the negative input and RES1MUX must be connected to the ground. When an OPAMP is configured as a non-inverting comparator with programmable hysteresis, the input voltage must be applied to RES1MUX and the negative input must be connected to the ground.

To configure an OPAMP as an inverting comparator with programmable hysteresis, the OPAMPCTRLx register can be configured as follows:

Table 41-12. Configuration of Input Muxes for OPAMP0 and OPAMP1 (Example: Vth = 3/4*Vcc, Ref = GND)
MUXPOSMUXNEGRES1MUXPOTMUXRES2VCCRES2OUTRES1ENANAOUT
OPAMP0001000110010110
OPAMP1001000110010110
OPAMP2001000110010110
Table 41-13. POTMUX [2:0]: Potentiometer Selection
ValueR1R2Threshold = Vcc * R1 / (R1 + R2)
0x014R2R7/8 * Vcc
0x112R4R3/4 * Vcc
0x28R8R1/2 * Vcc
0x36R10R3/8 * Vcc
0x44R12R1/4 * Vcc
0x53R13R3/16 * Vcc
0x62R14R1/8 * Vcc
0x7R15R1/16 * Vcc
Figure 41-10. Inverting comparator with programmable hysteresis

To configure an OPAMP as a non-inverting comparator with programmable hysteresis, the OPAMPCTRLx register can be configured as follows:

Table 41-14. Configuration of input muxes for OPAMP0 and OPAMP1 (Example: Vth = 1/3*Vcc, Ref = Gnd)
MUXPOSMUXNEGRES1MUXPOTMUXRES2VCCRES2OUTRES1ENANAOUT
OPAMP0001000001000110
OPAMP1001000001000110
OPAMP2001000001000110
Table 41-15. POTMUX [2:0]: Potentiometer Selection
ValueR1R2Threshold = Vcc * R1 / R2
0x014R2RVcc * 7 (unused)
0x112R4RVcc * 3 (unused)
0x28R8RVcc (unused)
0x36R10R0.6* Vcc
0x44R12R1/3 * Vcc
0x53R13R3/13 *Vcc
0x62R14R1/7 * Vcc
0x7R15R1/15 * Vcc
Figure 41-11. Non-Inverting comparator with programmable hysteresis