English: Illustration of how a comparator works. The schematic diagram (left) shows a comparator A with a constant voltage VREF equal to half the supply voltage VCC/2 applied to its inverting input by a voltage divider consisting of the two resistors R, and a triangle wave VIN applied to its noninverting input. The graph (right) shows the input and output waveforms. The output of the comparator VOUT is in a high state (saturated) when VIN > VREF and zero when VIN < VREF. A comparator consists of a specialized high speed op amp.