ADC code in with atmega32

Posted by Komal on Stack Overflow See other posts from Stack Overflow or by Komal
Published on 2010-05-10T18:02:46Z Indexed on 2010/05/10 18:04 UTC
Read the original article Hit count: 230

Filed under:

uint read_adc(uchar adc_input)

{

ADMUX=adc_input | (0x00 & 0xff);

delay_us(10);

ADCSRA|=0x40; //START THE CONVERSION

while ((ADCSRA & 0x10)==0); // wait for the conversion to complete

ADCSRA|=0x10; //clear the ADC flag

return ADCW;

}

Q: Whats the meaning of "ADMUX=adc_input | (0x00 & 0xff)" ? which input channel we have selected here ?

© Stack Overflow or respective owner

Related posts about atmega16