I can't find the right formula for calculating hysteresis.
For example, my Vref is 0.5V. I want the output to go high when Vin is 0.55V and low when Vin is 0.45V. Hysteresis band of 100mv.
Supply rails are +5V and -5V. Output is 0V to 5V.
I tried using the formula :
Vth+ = Vcc(R1/R1+R2) + Vref(R2/R1+R2)
Vth- = Vss(R1/R1+R2) + Vref(R2/R1+R2)
Can't get R1 and R2 to get the required hysteresis voltage.
Do you want to have two threshold voltages? Usually hysteresis is done dynamically, using the output of the comparator as the threshold control.
At any rate, it seems that you are using a voltage divider to create Vth+ and Vth-. Attached is the correct one, with formulas:
Vth+=(Vcc-Vss)*(R2+R3)/(R1+R2+R3)
Vth-=(Vcc-Vss)*R3/(R1+R2+R3)