请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:MSP430F5529 大家好、
我是第一次基于 MSP430F5529开发应用。
我遇到端口中断问题。 为了调试这个问题、我编写了一个简单的程序、如下所示。
int main(void)
{
// Stop watchdog timer
WDTCTL = WDTPW + WDTHOLD;
// SMCLK Source Divider f(SMCLK)/32
UCSCTL5 |= DIVS__32;
/* Timer-1 */
// CCR0 interrupt enabled
TA0CCTL0 = CCIE;
TA0CCR0 = 32767;
// SMCLK, Up-mode
TA0CTL = TASSEL_2 + MC_1;
// Set P1.0 to output direction
P1DIR = 0x01;
// Enable P1.1 internal resistance as pull-Up resistance
P1OUT = 0x02;
P1REN = 0x02;
// P1.1 Hi/Lo edge
P1IES |= 0x02;
/*
* Disable the GPIO power-on default high-impedance mode to activate
* previously configured port settings
*/
PMM_unlockLPM5();
// P1.1 IFG cleared
P1IFG &= ~0x02;
// P1.1 interrupt enabled
P1IE |= 0x02;
// Enter LPM4 w/interrupt
__bis_SR_register(LPM4_bits + GIE);
// For debugger
__no_operation();
}
void watchdogtimer_init(void)
{
WDTCTL = 0x5A05; /* WDTSSEL0 - 0x0000 --> Select Watchdog timer clock source as SMCLK
WDTIS2 - 0x0004 --> 2nd bit 1
WDTIS0 - 0x0001 --> 0th bit 1
WDTIS - 101 - Select (250 ms at 32.768 kHz) as the watchdog timer interval to generate a PUC. */
}
//******************************************************************************
//
// This is the PORT1_VECTOR interrupt vector service routine
//
//******************************************************************************
#pragma vector = PORT1_VECTOR
__interrupt void Port_1(void)
{
P1OUT ^= 0x01;
}
在此代码中、我永远无法退出中断。 是否缺少任何配置友好支持
