Connect with us

Atmega16 adc question

Discussion in 'Electronic Design' started by Mark, Dec 1, 2004.

Scroll to continue with content
  1. Mark

    Mark Guest

    I want to use a precision 5 volt reference as Vref for the adc on an
    Atmega16. My problem is that the Vcc uses a common 78L05 regulator, whose
    output can range from 4.75 to 5.25 volts. Can I tie the AVCC to the 5 volt
    reference instead of Vcc? Will I get accurate adc readings if Vcc is say 4.8
    volts while AVCC is 5.00 volts? Thanks for any advice.

  2. Sander Kool

    Sander Kool Guest

    This is a very legal question. Of course, Atmel does not specify the maximum
    voltage between AVCC and VCC. One would expect it to be around 0,5V
    to avoid NP conduction.

    An alternative may be to reference Vcc from your AVcc, using a series diode
    with your reference, and an emittor follower transistor as buffer.
    If you prefer using a regulator IC (lower output impedance than the emittor
    you can use a LM337 (1.25V step) and reference it to your AVcc with a
    resistive divider.

  3. The AtMega16L specs say AVcc must be within +/- 0.3 volts of digital
    Vcc. So you are just within spec at +/- 0.25 volts range. Therefore it
    should be ok. Personally I would use a closer tolerance device than the
    78L05. My current favourite is the LP2951.

    Note also that if you go the other way, and elect to tie AVcc to Vcc,
    then Vref *cannot* exceed Vcc.


    Adrian Jansen adrianjansen at internode dot on dot net
    Design Engineer J & K Micro Systems
    Microcomputer solutions for industrial control
    Note reply address is invalid, convert address above to machine form.
  4. Rich Webb

    Rich Webb Guest

    Check the datasheet. AVcc limits: (Vcc - 0.3, Vcc + 0.3) and (2.7, 5.5).
    ARef limits: (2.0, AVcc) single-ended, (2.0, AVcc - 0.2) differential.
    A 5 V AVcc looks OK to me.

    On the mega16, you can program the ADMUX register to connect AVcc to
    ARef internally, in which case a capacitor can be hung off of ARef to
    soak up noise.

    The successive approximation DAC only cares about its voltage reference,
    not the chip's Vcc, so as long as none of the recommended limits are
    exceeded and the precision voltage reference can source enough current,
    you should be OK.
  5. Perhaps you can use the internal reference if you divide down the voltages
    to be measured - however, full scale will be equal to Vint, about 2.56
    volts, not AVcc.

    Actually, the LM78L05 drift is smaller than some regulators, and may be
    acceptable for your application - (check datasheet) - the issue is you can't
    predict the voltage of an individual device. In that case, you can put a
    calibration factor in EE memory and multiply your ADC reading by that.
    You'll probably need calibration anyway.

  6. Rich Webb

    Rich Webb Guest

    Although the AVR chips are broadly similar, there are differences in the
    details. On the mega16, the bits REFS1 and REFS0 in the ADMUX register
    control what voltage is used as the ADC reference.

    REFS1 controls a mux that selects between AVcc and the 2.56 V bandgap
    reference. REFS0 controls a gate that connects the output of the mux to
    the approximation DAC.

    If ADMUX is written with 01xx_xxxx then AVcc will be used.

    See Figure 98 and Table 83.
  7. Mark

    Mark Guest

    Thanks for all the info and help. I think I have a handle on it now.
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