4 * interrupt.c - handle interrupts
6 * This file is released under the GNU General Public License. Refer
7 * to the COPYING file distributed with this package.
9 * (c) 2007 Carsten Presser cpresser AT fsing.uni-sb.de
15 #include "interrupt.h"
25 /** V A R I A B L E S **********************************************/
29 /** I N T E R R U P T V E C T O R S *****************************************/
30 #pragma code high_vector=0x0808 //(0x0808)
31 void interrupt_at_high_vector(void)
33 _asm goto high_isr _endasm
37 #pragma code low_vector=0x0818 //(0x0818)
38 void interrupt_at_low_vector(void)
40 _asm goto low_isr _endasm
45 /** C O D E ******************************************************************/
46 #pragma interrupt high_isr
51 if (INTCONbits.TMR0IF)
53 INTCONbits.TMR0IF = 0; // clear flag
57 /* Infrared Interrupt */
58 if (INTCON3bits.INT2IF)
62 INTCON3bits.INT2IF = 0; // clear flag
63 INTCON2bits.INTEDG2 = !INTCON2bits.INTEDG2; // toogle edge detect...
67 #pragma interruptlow low_isr
70 /* I2C Interrupt Line */
73 if (INTCONbits.RBIF) // i2c_int
75 PORTB = PORTB; // end mismatch condition... (see page 114)
76 INTCONbits.RBIF = 0; // then clear the flag!
79 if (PIN_I2C_INT == 0) // ignore falling edge
81 gg_ioflags |= FLAG_I2C;
92 gg_ioflags |= FLAG_COUNTER;