Write an interrupt handler for the ADC complete interrupt i
Write an interrupt handler for the ADC - complete interrupt in C. The ISR should store the 10-bit conversion result into a voltage global called temp using atmega328p?
Solution
#include<avr\\io.h>
#include<avr\\interrupt.h>
ISR(ADC_VECT)
{
PORTD = ADCL;
PORTB = ADCH;
ADCSRA | = (1<<ADSC);
}
int main(void)
{
DDRB = 0XFF;
DRRD = 0XFF;
DDRA= 0;
SEI();
ADCSRA = 0X8F;
ADMUX = 0XC0;
ADCSRA | = (1<<ADSC);
WHILE(1);
RETURN 0;
}
