100k views
3 votes
Void adc_init(void)

{
ADMUX = (1< ADSRA = (1< }
int readAdc (char chan)
{
ADMUX = (1< ADSRA = (1< while (ADSRA & (1< return ADCW;
}

In the above code, macros and bits definitions are used (i.e ADMUX, REFSO) instead of pointers, etc. Add a comment for each line of code that describes what each line does. Describe the function of ADCW.

User Opsenas
by
2.8k points

1 Answer

1 vote

Answer:

This code tells us that When ADCL is read the ADC register is not updated consequently,if the result is left adjusted and no more than 8 bit precision is required it is sufficient to read ADCH.

User Mirlande
by
3.3k points