Book Analog Interfacing to Embedded Microprocessors
Another problem, also shown in Figure A.4, is the effect of a slowly changing input
with noise. When the difference between the input and the reference is small, low-
amplitude noise on the input can cause the output to switch several times between the
high and low states. If the comparator output is an interrupt input to a microproces-
sor, this can cause real problems.
One way to avoid the problems associated with slowly changing inputs is to add hys-
teresis to the circuit. Figure A.5 shows the same comparator circuit we’ve been looking
at, with hysteresis added. A resistor, R2, is connected to the noninverting input and
the output. A second resistor is connected between the reference voltage and the
240 Appendix A
Appendix A
Figure A.4
241
Comparator with slowly changing input.
Figure A.5
Comparator with hysteresis.
noninverting input