47.6.7.9 Programmable Hysteresis

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 47-13. Configuration of Input Multiplexes for OPAMP0 (Example: Vth = 3/4*Vcc, Ref = AVSS)
MUXPOSMUXNEGRES1MUXPOTMUXRES2VCCRES2OUTRES1ENANAOUT
OPAMP000010000100010110
Table 47-14. 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 47-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 47-15. Configuration of Input Multiplexes for OPAMP0 and OPAMP1 (Example: Vth = 1/3*Vcc, Ref = AVSS)
MUXPOSMUXNEGRES1MUXPOTMUXRES2VCCRES2OUTRES1ENANAOUT
OPAMP000010100001000110
OPAMP100010100001000110
OPAMP200010100001000110
Table 47-16. 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 47-11. Non-Inverting comparator with programmable hysteresis