AVR Butterfly/ADC Question

Started by Martyn January 12, 2010
{Cross posted with AVR Butterfly group}

Hi all,

My first post (and a newbie), please be gentle with me...

I am trying to use the ADC on the AVR butterfly board. I have set REFS0 and REFS1 both to 0 to use AREF (which I believe is effectively VCC (3.1V).
The ADC is working fine. The voltage divider circuit is working fine.
The problem I have is that the maximum voltage I can read (presented to the input pins on the board) is 3.1V - this equates to 0.5V presented on the MEGA169 (after the voltage divider).

However, I am only getting 176 (#B0) ADC steps to achieve this, which is a long way short of the #3FF resolution that the MEGA169 is capable of.

I am using (I believe) the upper and lower registers correctly for the ADC output.

I have set the prescaler to /128 to give 8kHz.

Can anyone explain what I am doing wrong please?

(I am programming in 'C' - I haven't a clue how to program in machine code - sorry).

Thanks in advance

Martyn

AFAIK:
If the REFS bits are both zero, ARef is not formally defined unless you physically connect it to something external. try setting REFS0 to one and REFS1 to zero, this should give you better results. for best results, also connect a cap between ground and the ARef pin.

-----Original Message-----
From: Martyn
To: a...
Sent: Tue, Jan 12, 2010 7:02 am
Subject: [AVR club] AVR Butterfly/ADC Question
{Cross posted with AVR Butterfly group}
Hi all,
My first post (and a newbie), please be gentle with me...
I am trying to use the ADC on the AVR butterfly board. I have set REFS0 and
EFS1 both to 0 to use AREF (which I believe is effectively VCC (3.1V).
he ADC is working fine. The voltage divider circuit is working fine.
he problem I have is that the maximum voltage I can read (presented to the
nput pins on the board) is 3.1V - this equates to 0.5V presented on the MEGA169
after the voltage divider).
However, I am only getting 176 (#B0) ADC steps to achieve this, which is a long
ay short of the #3FF resolution that the MEGA169 is capable of.
I am using (I believe) the upper and lower registers correctly for the ADC
utput.
I have set the prescaler to /128 to give 8kHz.
Can anyone explain what I am doing wrong please?
(I am programming in 'C' - I haven't a clue how to program in machine code -
orry).
Thanks in advance
Martyn
-----------------------------------



Thanks for the reply (must be a fellow radio ham).

I have actually already tried that - also use the internal reference as
well (both set to 0) but the results are the same. I'll do some more
experimenting tonight. This is the last major stumbling block in my
project so I am keen to get it fixed.

Thanks

Martyn (G0CZD)

-----Original Message-----
From: a... [mailto:a...] On Behalf
Of w...@aol.com
Sent: Tuesday, January 12, 2010 3:01 PM
To: a...
Subject: Re: [AVR club] AVR Butterfly/ADC Question
AFAIK:
If the REFS bits are both zero, ARef is not formally defined unless you
physically connect it to something external. try setting REFS0 to one
and REFS1 to zero, this should give you better results. for best
results, also connect a cap between ground and the ARef pin.

-----Original Message-----
From: Martyn
To: a...
Sent: Tue, Jan 12, 2010 7:02 am
Subject: [AVR club] AVR Butterfly/ADC Question
{Cross posted with AVR Butterfly group}
Hi all,
My first post (and a newbie), please be gentle with me...
I am trying to use the ADC on the AVR butterfly board. I have set REFS0
and
EFS1 both to 0 to use AREF (which I believe is effectively VCC (3.1V).
he ADC is working fine. The voltage divider circuit is working fine.
he problem I have is that the maximum voltage I can read (presented to
the
nput pins on the board) is 3.1V - this equates to 0.5V presented on the
MEGA169
after the voltage divider).
However, I am only getting 176 (#B0) ADC steps to achieve this, which is
a long
ay short of the #3FF resolution that the MEGA169 is capable of.
I am using (I believe) the upper and lower registers correctly for the
ADC
utput.
I have set the prescaler to /128 to give 8kHz.
Can anyone explain what I am doing wrong please?
(I am programming in 'C' - I haven't a clue how to program in machine
code -
orry).
Thanks in advance
Martyn
-----------------------------------