can somebody explain in detail the following code,
i created a new project in code-vision-avr with atmega8, while creating i enabled adc,
in the workspace i have the below automatically generated lines,
i need a detailed explanation for lines 1 and 6, (comment lines for line number are included by me for your reference). thank you.
unsigned int read_adc(unsigned char adc_input)
{
ADMUX=adc_input | (ADC_VREF_TYPE & 0xff); //----------------line 1
// Delay needed for the stabilization of the ADC input voltage
delay_us(10); //-----------------------------------------------------line 2
// Start the AD conversion
ADCSRA|=0x40; //---------------------------------------------------line 3
// Wait for the AD conversion to complete
while ((ADCSRA & 0x10)==0); //------------------------------------line 4
ADCSRA|=0x10; //---------------------------------------------------line 5
return ADCW; //---------------------------------------------------line 6
}