小弟在做一个项目,按键长按5s以后,我给LEDOnOff一个SWITCHOFF的值,SWITCHOFF是定义的枚举类型,然后执行下面的程序进入休眠模式,可是再通过按键无法唤醒系统,请问下是为什么呢?(最下面是port的中断程序) void Task_LEDonoff(void)
{
switch(LEDOnOff)
{
default: break;
case HOLD:
break;
case SWITCHON:
P1SEL |= 0x0c;
P1DIR |= 0x1c;
P1OUT |= 0x10;
LEDOnOff = HOLD;
break;
case SWITCHOFF:
P1SEL &=~ 0x0c;
P1DIR &=~ 0x1c;
P1OUT &=~ 0x10;
_BIS_SR(LPM1_bits);
break;
}
} #pragma vector=PORT1_VECTOR
__interrupt void Port1(void)
{
_BIC_SR_IRQ(LPM1_bits);
Task_Delay(10);
if(!(0x01&P1IN)) // Debouncing
{
if((ToggleValue != CHANGEMODE))
{
TBCTL |= TBCLR;
TBCTL = TBSSEL0 + MC0; // ACLK=32768Hz,
TBCCTL0 = CCIE;
TBCCR0 = 3277; // Fixed time = 0.1s
SwitchAction = ACTION;
}
}
P1IFG &=~ 0x01;
}
此帖出自
小平头技术问答
一周热门 更多>