Analog comparator reference selection

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

Can someone verify if the bandgap selection bit is valid when used with the AC or is it only valid when using the AD unit? I was looking at the data sheet for the Tiny45 and it didn't seem to indicate a definite answer either way unless I missed it somewhere?

Thanks,
Mike

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

Datasheet chapter "7.4 Minimizing Power Consumption":

Quote:
The Internal Voltage Reference will be enabled when needed by the Brown-out Detection, the
Analog Comparator or the ADC. If these modules are disabled as described in the sections
above, the internal voltage reference will be disabled and it will not be consuming power.

You can find further information in chapter "8.3 Internal Voltage Reference":
Quote:
The reference is on during the following situations:
1. When the BOD is enabled (by programming the BODLEVEL [2..0] Fuse Bits).
2. When the bandgap reference is connected to the Analog Comparator (by setting the
ACBG bit in ACSR).

3. When the ADC is enabled.
Thus, when the BOD is not enabled, after setting the ACBG bit or enabling the ADC, the user
must always allow the reference to start up before the output from the Analog Comparator or
ADC is used.
So yes, the AC can use the bandgap independant from the ADC.

Regards
Sebastian

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

I guess I wasn't clear in the wording of my question. I'm aware that the AC can use the internal ref. Some devices allow a selection bit to be set for 2 different internal references as well as an external ref. So my question is this selection bit valid for the AC also?

Thanks,
Mike

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

Quote:

So my question is this selection bit valid for the AC also?

What does it say in the datasheet about ACBG?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

ACBG always connects the internal 1.1V bandgap to the positive AC input.

But AIN0 and AREF share the same IO pin. So it may be possible to set up the ADC to use an external reference and then switch the positive AC input between the internal bandgap and the external reference.

Regards
Sebastian

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

theusch wrote:
Quote:

So my question is this selection bit valid for the AC also?

What does it say in the datasheet about ACBG?

You might want to start your own thread ;)

Quote:

• Bit 6 – ACBG: Analog Comparator Bandgap Select
When this bit is set, a fixed bandgap reference voltage replaces the positive input to the Analog
Comparator. When this bit is cleared, AIN0 is applied to the positive input of the Analog Comparator.
When the bandgap reference is used as input to the Analog Comparator, it will take a
certain time for the voltage to stabilize. If not stabilized, the first conversion may give a wrong
value. See “Internal Voltage Reference” on page 44.

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

Quote:
Some devices allow a selection bit to be set for 2 different internal references as well as an external ref.
Can you give an example? I'm not aware of an AVR with that feature.

Regards
Sebastian

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

Quote:
Table 17-3. Voltage Reference Selections for ADC
REFS2 REFS1 REFS0 Voltage Reference (VREF) Selection
X 0 0 VCC used as Voltage Reference, disconnected from PB0 (AREF).
X 0 1 External Voltage Reference at PB0 (AREF) pin, Internal Voltage
Reference turned off.
0 1 0 Internal 1.1V Voltage Reference.
0 1 1 Reserved
1 1 0 Internal 2.56V Voltage Reference without external bypass
capacitor, disconnected from PB0 (AREF)(1).
1 1 1 Internal 2.56V Voltage Reference with external bypass capacitor at
PB0 (AREF) pin(1).

This is a table from a Tiny45 data sheet. The table didn't copy over too well. The REF bits are set in the ADMUX register which is also where you set the multiplexed input for the AD and AC. I have a feeling it will always use the 1.1v ref as you stated before but I'm still not 100% sure.

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

OK, now I see. Unfortunately it's only a feature of the ADC. I don't know any AVR which can connect the 2.56V reference to the AC internally.
Well, you could feed a PWM into a low pass filter and connect the signal to AIN0. If you could spare the pins and the timer...

Regards
Sebastian

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

S-Sohn wrote:
OK, now I see. Unfortunately it's only a feature of the ADC. I don't know any AVR which can connect the 2.56V reference to the AC internally.
Well, you could feed a PWM into a low pass filter and connect the signal to AIN0. If you could spare the pins and the timer...

Regards
Sebastian

Okay, just needed to know if it was an option. Thank you for your input. It will saving me some time testing later :)