While both operational amplifiers and voltage comparators have been with us since before 1970, the similarities and differences tend to be vague. This discussion will help in understanding this important issue.
I well remember the first time that I saw an operational amplifier; it was 1965 at Cambridge Electron Accelerator –it was a mysterious box containing numerous transistors that could be connected in various ways for various functions. Both analog and digital integrated circuits (RTL –Resistor Transistor Logic) would soon be introduced, but I never could have guessed what the future would hold. Now some 50years later having used both op amps and comparators, I have good understanding of these devices and wish to pass some practical information along.
Perhaps the most popular operational amplifiers are the venerable LM741 and the more recent LM324. The most popular comparators include the LM311 and the LM339. These were developed by National Semiconductor, soon became industry standards and subsequently licensed and enhanced by numerous manufacturers including TI, Motorola etc.
A cursory glance may suggest that the two schematics are very similar with both having identical differential inputs, but observe the differences in the output structure. The LM324 has a complementary output while the LM339 is open collector. In the complementary output, current can flow in either direction as required (either source or sink) while the open collector output can only sink current. This basic difference is typical of all op amps and comparators (although a few comparators have complementary outputs).
Another more subtle difference is the presence of a compensation capacitor in the op amp –this is typical of perhaps 99% of all op amps. An operational amplifier is slowed down by the compensation capacitor in order to make it stable (prevent oscillation), while a comparator is intended to be as fast as possible in order to minimize propagation delay and to provide fast transition time at the output. However, both op amps and comparators often share this common problem: unwanted oscillation.
The operational amplifier is intended for linear operation where the output may be at any voltage within the limits of the power supply rails. The voltage comparator is simply a 1bit analog to digital converter where the output is always in positive or negative saturation.
Power supplies (or rails)
The ground rail is generally logic common. In a single supply comparator, it is also generally the negative rail or the most negative voltage in the circuit. Some comparators like the LM311 cannot compare voltages at ground potential due to limitations in the common mode input voltage range so they require a negative rail to power the analog section. These devices offer a separate logic ground pin that is tied to logic common. So in the LM311 class of comparators there are (3) rails: common, analog positive and analog negative. A possible 4th rail would be the logic positive rail that is equal or lower in voltage than the analog positive power supply rail –this is what powers the output pull-up resistor. The analog positive and negative rails are often ±12V, but can actually be whatever is desired or required such as ±5V –also, they need not be equal in voltage.
Note that some comparators (perhaps 10%) have a complementary rather than open collector output –with such, the analog positive rail must be equal in voltage to the logic positive rail.
Open collector output
The open collector output is the usual means of interfacing the comparator output to the logic input. Such requires an external pull-up resistor. It allows the logic positive rail to be lower in voltage than the analog positive rail. Open collector outputs also provide the means of a “wired OR” connection where multiple open collector outputs are tied together –all open collector outputs must be high (OFF) in order for the output to go high.
Op amps as comparators
Op amps are frequently used as comparators –I do this commonly. This is practical where high speed is not a requirement and where single supply operation is feasible. Note also that op amps and comparators have incompatible pin-outs and cannot easily be substituted.
Comparators as op amps
Very, very seldom are comparators used as op amps, but never say never. Here is an application note that shows how to make it work. The addition of the output capacitor slows the device so that it can operate without oscillation in the linear output voltage range. The only time this might be practical is when a low performance op amp function is required, but the only device available is one section of an LM339 quad comparator. Now, I have never done this, but it would make a great experiment.
Use the LP311 instead of the LM311
While the LM311 will probably never go away, it is a power hog with a supply current of 5mA. The LP311 runs about 300uA –much better for battery and experimental applications. “LP” indicates “Low Power.”
For the future
Applying a comparator as an op amp, an experiment