Electronic Design

Create A D/A Output Using Two Pins On A PIC Micro

With the addition of only a resistor and a capacitor, the low-cost eight-pin PIC12C671 can be used to provide an 8-bit digital-to-analog output (Fig. 1). Of course, this topology will work with almost any microprocessor that has an internal analog-to-digital (A/D) peripheral.

Following a simple concept, one of the microcontroller's A/D inputs monitors the voltage across an external capacitor (C1). Next, one of the digital I/O port pins pulls the voltage up or down (through R1) until it reaches the required value. When the digital I/O isn't being used to set the voltage on C1, it serves as a high-impedance input.

The flow diagram regulates the voltage across C1 at a rate of about 1 LSB per microsecond (Fig. 2). Therefore, C1 can be shifted (up or down) quickly enough to settle even a near-rail-to-rail output adjustment in about 20 ms. More clever algorithms, which match the pulse-adjustment time with the error, will obviously allow much faster convergence.

To view a sample code listing for the PIC12-C671, go to www.PlanetEE.com and click on "Ideas for Design."

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish