標(biāo)題: msp430程序第二個中斷無法執(zhí)行,也就是進不去第二個中斷 [打印本頁]

作者: 修姱丿兮    時間: 2019-4-20 21:47
標(biāo)題: msp430程序第二個中斷無法執(zhí)行,也就是進不去第二個中斷
#include <msp430.h>

/*
* main.c
*/
int main(void) {
    WDTCTL = WDTPW | WDTHOLD;        // Stop watchdog timer
    P1OUT =BIT3;
    P1REN |=BIT3;
        P1IE |=BIT3;
        P1IES |=BIT3;
        P1IFG &=~BIT3;
        P1OUT |=BIT2;
        _BIS_SR(GIE);
        while (1)
        {
                if((P1OUT&BIT2)==0)
                {
                        TA0CTL = TASSEL_1 + MC_1 + TACLR;
                        TA0CCTL0 = CCIE;
                        TACCR0 = 32768;       //30秒計時
                        _BIS_SR(GIE);
                }
                else
                        __no_operation();

          }
}
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
        P1OUT &=~BIT2;
        P1IFG &= ~BIT3;
}
#pragma vector = TIMER0_A0_VECTOR
__interrupt void Timer_A(void)
{
        static int i=0;
        i++;
        if(i==30)
        P1OUT |=BIT2;
        else
                __no_operation();
}




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1