I'm trying to set up two pin interrupts on the same port, but when I enable the interrupts my other code doesn't run properly. I think it's possibly getting stuck in the ISR. Am I not clearing the flags properly?
#define TRIGGER_LEFT (BIT3) //of port 2 #define TRIGGER_RIGHT (BIT6) //of port 2 void main () { //enable interrupt P2IE |= TRIGGER_LEFT | TRIGGER_RIGHT; //interrupt on falling edge P2IES |= TRIGGER_LEFT | TRIGGER_RIGHT; //clear interrupt flag P2IFG &= ~(TRIGGER_LEFT | TRIGGER_RIGHT); //other code } #pragma vector=PORT2_VECTOR __interrupt void Port2_ISR(void) { switch (P2IFG & (TRIGGER_LEFT | TRIGGER_RIGHT)) { case TRIGGER_LEFT: triggered = TRUE; //clear flag P2IFG &= ~TRIGGER_LEFT; break; case TRIGGER_RIGHT: triggered = TRUE; //clear flag P2IFG &= ~TRIGGER_RIGHT; break; } }