This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CCS/msp430F5529:调试时 Timer2错误-简单延迟函数-错误

Guru**** 2540720 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/587818/ccs-msp430f5529-timer2-error-when-debugging---simple-delay-function---error

器件型号:MSP430F5529

工具/软件:Code Composer Studio

我使用的是 TI MSP430库中的示例代码。  代码非常简单、应该可以正常工作、但我在调试时遇到错误。

void main (void)
{
WDTCTL = WDTPW+WDTHOLD; //停止看门狗计时器
P1DIR |= BIT0; 
P4DIR |= BIT7;
while (1) { 延迟(6000); //延迟6秒(我认为吗?) P1OUT ^= BIT0; //切换 P1.0 } } void delay (long int time) { TA2CCTL0 = CCIE; // CCR0中断使能 TA2CCR0 =时间; TA2CTL = tassel_2 + MC_2 + TACLR; // SMCLK、contmode、clear TAR ___ bis_SR_register (LPM0_bits + GIE); //输入 LPM0,启用中断 __NO_OPERATION (); //用于调试器
return; } // Timer2中断服务例程 #if defined (__TI_Compiler_version__)|| Defined (__IAR_systems_ICC__) #pragma vector=TIMER2_A0_Vector __interrupt void TIMER2_A0_ISR (void) #Elif defined (__GERISR__)__TIMER2_TRISR__) (void TIMER2_TRIBU_INTRIBU_INTRIBU_INTRIBU_INTRU_INTRIBU_INTRU_INTRU_INTRU_INTRU_INTRU_INTRU_INTR #endif { P4OUT ^= BIT7; //切换 P4.7 LED }

当我进入中断时、我收到一个错误。  它的读数为。

"没有可用于"0x3fe"的源。"

P4.7 LED 每1/2次闪烁一次 second....no、不知道原因。

P1.0 LED 根本不闪烁。   指示代码不会经过 return 语句并返回到 while 循环。

我尝试每6秒闪烁一次 P1.0 LED。

任何帮助都很好。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    OPS...忘记退出中断。

    _BIC_SR_REGISTER_ON_EXIT (LPM4_BITS);//退出活动 CPU
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    尊敬的 Chris:

    感谢您使用您的解决方案更新帖子。 很高兴听到您能够自己解决这个问题。

    此致、
    Caleb Overbay