用P1.3按键进入中断,点亮LED1即P1.0
为什么我加了LPM3就进不了中断了?改成LPM0进不了中断咋回事?
解,LMP0和LPM1等几种模式如何选择?
<msp430g2553.h>
void main(void) {
WDTCTL = WDTPW + WDTHOLD;
P1DIR = BIT0 + BIT6;
P1DIR &= ~BIT3;
P1REN |=BIT3;//不能少哦
P1IE |= BIT3;
P1IES |= BIT3;
P1IFG =0x00;
P1OUT &= ~BIT0;
P1OUT &= ~BIT6;
LPM3;
_EINT();
while(1);
}
#pragma vector= PORT1_VECTOR
__interrupt void port1_sr()
{
int i=5000;
if(P1IFG&BIT3)
{
P1OUT |= BIT0;
P1OUT &= ~BIT6;
while(i--);
P1IFG =0X00;
P1REN |=BIT3;
}
}
此帖出自
小平头技术问答
一周热门 更多>