P1OUT &= ~BIT0;
P1DIR |= BIT3; // Set P1.3 as output pin
while (1) // Test P1.3
{
P1OUT &= ~BIT3;
P1DIR |= BIT3; // Set P1.3 as output pin
for (i = 10000; i>0; i--); // Delay
P1DIR &= ~BIT3; // Set P1.3 as input pin
P1IES &= ~BIT3;
P1IFG |=BIT3; // To prevent an immediate interrupt, clear the flag for
P1IE |= BIT3;
__bis_SR_register(GIE); // Enable interrupts
__delay_cycles(2000000);
LPM0;
}
}
unsigned int timer_count, key_threshold;
#pragma vector=PORT1_VECTOR
__interrupt void port_1_interrupt(void)
{
P1IFG &= ~BIT3; // clear the interrupt flag
timer_count = TAR - timer_count; /* Record the discharge time */
// LPM0_EXIT; /* Exit from low power 3 or 0 */
P1OUT ^= 0x01;
//return;
}