Don_dody
Full Member level 1
- Joined
- Nov 4, 2012
- Messages
- 96
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,288
- Location
- Indonesia
- Activity points
- 1,921
I use the following part of code to read the ADC value:
The value that I see in the 16x2 LCD is always changing (very very fast). Is there any way to overcome this so that ADC value will be updated slowly, at least I can see it??
Code:
unsigned int read_adc(unsigned char adc_input)
{
ADMUX=adc_input | (ADC_VREF_TYPE & 0xff);
delay_us(10);
ADCSRA|=0x40;
while ((ADCSRA & 0x10)==0);
ADCSRA|=0x10;
return ADCW;
}
while (1)
{
A1=read_adc(0);
lcd_gotoxy(0,0);
sprintf(buf,"L1:%d%d%d%d",A1/1000,(A1%1000)/100,(A1%1000%100)/10,A1%1000%100%10);
lcd_puts(buf);
}
The value that I see in the 16x2 LCD is always changing (very very fast). Is there any way to overcome this so that ADC value will be updated slowly, at least I can see it??