EMBEDDED SYSTEMS & MICROCONTROLLERS · PAGE 75
Comparators and DAC Outputs
Analog tricks inside the chip.
A comparator tells you which of two voltages is higher, and answers much faster than an ADC. It can wake the chip from sleep when a signal crosses a threshold.
A digital-to-analog converter does the reverse of an ADC: it outputs a voltage from a number. Use it for audio tones, test signals or setting a reference level.
If your chip has no DAC, a PWM output plus a resistor and capacitor filter makes a rough substitute.