Apr 9, 2014

External Interrupt At PORT 1

External interrupt at port 1
Basic Steps
1)Enable global interrupt(eint)
2)Enable external interrupt (on p1.4--P1IE  )
3)select interrupt edge (IP1IES)
4)clear P1IFG flag starting the program
5)clear P1IFG flag in your interrupt service routine

.include "msp430g2x31.inc"
      org 0xf800                 
      mov.w #(WDTPW|WDTHOLD), &WDTCTL
      mov.w #0x280, SP
      mov.b #0x10, P1REN
      CLR.B P1OUT
      mov.b   #001h,&P1DIR           
      bis.b   #010h,&P1IE        ;enable interrupt on p1.4   
      bis.b   #010h,&P1IES       ;select -ve edge
      bic.b   #010h,&P1IFG       ;clear interuupt flag       
      eint ;enables interrup
      gg:jmp gg   

P1ISR:    mov.b   #001h,&P1OUT          
          bic.b   #010h,&P1IFG           
          reti                          

          ORG     0FFE4h                 
          DW      P1ISR    
          ORG     0FFFEh                 
          DW      0xf800