A microcontroller produces a PWM (pulse width modulated) digital output signal which is filtered by a low-pass RC filter. Although the PWM signal has a fixed repetition rate the on-to-off ratio is varied from 0 to 100 % which, after filtering gives an analogue output signal proportional to the ratio. A single digital output from a port pin (driven from an on-chip timer for example) can therefore form the basis of an analogue output signal.
http://ww1.microchip.com/downloads/en/AppNotes/00538c.pdf
Discussion (0 comments)