# How is a square wave generated?

With regard to the picture below, it says with an AC signal as an input, the output is a square wave. I am familiar with the uses of op-amps like in differentiator, integrator, inverting and non-inverting, active filters etc. But those I can memorize their configuration. But this I could not understand.

• It's not a square wave: it's an infinitely high sine-wave clipped at the power-supply rails.
– Dan
Dec 17, 2019 at 9:04
• Well, that means it is a square wave, but you see what I mean?
– Dan
Dec 17, 2019 at 9:05
• No, it's not a square wave - the high/low plateaus are of different duration.
– Chu
Dec 17, 2019 at 14:33
• The corners are square but we reserve “square” for more or less desired 50% symmetry Dec 18, 2019 at 23:53

This operates like a comparator except rather than open drain or collector is a push-pull to bipolar supplies (Vcc~Vee) minus some dropout voltage. The output is slew-rate limited to the component spec [V/us].

Remember that the (open loop) output inverts when the inputs are not equal (ignoring Vio offset) .

## Other

This is not how you draw a sine wave which is more like triangular but peaks are smooth about 25% below the apex. You often see people draw sinewaves this wave with far too much "risetime". When we measure risetime of a pulse from 10 to 90% there is a formula to estimate the bandwidth BW(-3dB) BW= 0.35/Tr (10~90%)

Here is how you can verify a hand drawn wave using 3/4 of a triangle.

Since an open loop Op Amp may saturate internally after the internal compensation , then the linear GBW does not apply and the slew rate is limited by the output stage current limit defined in the datasheet. There may be reverse recovery times specified for overdrive unlike a good comparator IC.

That is just used as a comparator. The sine wave is either above or below the reference and that is the result of the comparison.

• Okay 😅, now I got it. Thank you 👍
– f321
Dec 16, 2019 at 21:30
• Is that all?.... Dec 18, 2019 at 23:54

If you consider the inverting mode amplifier with which you are familiar you should be able to spot:

simulate this circuit – Schematic created using CircuitLab

Figure 1. An inverting amplifier. If Rf is omitted, then Rf = ∞ and the gain becomes the open-loop gain of the op-amp.

1. The signal is applied to the inverting input so it's an inverting amplifier.
2. R2 and R3 provide a reference voltage for the non-inverting input. R2 should, presumably, be connected to +VS.
3. There is no negative feedback resistor or, to put it another way, Rf = ∞ so the gain is "infinite".

As soon as VIN- exceeds VIN+ the output will swing to the negative rail. When the situation is reversed the output will swing to the positive rail.

• no, that wouldn't make sense. Dec 16, 2019 at 21:45
• Okay you mean of the op-amp. Ok
– f321
Dec 16, 2019 at 21:49