關於Timer Interrupt

67 views
Skip to first unread message

黃振豪

unread,
Mar 30, 2015, 11:10:32 PM3/30/15
to msp430lau...@googlegroups.com
您好~
之前使用別的MCU,大多都是使用timer task的方式去編寫整個流程和時間的掌控。
但MSP430的Timer,似乎都要進入LPM才會開始計數?
開始計數進入LPM後,想用外部的中斷去強制喚醒,卻叫不醒...
為什麼呢?有沒有可以不用進入LPM的方法?

目前
外部中斷設定的方法:(P26正常 P27沒功能)
    P2DIR = 0x3F;
    P2SEL = 0;
    P2SEL2 = 0;
    P2IES  = P26SDT_MISO+P27SW_Int;    //    Falling/Rising
    P2REN = P27SW_Int;            //pullup => P27OkKey
    P2OUT = P27SW_Int+P26SDT_MISO;

TimerA的設定
    TA0CCR0 = 1200*ot;
    CCTL0 = CCIE;//Enable the Timer A
    TA0CTL = TASSEL_2 + MC_1;//Setup Timer and Start
    __enable_interrupt(); //Enables Inturrupt for the whole chip
    _BIS_SR(LPM0_bits + GIE);

Edward Chen

unread,
Mar 31, 2015, 9:54:38 AM3/31/15
to msp430lau...@googlegroups.com
並沒有一定要進入LMP才能使用timer
那是示範程式為了暫時低功耗而這樣寫

Edward Chen

unread,
Mar 31, 2015, 9:57:41 AM3/31/15
to msp430lau...@googlegroups.com
P2DIR = 0x3F;
P2SEL = 0;
P2SEL2 = 0;
P2IES = BIT6 + BIT7; // Falling/Rising
P2REN = BIT6 + BIT7; //pullup => P27OkKey
P2OUT = BIT6 + BIT7;

TimerA的設定
TA0CCR0 = 1200*ot;
CCTL0 = CCIE;//Enable the Timer A
TA0CTL = TASSEL_2 + MC_1;//Setup Timer and Start
__enable_interrupt(); //Enables Inturrupt for the whole chip
_BIS_SR( GIE );
Reply all
Reply to author
Forward
0 new messages