Hi List, please use the attached code to test my previous post.
Bye, Stan.
#include <avr/io.h> #include <avr/interrupt.h> #include <assert.h> #include <stdlib.h> int main(void) { sei(); // Enable interrupt globally TIMSK = (1 << OCIE2); // Enable the TIMER2_COMP_vect ISR. TCCR2 = (1 << CS20); // Start Timer2 with Prescaler set to 1. for(;;) // Wait forever. ; return(0); } ISR(TIMER2_COMP_vect) { // Ok, TIFR had it's OCF2 flag set. assert(!(TIFR&(1<<OCF2))); // Calling this ISR clears the flag. while(!(TIFR&(1<<OCF2))) // Let's wait until the Timer sets the flag again. ; // Now this ISR should be in the irqPartnerList of HWIrqSystem. // It's therefor scheduled for execution after a RETI or SEI instruction occurs. TIFR = (1<<OCF2); // This time clear the flag manually TCCR2 = 0; // Stop the Timer, so this ISR will never be recalled. // But if it is recalled a 2nd time, it will hang at line 10, because the timer was stopped. }
_______________________________________________ Simulavr-devel mailing list Simulavr-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/simulavr-devel