I’ve have hundreds of thousands of units in the field where I used an op amp as a comparator, but its not a calkwalk by any means… in fact, as a friend says, its challenging Mr Murphy. I do not recommend doing so… but, marketing cost targets and pcb real estate limitations, combined with a left over op amp in a quad package may end up making it worth considering. Thus, lets look at a few issues.
Op Amps are dog slow compared to comparators
The most apparent issue is op amps are dog slow compared to comparators. Now, if your signals are pretty slow, speed is likely a non issue.
Be wary of an op amps output topology and power supply
Next is the matter of the op amps output. Ie, if you are using bipolar power supplies for the op amps, and the op amp/comparator feeds a micro, you need to play a few games, and that will add some cost and real estate. Or perhaps you are able to run the op amp on a unipolar supply, and it has a rail to rail output, and you will use the same power supply for the micro… expect Mr Murphy to arrive, as you chase op amp instability due to unintentional positive feedback (mostly due to common mode effects). Such scenarios can be a real bear to deal with, requiring untold number of pcb revs to make things happy and stable… and what if the pcb gets dirty with age, throw in a little leakage to create a positive feedback path, and now you have field failures left and right.
If you are tempted to try something like this, add a second analog supply, separate grounds, use faraday shields, and consider conformal coating. Then, once you are all done, go hammer on the input, and look for any signs of instability… hammer it hard, you may be surprised that you still have work to do. With such a topology, you are likely asking to see Mr Murphy at every turn, so put up lots of stop signs, and once installed, hammer them to make sure they are solid.
Phase Inversion, oh noes!
Then comes phase inversion… yes, the term op amp vendors dont like to talk about. Comparators are designed to have a substantial differential input voltage and the resulting currents to some extent as well, op amps on the other hand, are applied where the differential input voltage is theoretically zero, same with input current (Vos, Ib, and layout issues obviously preclude it from being zero, but you get the idea..) If you go outside of the maximum speced differential, expect that you might see phase inversion. It happens with a lot of common op amps, perhaps less so with todays designs than years ago… but no one likes to talk about it. DO NOT EXPECT SPICE MODELS to show this, in fact dont expect spice models to show much of any real world behavior…. Also be aware, it is possible each time the op amp gets whacked with an out of spec differential, it may be degraded permanantly… Not a good spot to be in.
Internal Protection Diodes may bite
And speaking of damage…. some op amps have internal protection diodes, so, if you go outside of the differential input specs, you fire them up… expect all sorts of bizarre and unexplained behavior. This could include thermal issues on the die adjacent to the internal ground making for all sorts of fun scenarios, long after the op amp signals have returned to a nominal state.
Apart from damage, pretty much anytime you get very far from zero volts differential on an op amp input, performance specs can get very dodgy. Sometimes manufacturers will spec out how performance degrades… often times, being such is a misapplication of an op amp, they leave that information off the datasheet. And yes, Spice models as a general rule wont tell you either, even more so, if temperature varies.
Dont use op amps as comparators, but if you must
So… what to do… dont try it, but if you must, go over the datasheets with a fine tooth comb. Look for gotchas on the input and output specs. Be very careful to avoid unintentional positive feedback paths. Give the apps guys at call at the factory, and ask em straight out. Can I do this… they will tell you NO, but they may offer particular suggestions which might help. They know folks misapply their parts all the time… They also know that some op amps plain and simple will not work as comparators no matter how much tweaking one does. In other cases, they must admit some models can do well in such a topology, provided the designer does their homework ahead of time.