I have wired up the LM311 circuit shown in the figure below. It should work as follows (at least to my understanding), when V+ (pin 2) > V- (pin 3) the output (pin 7) should rise to 12V and when V+ < V- the output should fall to Gnd. I have applied a 1kHz square with an amplitude of 1V swinging around Gnd to pin 2 (V+), see scope image on the second picture. I expect a square wave from 0V to 12V on the output but instead it stays at approximately -12V (CH2 on the scope image), so i.e. at Vee. Even when I apply 12V on pin 2, the output stays at -12V.
My question: Why is this happening? Shouldn't it also produce a square wave on the output? Is there an error in my circuit?