Port+Interrupt


 * In msp430x2xxx series device, each pin in ports P1 and P2 have interrupt capability.
 * These can be configured using three registers namely PxIFG, PxIE, and PxIES registers.
 * There are two interrupt vectors separate for the two port pins.All P1 pins source a single interrupt vector and all P2 pins source a different single interrupt vector.

__**REGISTERS DESCRIPTION**__ : a) Each **PxIFGx** bit is the interrupt flag for its corresponding I/O pin and is set when the selected input channel edge occurs at the pin. b) The flag requests an interrupt when their corresponding **PxIE** bit and **GIE** bit are set. c) Each **PxIFG** flag must be reset by the software.
 * **Interrupt Flag Registers P1IFG**, **P2IFG** : :=>


 * NOTE** : Only transitions cause interrupts, not static levels.That means that an interrupt can be generated either o the rising edge of the pulse or falling edge of the pulse.

It selects the interrupt edge for the corresponding I/O pin. Bit=0 => PxIFG is set with a rising edge (low to high transition ). Bit=1 =>PxIFG is set with a falling edge(high to low transition ).
 * **Interrupt Edge Select Registers P1IES, P2IES**

Each PxIE bit enables the associated PxIFG interrupt flag Bit=0 =>The interrupt is disabled Bit=1 => the interrupt is enabled
 * **Interrupt Enable Registers P1IE, P2IE**

__**Sample Program**__ : Interrupt on rising edge of an input square wave


 * //PSUEDO PROGRAM//** :

//#include // //void main(void)// //{// ///**** stop watchdog timer****/// ///****Set P1.0 to output direction****///

///**** Make P1.4 interrupt enabled****/// ///**** Set the rising edge selection ****///

//_BIS_SR(LPM4_bits + GIE); // Enter LPM4 w/interrupt// //}//

///****Port 1 interrupt service routine****/{ }//

//WDTCTL = WDTPW + WDTHOLD;// //P1DIR |= 0x01;// //P1IE |= 0x10;// //P1IES |= 0x10;// //#pragma vector=PORT1_VECTOR //// defined in the library //__interrupt void Port_1(void)// //{// //P1OUT ^= 0x01;// //toggle P1.0 OR do whatever you want to do here //P1IFG &= ~0x10;// // P1.4 flag has to be manually reset //}//
 * 1.** **STOP WATCHDOG TIMER**
 * 2.** **Set P1.0 to output direction**
 * 3.** **Make P1.4 Interrupt Enabled**
 * 4.** **Set the rising edge selection on P1.4**
 * 5.** **PORT 1 Interrupt Service Routine**


 * __FULL Program__ : **

//#include //

//void main(void)// //{// //WDTCTL = WDTPW + WDTHOLD;// // Stop watchdog timer //P1DIR |= 0x01;// // Set P1.0 to output direction //P1IE |= 0x10;// // P1.4 interrupt enabled //P1IES |= 0x10;// // P1.4 Hi/lo edge

//_BIS_SR(LPM4_bits + GIE);// // Enter LPM4 w/interrupt //}//

// Port 1 interrupt service routine

//#pragma vector=PORT1_VECTOR// //__interrupt void Port_1(void)// //{// //P1OUT ^= 0x01;// // P1.0 = toggle //P1IFG &= ~0x10;// // P1.4 IFG cleared //}//