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.

[参考译文] 编译器/MSP430FR5969:中断端口4.5 (左侧按钮启动板)

Guru**** 2539500 points


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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/584020/compiler-msp430fr5969-interrupt-port-4-5-button-left-side-launchpad

部件号:MSP430FR5969

工具/软件:TI C/C++编译器

大家好,  

我`m在4.5 中使用中断,但当我按下按钮 时,代码卡在ISR_TRAP中

.sect ".text:_ISR:__TI_ISR_TRA"
对齐2.
.global __TI_ISR_TRAP
__TI_ISR_TRAP:
BIS.W #(0x0010),SR
JMP __TI_ISR_TRAP

NOP;CPU40兼容性NOP

 

I`m使用计时器中断来闪烁LED (1.0 中的心跳)和中断端口4.5  

 

OID Timer1_A3_1k5Hz (无效)

//Timer_a_initUpMode (timer_a1_base,timer_a_CLOCKSOURCE_ACLK,timer_a_CLOCKSOURCE_diver_1,
// 25,timer_a_tace_interrup_disable,timer_a_CCIE_CCR0_interrupt_enable,timer_a_skip_clear);// 1.5KHz`

timer_a_initUpModeParam ={0};
Param.clockSource = TIMER_A_CLOCKSOURCE_ACLK;
Param.clockSourceDivider = TIMER_A_CLOCKSOURCE_DICROLER_1;
Param.timerPeriod = 3899;//表示500ms
// param.timerPeriod = 23;//表示1.5kHz
PARAM.TIMER InterruptEnable_TAIE = TIMER_A_TAIE_INTERRUST_DISABLE;
param.captureCompareInterruptEnable_CCR0_CCIE = TIME_A_CCIE_CCR0_INTERRUST_ENABLE;
PARAM.TIMER清除= TIMER_A_SKip_CLEAR;
TIMER_A_INITUUPMode(timer A1_base,&param);// 1.5KHz
timer_a_startCounter (timer_a1_base,timer_a_up模式);
}

void GPIO4P5_INTERRUPT (void)

P4OUT = BIT5;
/*端口4电阻器启用寄存器*/
P4REN = BIT5;

/*端口4中断边缘选择寄存器*/
P4IES = BIT5;

/*端口4中断标志寄存器*/
P4IFG = 0;

/*端口4中断启用寄存器*/
P4IE = BIT5;


}

#pragma vector=Timer1_A0_vector
__interrupt void Timer1_A0_ISR_Hook(void)

LED_NFC_Link_Toggle ();
}

__interrupt void Port4_isr_hook (void)

Switch(__偶 数_in_range(P4IV, P4IV_P4IFG7))

案例P4IV_NONE:中断;//矢量0:没有待处理的中断;
//案例P4IV_P4IFG0:中断;//矢量2:P4IFG.0;
//案例P4IV_P4IFG1:中断;//矢量4:P4IFG.1;
//案例P4IV_P4IFG2:中断;//矢量6:P4IFG.2;
//案例P4IV_P4IFG3:中断;//矢量8:P4IFG.3;
//案例P4IV_P4IFG4:中断;//矢量10:P4IFG.4;
案例P4IV_P4IFG5:
Flag_int = 1;
P4IFG &=~BIT5;//清除4.5 IFG

中断;//向量12:P4IFG.5;
// Case P4IV_P4IFG6:Break;// Vector 14:P4IFG.6;
//案例P4IV_P4IFG7:中断;//矢量16:P4IFG.7;
默认值:中断;
}

 

我`m 4.5 的中断,但代码被卡住。  

可以有人帮我理解这个问题吗? 谢谢,顺祝商祺  

 

 

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    我发现错误的人。
    必须包括
    #pragma vector=Port4_vector关于GPIO中断。
    谢谢,周末过得很愉快!
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    感谢您发布解决方案Carlos。

    此致,
    Ryan