void main( void )
{ // Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
P1DIR |= BIT0 | BIT6; //俩灯配置为输出
P1DIR &= ~BIT3; //键盘配置为输入
P1OUT |= BIT0 | BIT6 ; // 先点亮亮灯
P1REN |= BIT3;
P1OUT |= BIT3; //配置为上拉
for(;;)
{
if((P1IN & BIT3) == 0)
{
delay_ms(10); //消抖
if((P1IN & BIT3) == 0)
{
P1OUT ^= BIT0 | BIT6;
}
while(~(P1IN & BIT3)); //等待松开按键
}
}
}
为什么老是卡在while这一步 |