44.6.10.10 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 44-15. Configuration of Input Multiplexes for OPAMP0 (Example: Vth = 3/4*Vcc, Ref = GND)
MUXPOS MUXNEG RES1MUX POTMUX RES2VCC RES2OUT RES1EN ANAOUT
OPAMP0 0001 000 010 001 0 1 1 0
Table 44-16. POTMUX [2:0]: Potentiometer Selection
Value R1 R2 Threshold = Vcc * R1 / (R1 + R2)
0x0 14R 2R 7/8 * Vcc
0x1 12R 4R 3/4 * Vcc
0x2 8R 8R 1/2 * Vcc
0x3 6R 10R 3/8 * Vcc
0x4 4R 12R 1/4 * Vcc
0x5 3R 13R 3/16 * Vcc
0x6 2R 14R 1/8 * Vcc
0x7 R 15R 1/16 * Vcc
Figure 44-11. 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 44-17. Configuration of Input Multiplexes for OPAMP0 and OPAMP1 (Example: Vth = 1/3*Vcc, Ref = Gnd)
MUXPOS MUXNEG RES1MUX POTMUX RES2VCC RES2OUT RES1EN ANAOUT
OPAMP0 0001 010 000 100 0 1 1 0
OPAMP1 0001 010 000 100 0 1 1 0
OPAMP2 0001 010 000 100 0 1 1 0
Table 44-18. POTMUX [2:0]: Potentiometer Selection
Value R1 R2 Threshold = Vcc * R1 / R2
0x0 14R 2R Vcc * 7 (unused)
0x1 12R 4R Vcc * 3 (unused)
0x2 8R 8R Vcc (unused)
0x3 6R 10R 0.6* Vcc
0x4 4R 12R 1/3 * Vcc
0x5 3R 13R 3/13 *Vcc
0x6 2R 14R 1/7 * Vcc
0x7 R 15R 1/15 * Vcc
Figure 44-12. Non-Inverting comparator with programmable hysteresis