The following circuit is a comparator, which compares input square signal at non-inverting pin with fixed reference voltage at inverting pin of integrated comparator circuit LM393 (\$R\$ is collector resistor since this comparator has open collector). If \$V_{IN}>V_{REF}\$ then \$V_{OUT}=V_{CC}\$. If \$V_{IN}<V_{REF}\$ then \$V_{OUT}=0V\$.
simulate this circuit – Schematic created using CircuitLab
As I built this circuit on breadboard I noticed that \$V_{IN}\$ has to differ at least few 100 mV in order for comparator to switch between \$V_{CC}\$ and 0V. However such behavior is undesired since input square signal's amplitude varies only few 10 mV between HIGH and LOW states. So I set \$V_{REF}\$ in the middle between two input voltage states, but comparator didn't change its output.
But shouldn't the comparator change its output even for slight voltage difference between two inputs? According to equation, which applies for differential structure amplifying devices such as comparator and operational amplifier, my statement is correct. This equation goes as follows:
$$ V_{OUT}=A_{OL}(V_+-V_-) $$ $$ V_{OUT}=A_{OL}(V_{REF}-V_{IN}) $$
Also, if I would design a simple differential structure amplifier with discrete components, which would most probably have much smaller open-loop gain and other deficiencies, a slight voltage difference between two inputs would result in much greater voltage difference at its output.
NOTE: I also tried replacing this integrated comparator circuit with operational amplifiers TL072 and LM358, where both of them indicate similar behavior.
Any ideas if this behavior is normal to all operational amplifiers and comparators? How else could I compare input signal, which varies only for few 10 mV if not this way?