MSP430 LaunchPad IO外部中斷
int main( void ){// Stop watchdog timer to prevent time out resetWDTCTL = WDTPW + WDTHOLD;P1DIR |= 0x01;//設(shè)置P1.0口為輸出P1IE |= 0x08;//使能P1.3中斷P1IES |= 0x08;//P1.3口下降沿觸發(fā)中斷P1IFG &= ~0x08;//中斷標志位清零_EINT();//開總中斷//_BIS_SR(LPM4_bits + GIE);while(1){}}/*中斷服務(wù)程序*/#pragma vector = PORT1_VECTOR__interrupt void PORT_1(void){P1OUT ^= 0x01;//P1.0狀態(tài)翻轉(zhuǎn)P1IFG &= ~0x08;//中斷標志位清零}
評論