#include
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
P1DIR |= BIT0; // Set P1.0 to output direction
P1OUT &= ~BIT0;
P1REN |= BIT4; // Enable P1.4 internal resistance
P1OUT |= BIT4; // Set P1.4 as pull-Up resistance
P1IES &= ~BIT4; // P1.4 Lo/Hi edge
P1IFG &= ~BIT4; // P1.4 IFG cleared
P1IE |= BIT4; // P1.4 interrupt enabled
while(1)
{
__bis_SR_register(LPM4_bits |GIE); // Enter LPM4 w/interrupt
__no_operation(); // For debugger
P1OUT ^= BIT0; // P1.0 = toggle
P1IES ^= BIT4; // Toggle between H-L and L-H transition triggers
P1IE |= BIT4; // Enable port interrupt
}
}
// Port 1 interrupt service routine
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
P1IFG &= ~BIT4; // Clear P1.4 IFG
P1IE &= ~ BIT4; // Clear P1.4 IE
_BIC_SR_IRQ(LPM4_bits); // Exit LPM4
}
此是430 5系列的MCU的库,如果P1.4是个按键,在单步执行时能否顺利到达P1.4的中端入口?
我试了 很多次都是不行,请教原因?