中级会员
- 积分
- 246
- 金钱
- 246
- 注册时间
- 2019-8-15
- 在线时间
- 34 小时
|
10金钱
使用MSP430FR2153芯片,设置TB0时钟来源为SMCLK,程序在进入LPM3后,还是产生了TIMERB0_ISR中断。
按芯片手册上说明的进入LPM3后,CPU、MCLK、SMCLK关闭。调试时,相关的标志位SCG1=1、SCG0=1、CPUOFF=1、GIE=1。
进入LPM3时SR状态
等待一段时间后,进入了中断。
LPM3模式下进入中断
SMCLK已经关闭,为什么还是产生了TIMERB0_ISR中断?
以下为程序全部内容:
#include <msp430.h>
int main(void)
{
WDTCTL = WDTPW | WDTTMSEL | WDTCNTCL | WDTIS2 | WDTSSEL__ACLK;// WDT ~3s, ACLK, interval timer
SFRIE1 |= WDTIE; // Enable WDT interrupt
CSCTL4 = SELMS__DCOCLKDIV | SELA__VLOCLK; // MCLK=SMCLK=DCO; ACLK=VLO
// Port Configuration all pins to output low
P1OUT = 0x00; P2OUT = 0x00;
P3OUT = 0x00; P4OUT = 0x00;
P5OUT = 0x00; P6OUT = 0x00;
P1DIR = 0xff; P2DIR = 0xff;
P3DIR = 0xff; P4DIR = 0xff;
P5DIR = 0xff; P6DIR = 0xff;
P1SEL1 |= BIT1; // Output ACLK through P1.1
//定时器 TB0 配置
TB0CCTL0 |= CCIE; // TBCCR0 interrupt enabled
TB0CCR0 = 50000;
TB0CTL = TBSSEL__SMCLK | MC__UP; // SMCLK, UP mode
// Disable the GPIO power-on default high-impedance mode
// to activate previously configured port settings
PM5CTL0 &= ~LOCKLPM5;
__bis_SR_register(LPM3_bits | GIE); // Enter LPM3
__no_operation(); // For debug
}
// Watchdog Timer interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=WDT_VECTOR
__interrupt void WDT_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(WDT_VECTOR))) WDT_ISR (void)
#else
#error Compiler not supported!
#endif
{
P1OUT ^= BIT0; // Toggle P1.0 (LED) every 3s
}
// Timer0_B0 interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector = TIMER0_B0_VECTOR
__interrupt void Timer0_B0_ISR (void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMER0_B0_VECTOR))) Timer0_B0_ISR (void)
#else
#error Compiler not supported!
#endif
{
P1OUT ^= BIT0;
}
|
|