void adc_init(void) // Function to initialise the ADC feature { ADCSRA=0X00; // Clear previous ADC results and status flags ADMUX=0X60; // 0x40 for 10 bits ADCSRA=0X87; // We have set the ADSC bit to start a conversion, and the // ADPS bits are set so that the prescaler is 128 ACSRA=0X80; // ADEN is set, to enable the ADC } unsigned char adc_start(unsigned char channel) // Function to perform an ADC conversion, Takes 0-8 as input // to select which input to convert { unsigned char i; ADCH=0x00; // Clear the previous result i=channel&0x07; // Decide which line to perform ADC conversion on ADMUX=i|0x60; // Enter which line to perform in the ADC control register ADCSRA|=1<