Ron H had suggested an LM339 that I've tinkered with to compare voltages. After doing a bit of reading I learned that many op amps can be configured as comparators. Watch out for hysterisis (or more important, the lack of). In the LM339 applications data there is info on how to build in some hysterisis.
Some bits of information:
In this application, hysterisis is the difference between the voltages between the amounts to turn the comparator on and off. My reading tells me that the difference can be very small - .01 volt or less. My experience has shown me that extreme sensitivity can produce a situation where the system simply oscillates around that toggle point because of noise or other things. Some hysterisis or differential needs to be built into some systems to prevent this problem. Thermostats for home heating are designed to have a differential so that the furnace doesn't cycle on and off when very near the setpoint. For many situations a "try it and see" approach is the place to start with an awareness of this problem.
In my reading several authors describe a comparator as an op amp with no feedback/very high gain. Others say that an op amp configured with very high gain becomes a comparator. Hysterisis or a difference in the switching points can be introduced by adding some feedback or reducing the gain. It appears that this is exactly what they show in the LM339 applications literature.
I was working on an electronic replacement for old tractor voltage regulators and an LM339 was suggested. We want to step the voltage like the old relays did so that they new version behaves like the old one. I decided to take a step back and build some tools - a decent breadboard, power supply, etc., to facilitate experimenting. I am almost done with that and will be back to the comparator work soon.