[AVR] confuse to displaying the average adc value using codevisonavr

Status
Not open for further replies.

johaniskandar

Newbie level 3
Joined
Sep 25, 2014
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
17
please help, how solve the fluctuated adc value using codevisionavr? i will just to display the average value of it on lcd 16x2. thx very much
 

Fluctuating ADC reading most of the time caused by noise. Try power your device using battery and keep away from mains, if the reading is getting better then it is positively the 50/60 mains noise is injected to the adc input. Some filtering needed, also averaging large number of adc samples can help a bit.
 

I m sorry my mean is just want to scanning adc value during a minute and then dispalying the average value on lcd.,
 

buffer in at an array and than take the average...
like
Code:
int i ;
long sum  = 0;
for(i = 0; i < "your Limit say 50"; i++)
array[i] = read_adc();
for(int x = 0; x < i; x++ )
{
sum = array[x] ;
}

average =sum / i;


i think This Do.... I hope
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…