Analog Circuits: World Class Designs

Bonnie Baker
| Note | Here Bonnie shows how a comparator and a few Rs and Cs can help a microcontroller make a surprisingly good Digital-to-Analog Converter (DAC) or a slow but simple ADC. /rap |
When you move your analog problem solving from hardware to firmware, a few useful processor or controller peripherals will take you a long way. These peripherals include the pulse width modulator (PWM), the comparator, a timer or two, and the I/O gates. Although all these peripherals sound like they are digital, we are going to use them to an analog advantage in our circuits.
The PWM might or might not be a part of your controller or processor arsenal. If the PWM function is an internal function from your digital chip manufacturer, you can use it to produce fairly accurate voltage references. If you don't have a PWM on board, you can generate the signal in firmware. The voltage source generated by this tool is as accurate as your on-board timer and power supply voltage. The only thing this voltage reference requires is a PWM generator and an analog filter.
You will find that there is probably an integrated comparator in your controller or processor. If not, an I/O gate can take over this function for some applications in which you are looking for a trigger or level indicator of an analog signal. I prefer working with a comparator because the threshold is usually more predictable than your run-of-the-mill digital I/O pins. You can design...