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.
您好!
我正在尝试对 MSP430g2553 MCU 进行编程、以便在连续按下触控(内部中断)开关2 - 3秒时执行某项操作。 您能不能帮助我如何对中断代码进行编程。
代码:
# pragma vector=port2_vector
_interrupt void port_2 (void)
{
J_DELAY_+;
P2IFG &=~BIT3;
if (j_delay > 50000)
{
J_DELAY=0;
X=0; //启用程序2
}
}
谢谢、此致。
您只需要在计时器间隔结束时测试按钮。 这可以通过写入来完成
if (!(P1IN & 0x01))// P1.0上的按钮被按下(低电平有效) { //执行一些操作 }
(仅在此处以 P1.0上的按钮为例)
Dennis