# Techniques for analyzing Comparator circuits?

I'm looking for some general guidelines/equations I can use to analyze circuits which use comparators. In particular, I'm interested in hysteresis.

For example, take the following open collector/drain comparator circuit with hysteresis:

How did they derive the equations for calculating hysteresis? I tried doing some analysis assuming op-amp like behavior (assumed that input terminals source/sink negligible current, did not assume that the input terminals have equal voltages, clamped output voltage to [Vee, Vcc]), but I wasn't able to get the desired output results.

-

I generally first make an assumption about the state of the comparator (is it sinking, or is it high impedance) then do the derivations.

First assume the comparator is sinking. Because it's sinking, assume that pin 2 is at $V_{EE}$ potential. You may also assume that the comparator is able to sink enough current through $R_{PULL-UP}$ as to not allow it to source any current onto the R1-R2 net. The voltage at pin 10 becomes a simple voltage divider.

Next assume the comparator is high-impedance. Now you have a net with three resistors and two voltage sources ($V_{REF}$ and $V_{PULL-UP}$), since the comparator is (ideally) out of the equation now. Find the total current in the branch and calculate the voltage.

-
Oh durr, I know what I was doing wrong. Assumed i1 and i2 both flow into node 10, but my equation was i1 = i2 instead of i1 + i2 = 0 :P – helloworld922 Jan 14 '13 at 21:31

A comparator isn't an op-amp. The output doesn't have a linear region to speak of, so you can't really treat it as a linear device.

The equations are based on modifying the reference voltage depending on whether the output is high or low. Suppose the output is sitting high, with the input low (inverting mode). The feedback divider biases the reference at some level. When the input exceeds that level the output toggles low, the reference input drops to a lower level, and the input will need to cross that lower level to toggle the output high again. The voltage difference between these two levels is the amount of hysteresis.

This has a better discussion of comparators with hysteresis

-