To detect the interruption of a light beam or a reflective surface, a LED sends light detected by a phototransistor. If only the static level is used, stray light may falsely indicate a reflecting surface or not detect an interruption. This circuit uses modulated light that is detected by a PLL, so any light of a differnent frequency or phase is ignored.
Transistor Q1 drives the LED with the correct phase; R4 determines its current.
If there is strong stray light, R2 might be reduced to avoid saturation of the photo transistor.
Output on pin 8 is on if the light of the correct phase and freqency is stable. It can drive 100mA (on) and withstand 15V (off).