Figure 1

simulate this circuit – Schematic created using CircuitLab
I am using a TL074CN comparator to compare a fullwave rectified input voltage with a DC voltage of 1.4 V as shown in the above figure. At the output of the comparator, I am receiving a square wave which goes from +12V to -12V.
Figure 2
The figure 2 above shows the square wave generated in microsecond level. As you can see the waveform is very unstable at the moment. So far what I tried was
1) I also added a 100u capacitor at the output of the opmamp but it doesn't stabilize the waveform , it instead curves the waveform at the edges
2) I added a 10K resistor at the output but it doesn't help either.
3) I switched the TL074CN with an LM324N and still did not stabilize the waveform
Is there anything which I can do to make this square wave stable?


Channel 1 is the DC source of +12 and -12 with a potentiometer. Channel 2 is the Fullwave rectifier waveform. Channel 3 is the square wave
I was using channel 2 which is the full wave rectifier waveform and it displayed an unstable square wave. But when I changed to channel 3, the results were different which I have explained in a separate answer below.
– Amy Jul 14 '17 at 01:40