The Op Amp comparators sometimes works well under some conditions but not always. If there is a slow wave form or some noise on it, sometimes the output switch back and forth many times. So for stable operation, Op Amp comparator can be designed as a Schmitt trigger.
Schmitt trigger was inverted by an American scientist Otto Schmitt. The Schmitt trigger switches at different voltages depending upon whether it is moving from low to high or high to low, employing what is termed hysteresis.
By adding some positive feedback to the Op Amp comparator its stability can be increased. Here, a resistor is connected between the Non Inverting input to the output. This Feedback resistor gives different switching thresholds dependent upon the output state of the comparator.
When the output of the comparator is high, that voltage is fed back to the Non-inverting input of the comparator.
As a result of this feedback, the switching threshold becomes higher. When the output is switched in the opposite sense, the switching threshold is lowered. This gives the circuit a Hysteresis. The Hysteresis depends on the value of Feedback resistor.