1 Reply Latest reply on Jul 8, 2018 4:22 AM by BoTa_264741

    Advanced button debouncing




      I am trying to achieve the following functionality and not sure, whether I am proceeding in the right direction.


      I have a two button design (functionally named Start and Option). My PSoC4 device is most of the time in stop mode and is reset by pressing the Start button P0.7. This part works OK and I don't care about debouncing the button for this function, because there is a much longer functionality after start that is not affected by this Start button.


      However, when in active mode, I would like to use the Start and Option button to do some functionality. I need to know about both pressing and releasing the buttons (all the four ON/OFF button states have a meaning). My idea is to lead the pins into a Debouncer component and trigger the interrupt when either edge is detected. But I am lost, when would this Button_Status_Int be fired. I have also no idea, how to clear this interrupt, there is no API generated for this.


      Is this the good approach or do you have any suggestion? I looked into AN60024, but not sure about the implementation of my idea. I don't have all the code written, so I am not posting a complete project at the moment.


      Thank you,


        • 1. Re: Advanced button debouncing



          Attached is a project demo of the Button Switch debouncer, implemented entirely in software. It consumes no hardware resources and very little CPU cycles (<0.1%), which is particular useful for PSoC4. This is a draft version of the component, no datasheet or App Note available.

          Check if it can be useful. In my view,  using hardware debouncing for non-real time events, such as pressed buttons, is not justified on PSoC4 with limited resources. This is where software debounce fits well.




          P4_WDT auto generated_01b.png