I am using the following code in cvavr, my code is not working. My adc read code is working if i don't use interrupt. So there is issue with my interrupt call, i tried to make it manual call :
void main(void)
{
DDRB=0xFF;
DDRC=0xFF;
PORTC=0x00;
PORTB=0x00;
You really need to study the data sheet.... You are starting the conversion in the ISR!! How can the the first conversion be done.... First enable the ADC then start conversion... Once you interrupt fires, read the ADC then set the conversion..
The AVR has a free running ADC so just start the first conversion and just read when the ADIF is set..
ADCSRA |= (1<<ADEN); // You need this to turn it on...
When posting its a good idea to show all your code or we are second guessing...
Even so you are setting your conversion in the interrupt.... The interrupt will not fire because the conversion is never started.... If you start the initial conversion after setting the SEI... then set the conversion bit after the read, it should work.
Sorry if this is fowl language.
I love you Ian Rogers.... you rock man... thanks .... i was pondering for 1 week over this.... my code is working now..... Thanks man...