/*************************************************************************** ISR for rtos_ex2 Timer 0 interrupt is high priority source. Reloads Timer, and calls OSTimer() TJW 30.12.05, rev. 10.6.09 Tested 10.6.09 ****************************************************************************/ #include #include #include //function prototype(s) void timer0_isr (void); static unsigned int tick_counter = 0; //Define the high priority interrupt vector to be at 0008h #pragma code high_vector=0x08 void interrupt (void) { _asm GOTO timer0_isr _endasm //jump to ISR } #pragma code //Return to default code section //Function timer0_isr specified as high-priority ISR #pragma interrupt timer0_isr //timer0_isr function. void timer0_isr (void) { WriteTimer0 (64918); //Timer reload value gives 625 cycles to overflow, //less compensation for interrupt latency OSTimer(); tick_counter++; //increment tick counter, (for simulation) INTCONbits.TMR0IF = 0; //Clear TMR0 interrupt flag }