Connect with us

Digital to multiple analog conversion

Discussion in 'Electronic Basics' started by Dave, Sep 12, 2006.

Scroll to continue with content
  1. Dave

    Dave Guest

    How would one go about taking say 8 or more digital 'on/off' signals
    from a microcontroller, and producing 8 steady analog outputs that each
    can vary from say 0-255? I will be using a microcontroller with up to
    16 bidirectional pins, 32 altogether, which seems like plenty of pins,
    but not enough to provide each analog output with 8 pins to control the
    analog value. Is there a way to do this, or any MCU that would help?
     
  2. Joerg

    Joerg Guest

    Hello Dave,


    You could but it may not be worth it. 8bit multi-channel DACs are cheap
    and plentiful. If you absolutely have to do it search Google for "R2R
    network".

    Basically it would go like this: Eight port pins run to staggered
    (increasing value) resistors. One each. Their other ends are summed into
    a common current node, usually done with an opamp. Now you could use
    another eight pins, eight FETs and eight capacitors to sample and store
    eight different DAC values. If you wanted to be really frugal you could
    do that with a 8:1 mux a la 74HC4051. That reduces the number of
    selector port pins from eight to three. So you could rent out the five
    freed ones :)
     
  3. Chris

    Chris Guest

    Hi, Dave. If you can bit-select your uC pins as input or output,
    here's the easiest low-cost/low-resolution way to get a lot of analog
    outputs from uC pins (view in fixed font or M$ Notepad):

    |
    | VCC
    | +
    |uC Out ___ |\|
    | >----|___|-o-----|+\ Vout
    | 10K +| | >--o---->
    | --- .-|-/ |
    | 1uF --- | |/| |
    | | | === |
    | === | GND |
    | GND '-------'
    (created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de)


    Here's the drill: By using a PWM output from the microcontroller, you
    can use the R, C, and op amp voltage follower to get the analog output.
    Start out with the uC pin as an input (Hi-Z -- doesn't source or sink
    current). Now, when you're ready to refresh the analog output, swwitch
    the pin to an output. If you wanted the output to be 5V or 100% of
    Vcc, you would leave the output high 100% of the time. If you wanted
    the output to be 50% of Vcc, you would have it high 50% and low 50%,
    and so on. When you're done with the analog refresh, just switch the
    pin back to being an input.

    This can be a lot simpler than it sounds, if you use assembly language
    here. Just add the digital number 0 to 255 into an 8-bit accumulator,
    and output high at your pin if there's a CY, else low. Piece of cake,
    and you only have to do it for 50ms. or so per output with the above
    component values. If you're going to be refreshing frequently, you
    might even be able to use the ubiquitous LM324 as the op amp. But if
    you only want to refresh every second or even less, use a rail-to-rail
    input and output op amp with low bias current. An advantage of this is
    that you can bring the cap down to 0.1uF or less, and then you only
    have to refresh for 5ms. or less per analog channel.

    Read your uC data sheet -- there may be weak pulldowns/pullups/current
    sources/sinks at certain pins which make this idea unuseable. As
    always, know your hardware.

    And if this idea isn't for you (rather processor-intensive or you need
    the capability to interrupt while refreshing), try a serial DAC.
    Microchip makes several good ones, as do many other manufacturers.
    You'll pay 3 to 6 times as much per channel, AFAIK.

    http://www.microchip.com

    Good luck
    Chris
     
  4. John Fields

    John Fields Guest

     
  5. Dave

    Dave Guest

    Thanks for the quick reply, and to Jeorge as well. It will take me a
    few days to understand your solutions, and am still debating whether to
    make this capability a part of my first project or not. I am using a
    Microchip PIC processor at the moment so it might be convenient to get
    the serial DAC the same company. Thanks again.
     
  6. You could use 2 of these, with an 8 bit data bus, and a few other bits
    to send the data to one of the 8 outputs.
    http://www.analog.com/en/prod/0,2877,AD7226,00.html
    or one of these
    http://www.analog.com/UploadedFiles/Data_Sheets/251994480ad7228a.pdf#search="dac octal 8 bit"
    If you don't like those, you can get enough key words off them to look
    for others.
     
  7. jasen

    jasen Guest

    either PWM (in software or hardware) or use a DAC chip.



    Bye.
    Jasen
     
  8. Jamie

    Jamie Guest

    PWM. (pulse Width Modulation) through a passing circuit for each.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-