1. Is the following sequence correct so setup interrupt -pulup in msp430g2553 __interrupt void Port_1(void) { if(P1IFG & (u8_t)BIT3) { P1IFG &= (u8_t)(~BIT3); /* P1.3 IFG cleared */ P1OUT ^= (u8_t)BIT0; /* P1.0 = toggle */ __delay_cycles(20000U); } } void set_int(void) { P1OUT &= (u8_t)(~BIT0); P1DIR |= (u8_t)BIT0; P1DIR &= (u8_t)(~BIT3); /* pin input */ P1OUT |= (u8_t)BIT3; /* pull up */ P1REN |= (u8_t)BIT3; /* pullup/down enable */ P1IES |= (u8_t)BIT3; /* high to low transition */ P1IFG &= (u8_t)(~BIT3); /* int flag cleared */ P1IE |= (u8_t)BIT3; /* int enable */ __bis_SR_register(LPM4_bits + GIE); // Enter LPM4 w/interrupt while(1U) { } }
↧