Hi,
Very frustrating. I'm using AS7 and a jtagicemkII and debugWire to develop a 168 system. Try as I might I cannot get ADC interrupts. I'm getting timer interrupts so I know interrupts are working. I can go into I/O View and manually fire a conversion and see results that all look okay, even in interrupt flag. But the ADC ISR never gets hit. I have tried breakpoints and toggling a pin as a sanity check.
Init code:
void init_devices(void) { // // sets up ADC system // DIDR0 = (1<<ADC4D)|(1<<ADC3D); ADMUX = (1<<REFS0); //AVCC as reference ADCSRA = (1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0)|(1<<ADEN); // ***SPI*** SPCR = (1<<SPE)|(1<<MSTR); // SPI enable }
Main loop:
int main(void) { unsigned int dummy; cli(); init_ports(); init_devices(); timer_init(); pgm_init(); sei(); dummy = ADC; // clear IRQ flag, just in case ADCSRA |= (1<<ADIE); // enable ADC interrupts ADCSRA |= (1<<ADSC); //start next conversion while(1) { GetSwitches(); } }
What am I missing?
--Timbo