请教!!为啥进不了中断啊??我用的P1.0作为外部中断
#include <msp430x14x.h>
main()
{
WDTCTL=WDTPW+WDTHOLD;
P1IES= 0x01;
P1IFG=0x00;
P1IE = 0x01;
_EINT();
LPM1;
//while(1);
}
#pragma vector=PORT1_VECTOR
__interrupt void P1_ISR(void)
{
P2DIR=0x01;
P2OUT=0Xfe;
P1IFG=0x00;
}
此帖出自
小平头技术问答
main()
{
WDTCTL=WDTPW+WDTHOLD;
P1OUT = 0x01; // P1.0加上拉电阻
P1REN |= 0x01;
P1IES |= 0x01; //下降沿触发
P1IFG &= 0x01; //清标志
P1IE |= 0x01; //使能中断
_EINT(); //开全局中断
LPM1; //进入低功耗模式0
//while(1);
}
#pragma vector=PORT1_VECTOR
__interrupt void P1_ISR(void)
{
P2DIR=0x01;
P2OUT=0Xfe;
P1IFG &= 0x01; //清标志
}
一周热门 更多>