3-Bit DAC Demo

In this section of the exercises, we now turn our attention to analog--analog output in particular. This will also include learning how to do some audio-based things as well.

Let's begin with digital-to-analog conversion (DAC). Perhaps the first approach to occur is simply to use binary weighted resistors, and let three port pins drive them. To lower the output impedance and make the affair into something usable, we'll buffer the result with an op-amp. Here's the circuit:

You'll note that the resistors follow a doubling progression. Because each is twice as large as the previous, there are definite limits in how easily this can be extended to more bits. However, three-bits works out just fine with standard 5% resistor values.

The PMP software is ingenuous and straightforward. The waveform created by it in this demo is just a staircase, with eight steps. But obviously, other patterns are possible through software manipulation.

You'll note that the waveform has an amplitude of about 5V, and a frequency of about 1 kHz. If you'd like to change the frequency, look for the Pascal delay() command in the main loop.

Click to get the source code.
Click to get the schematic PDF.

Next Project: 4-Bit DAC Demo

No comments:

Post a Comment