avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] ADC requires a pause for proper operation


From: harshit suri
Subject: Re: [avr-gcc-list] ADC requires a pause for proper operation
Date: Fri, 19 Mar 2004 18:08:48 -0800 (PST)

The impedance looking into the ADC pins is very high
so its more like sampling voltage with a high
impedance voltmeter.
Secondly the problem of adding a delay before the
acutall conversion is needed even when measuring a
sensor using the 5V AVCC as Vref.

Thankyou for ure replies

--- Douglas Dotson <address@hidden> wrote:
> Check the specs on the internal voltage reference. 
> It is not very accurate. Pretty worthless in my
> opinion.
> 
> Doug
> 
> --- harshit suri <address@hidden> wrote:
> > Hello I am using the ATmega128. I have 3 sensors
> > connected to the ADC
> > 
> > PIN ADC0 a potentiometer .Vref used is AVCC = 5V
> > PIN ADC3 , ADC2 : differential signal from a servo
> > potentiometer giving feedback on its position .
> VREF
> > is internal 2.56Volts
> > PIN ADC5 : From a phototransistor giving the
> > strength
> > of recieved signal Vref is AVCC = 5V
> > i noticed 2 problems
> > 1)the effect of changing the photodiode sensor
> value
> > was changing the reading of the Potentiometer 
> > 2)the value being sent back for the differential
> > signal from the servo sensor was nearly half of
> what
> > it should have been.It was wrong.
> > To try to correct this i did the following :
> > in the functions samplePot(),
> sampleServoPosition()
> > ,
> > sampleRxSignalPower() :
> > I added a delay between setting up the
> ADC(choosing
> > ADC MUX and ADC REFS) and the actual start of ADC
> > conversion ADCSRA |= (BV(ADSC));...and this fixed
> > the
> > problem. I have only been able to rationalize this
> > by
> > thinking that their is a need to let Vref settle
> > down
> > between the switching 2.56 and AVCC=5V .BUT this
> > also
> > is wrong cause i tested by just sampling the
> sensors
> > using AVCC as Vref . I still got the coupling
> > problem.
> > 
> > I also did some experiments and would also like to
> > report that page 235 of Atmega128 datasheet in the
> > section on "Changin Channel or reference
> Selection"
> > says that conversions should not be started within
> > 125us of choosing the differential input for the
> > first
> > conversion.
> > I actually found that the delay needed was 960us.I
> > used the following loop.I used a scope on PORTD
> pin
> > to
> > measure the delay.
> > I measured this delay using :
> > PORTD ^= BV(1);
> > for (delay = 0 ; delay < 1230 ; delay++); 
> > PORTD ^= BV(1);
> > //perform single conversion
> > ADCSRA |= (BV(ADSC));
> > 
> > While the data sheet mentions that a delay is
> needed
> > while measuring differential signals. It does not
> > mention that u need a delay before measuring
> single
> > ended signals. However I found I needed a delay
> > there
> > too. can anyone advise?
> > 
> > Here is the code that samples a sensor. i added
> the
> > for loop to add a delay in every such function
> > 
> > ADMUX |= (BV(REFS0) );
> > ADMUX &= ~(BV(REFS1) | BV(ADLAR) | BV(MUX4) |
> > BV(MUX3)
> > | BV(MUX2) | BV(MUX1) | BV(MUX0));
> > long delay = 0;
> > for (delay = 0 ; delay < 20000 ; delay++); //I
> ADDED
> > THIS DELAY BEFORE THE STARTING OF CONVERSION
> > //perform a single conversion
> > ADCSRA |= (BV(ADSC));
> > 
> > I noticed that u need to add the delay only for
> the
> > first conversion. If u dont change the MUX AND
> Vref
> > then u dont need to add the delay again and again.
> > But
> > if u change the channel then u need the delay
> again
> > no
> > matter if its single ended or differential.
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Mail - More reliable, more storage, less
> spam
> > http://mail.yahoo.com>
> _______________________________________________
> > avr-gcc-list mailing list
> > address@hidden
> > http://www.avr1.org/mailman/listinfo/avr-gcc-list
> > 
> 


__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]