2.4 Schmitt Trigger
The Schmitt trigger is an analog comparator with hysteresis, a dead-zone where the output remains in the same state until the input exits the zone. This prevents a marginal signal from causing output oscillations. The output function for the Schmitt trigger is shown in the figure below.
Unlike other configurations, the feedback network is connected to the non-inverting input. This creates positive feedback, which helps the output latch to either VDD or GND.
The switching points of the Schmitt trigger are set by a combination of bias voltage and feedback resistors. In the state where the output is 0V, the feedback resistors act as a voltage divider. When the divided signal is greater than the bias voltage the output flips.
In the case where the output is VDD, the feedback resistors also act as a voltage divider (with the resistors flipped).
From these two expressions, the amount of hysteresis can be calculated:
If the microcontroller contains an integrated resistor ladder, rather than entering absolute values into the above expression, the values of the resistors relative to a fixed (or arbitrary) value (for example, R1 = 4R and R2 = 6R, where R is an unknown or arbitrary number) can be entered since the resistance units cancel out.