Book Analog Interfacing to Embedded Microprocessors
ing transistor into account when selecting the reference voltage. Of course,
the comparator output is only valid when the LED is turned on.
Although a disconnected LED is much more likely than a shorted LED,
you can add a second comparator to detect that condition. The reference
voltage would be around .6V and the software would declare an error if the
voltage drops below the reference.
Optical Isolators
Figure 3.12 shows an optical isolator. The optical isolator (called an optoiso-
lator or optocoupler) houses an LED and a phototransistor in a package like
an IC. The optical isolator is sealed—there is no way to break the light path.
The optical isolator is not used to detect mechanical motion, but to provide
electrical isolation between two electrical circuits. A common use for optical
isolators is to isolate a high-voltage circuit from the microprocessor that con-
trols it. MIDI (Musical Instrument Digital Interface) uses optical isolation to