2005-02-28 05:13 AM
2005-02-22 01:16 PM
Hello,
Im trying to use 2 interupts. 1) for the timer - when the timer hits zero 2) for the adc - when end of conversion (EOD). I have written my code in C and my problem is that when im debugging it will only go into one of the interupt vectors, which ever one comes first. I am puzzled by this, does anyone have any suggestions. Here is the code for the interupt functions: void int_adc(void) interrupt 4 { ADCR = 0x10; // Disable ADC interrupt } // Exit interrupt void int_timer(void) interrupt 4 { TCR = 0x86; // Reload the timer counter register to 86h TSCR = TSCR&0x7F; // Reset the TMZ bit of the TSCR register to enable // a new count count++; }2005-02-28 04:34 AM
The ADC (End of Conversion) and the Timer (Overflow) share one and the same interrupt. Both events branch to the same address. You need to decide by software polling TMZ and EOC what has happend. Or you use another timer or wait the 70µs until the A/D has finished.
2005-02-28 05:13 AM
Ok thanks thats what I was thinking. I used a few if loops to check the status of the ADCR and TSCR registers.