Can't use ADC0 if VCC is selected as reference?

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just saw this note in the Attiny84 spec (page 145, section 16.13.1):

 

Internal voltage reference options may not be used if an external voltage is being applied to the AREF pin.

 

I may be have been bit by this on my most pcb design.   The voltage I want to convert is on the ADC0 pin, and I was planning to use VCC as the reference (for maximum dynamic range).

 

Is use of vcc as a reference considered to be "an internal voltage reference option"?  

 

Thanks!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

That refers to physically connecting a voltage source to the AREF pin. When you use Vcc as the reference, that is an internal connection. Then, the  only thing you connect to AREF is a bypass cap.

 

Note what  the spec sheet says for ADMUX register. For REFS1 = 0 and REFS0 = 0: VCC used as analog reference, disconnected from PA0 (AREF). So, using this setting, there is an internal connection from Vcc to make it THE voltage reference.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Last Edited: Fri. Jan 11, 2019 - 08:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I saw that.  But, being in denial, I was hoping I was not interpreting that correctly.

 

Probably explains why I always read 3ff!

 

So, you have to burn an extra IO if you want to use vcc as a reference. 

 

Can the internal 1.1V reference be used if the voltage to be measured is on ADC0?  This isn't considered " an external voltage is being applied to the AREF pin."?

 

I'm already resistor scaling a battery voltage to keep it below vcc, so I can just change a resistor value and live with the reduced dynamic range.

 

Thanks!

 

  

Last Edited: Fri. Jan 11, 2019 - 09:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Oh, I see your "issue". I don't specifically know the T84. But, here is what the alternate pin function section says:

 

• Port A, Bit 0 – ADC0/AREF/PCINT0

ADC0: Analog to Digital Converter, Channel 0.

AREF: External Analog Reference for ADC. Pullup and output driver are disabled on PA0 when the pin is used as an external reference or Internal Voltage Reference with external capacitor at the AREF pin by setting (one) the bit REFS0 in the ADC Multiplexer Selection Register (ADMUX).

 

And, for the  ADMUX register:

 

It is not allowed to connect internal voltage reference to AREF pin, if an external voltage is being applied to it already. Internal voltage reference is connected AREF pin when REFS1:0 is set to value ‘11’.

Thus, I interpret this to means that if you set REFS1:0 = '00', there is no connection between the reference system and AREF = ADC0. Thus, I assume that with the '00' value, you CAN use ADC0 as an ADC input.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Select the first config above and VCC is the reference and you can use ADC0 any way you want!

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

back to wishful thinking again...

 

So, I do want to set REFS1:0 to '00" to use vcc for the reference.    But, then I'm back to the not understanding what this means:

 

Internal voltage reference options may not be used if an external voltage is being applied to the AREF pin.

If I it's ok to use REFS1:0=0 with ADC0, then vcc must not be considered an "internal voltage reference option".   

 

But, note the use of plural in "internal voltage reference options".  Options are:

 

Vcc                is this external or internal option?

External         voltage on AREF pin is the voltage reference

Internal          1.1 voltage reference (clearly an internal reference)

 

So, if there is more than one internal voltage reference option, vcc must be considered an internal option.

 

(Or, someone just copy pasted that sentence from another spec that had more reference options)

 

It's not working now with using  REFS1:0 = '00'.  ADC0 voltage is around 2.5 volts, yet I read FFF.

 

I could post the code, but I don't want to take up people's time unless it's for sure it's ok to use REFS1:0=0 with the voltage to be measured on ADC0,

 

I'll first try using the 1.1V reference and change the resistor scaling.  If I start getting something reasonable, I'll have to conclude our original interpretation was correct (you can't use ADC0 for input with vcc as the reference).

 

Unless anyone is quite confident that it's ok to do this...

 

Thank you!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim, I posted before I ready your latest.

 

So, I'll post the code...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

While simplifying the code before posting, I found the problem.

 

I'd selected ADC1 instead of ADC0 for the input (ADMUX was 0x1 instead of 0x0).

 

Now, I get something reasonable--haven't compared to DVM reading yet, but at least it's not 0xfff and pretty close to what I'd expect the scaled battery voltage to be.

 

So, I'm probably good.  But, I can't say I understand the note.  What can't I do if a voltage is applied to the AREF pin?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

davethomaspilot wrote:
What can't I do if a voltage is applied to the AREF pin?

 

You can't use an internal reference, but looking at the ADC block diagram, I would say that this restriction does not really exist.  Otherwise ADC0 would be useless.

 

Edit: Looked at block diagram.

 

In consideration of others, please RTFM!

Last Edited: Sat. Jan 12, 2019 - 05:30 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So, if the internal reference is used,  ADC0 cannot be used as the analog input for ADC?

 

 

Last Edited: Sat. Jan 12, 2019 - 03:00 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

(Of course you can't use an internal reference if you select VCC as a reference.  You just choose the internal reference instead of vcc.)

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

davethomaspilot wrote:
So, I do want to set REFS1:0 to '00" to use vcc for the reference. But, then I'm back to the not understanding what this means: Internal voltage reference options may not be used if an external voltage is being applied to the AREF pin.
I expect that's a datasheet copy/paste errata.  Most other AVR devices have that limitation.  In those devices, AREF has no alternate function.  Internally, AREF is permanently connected to the ADC comparator.  The REFS bits will select from a choice of internal references, or none so that an externally applied voltage can be used as reference.  That's why those devices' datasheet issue that warning.  Were you to apply a voltage to their AREF pin, you'd be contending with any configured internal reference, and likely let the magic smoke out.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

You cant use the internal 1.1V source if you have a voltage present to the AREF pin, I think the internal 1.1v is applied to that pin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok,

 

Just want to confirm that you definitely CAN use ADC0 as the analog input for conversion while using VCC as the reference.  It works fine.

 

If Kuch is right, then use of the internal reference burns an I/O in addition to the analog voltage to be converted.  It must be left open and probably decoupled.  Worth noting at pcb design time!

 

Thanks!