Normally keypresses are not direct change from one state to other , instead its a change with bit noise in between where the state seems undefined. To avoid the situation the common method is to recheck after certain delay if(PINState==Pressed) { delay(few_microsec); if(PINState==Pressed) { ActionKeyPress(); } } But if we are dealing with interrupt PIN_ISR() { setkeypressflag(); } main() { if (keypressflagset) if(PINState==Pressed) { DoKeyPressAction(); } } Now the most advanced one with timer or WatchdogTimer #pragma vector=PORT1_VECTOR __interrupt void P1_Function() { count=0; //Reset count TACTL|=TASSEL_2+MC_1+TAIE; //Start Timer0 with SMCLK clock source, UP mode and enable overflow interrupt state=(P1IN&BIT3)>>3; //Save the state of the switch P1IE&=~BIT3; //Disable interrupt on P1.3, now the Timer will take care of Debouncing P1IFG&=~BIT3; // Reset Port1 interrupt flag } #pragma vector=TIMER0_A1_VECTOR...