This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Debouncing Switches on MSP430G2553

Other Parts Discussed in Thread: MSP430G2553

I'm trying to handle 3 separate push buttons on P1.3, P1.4, and P1.5 on an msp430g2553. I'm using some sample code to handle the interrupts generated by the buttons, and I can get which button is pressed, the problem is that I cannot figure out (or find) a good way to debounce the switches in code. How would I go about debouncing them using the PORT1_ISR to handle the button presses? I noticed that the switch on P1.3 is nicely debounced, how is that implemented, and can I somehow expand that debouncing to the other two switches? 

Thanks!

  • Hi Donald,

    in older lauchpads the switch had a 47k pull-up resistor and a 100nF capacitor to ground connected (newer use the internal pull-up, but I have not looked if the capacitor is still there) which give a time constant of 4.7ms. Together with the schmitt-trigger inputs that gives a good debouncing.

    There is some general reading about bounces here:

    http://www.ganssle.com/debouncing.htm

    Simple approches can be a "shift register" in software. When a button switch is detected use a timer to read the button state in fixed intervals (length should depend on the bounce time of the swiches) and evaluate the "shift register" instead of your button. Side effect of this is, that you can debounce all switches in one routine.

  • Thanks for the reply. I did find that website in my search for debouncing and have looked through it, but didn't really have any luck with any of the software solutions there (though there were other issues in the code).

    For the switches on P1.4 and P1.5, I used a 33k pull-up resistor and a 1uF capacitor for each. This seemed to remedy the issue. However, are you saying that all of the inputs have schmitt triggers? Are those on the launchpad or are they internal to the MSP?

    Thanks again.

    EDIT: I found the Port Pin schematics in the g2553 datasheet. Looks like all the pins have schmitt-trigger inputs.

  • Hi Donald,

    a look at the port pin schematics in the user guide show that every pin has a schmitt trigger in the msp430g2553 (even one must look through all schematics as they very from pin to pin). The schmitt triggers are also only active if the pin is used as digital pin.

**Attention** This is a public forum