Comparators compare two voltages and output “high” or “low” based on which voltage is higher. A slightly modified version of the op-amp assumptions apply:
i+=i−=0 v+>v−→vOUT=VDD v+<v−→vOUT=VSS
Note the following:
When solving comparator problems, you have to essentially solve the circuit for each possible state. Luckily, there are only two possible states:
For a comparator in positive feedback,
Let's look at this specific example:
No matter the state of the circuit, this relation is true due to the voltage divider relation:
v+=R2R1+R2vOUT
And the negative terminal voltage is simply equal to the input voltage:
v−=vIN
Let's first look at the case where v−<v+, so vOUT=V. In this case,
v+=R2R1+R2V
This means that this circuit will stay in this state as long as v−<R2R1+R2V. If v− crosses the threshold R2R1+R2V, the output of the circuit will change to vOUT=−V.
Let's now look at the other case, where v−>v+, so vOUT=−V. In this case,
v+=R2R1+R2(−V)=−R2R1+R2V
This means that this circuit will stay in this state as long as v−>−R2R1+R2V. If v− crosses the threshold −R2R1+R2V, the output of the circuit will change to vOUT=V.
To summarize the results, if vOUT=V, for vOUT to transition to −V, vin has to become greater than R2R1+R2V. And if vOUT=−V, for vOUT to transition to V, vin has to become less than −R2R1+R2V. Notice that the threshold for the input voltage changes depending on the current output voltage. This gives us hysteresis.
Let's plot the transfer curve (output voltage as a function of input voltage) of this behavior.
Notice the arrows on the inner rectangle. They signify that to go from a high output to low output, the input must cross R2R1+R2V, whereas to go from a low output to a high output, the input must cross −R2R1+R2V.
What if we apply a triangle wave to the input?