I am trying to obtain a square wave using a comparator and a sine wave signal. Sine wave has adjustable peak to peak amplitude with +10/-10 volts as limits.

TL071 runs with +12/-12 volts. Sine wave has a frequency of 16 kHz

I connected the sine wave to the non-inverting input and ground to the inverting input. I can’t get any output signal, output is always 0 volts.

Comparator and sine wave

*Lines going up are attached to the virtual oscilloscope.

  • \$\begingroup\$ in the simulation, or in real life? \$\endgroup\$
    – Neil_UK
    Commented Jun 16, 2021 at 21:29
  • 2
    \$\begingroup\$ Are the supply voltages actually there? \$\endgroup\$
    – user173271
    Commented Jun 16, 2021 at 21:50
  • \$\begingroup\$ Both in simulation and real life. Yes supply voltages are really there, since there are 2 other opAmps I made rail and connected them all to it. \$\endgroup\$
    – Tombeki
    Commented Jun 17, 2021 at 5:03
  • 1
    \$\begingroup\$ Something shorts the opmp output to ground. \$\endgroup\$
    – Audioguru
    Commented Oct 12, 2022 at 14:42

1 Answer 1


Grounding the negative input will kill the output. Connect the negative input directly to the output, feed the signal to the positive input, then you form a non-inverting buffer.

  • 3
    \$\begingroup\$ He doesn't want a buffer, he wants a comparator \$\endgroup\$
    – pipe
    Commented Oct 12, 2022 at 13:06
  • \$\begingroup\$ Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. \$\endgroup\$
    – Community Bot
    Commented Oct 12, 2022 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.