4 Replies Latest reply on Jul 6, 2015 5:58 AM by RaAl_264636

    push button with denouncing implemented

       Hi there,


      I have gott switch connected to Psoc5 and would like to turn on LED, whenever button is pressed, looking for project how to actually do it. I also would like to implement with debouncing circuit, so not sure how could I do that in cypress.


      I tried something like this but doesn't work




      #include <device.h>


      volatile uint8  switchFlag = 0u;






      int main()


















                  switchFlag = 0u;
















          switchFlag = 1u;






      Top Design is attached.. If any mistake then let me know.


      Any help woud be great .







        • 1. Re: push button with denouncing implemented

          Use the debouncer component -







          There is an example project you can look at, start page, "Find Example project" link








          Regards, Dana.

          • 2. Re: push button with denouncing implemented

            Hi Dana,


            Thanks for your reply.


            I did use debouncer as you can see schematics in attachment, I used example code, but it doesn't work , you can see in above thread, my connections are on top design are right. Just would like to confirm that I have applied 3.3 V to switch and connected to one of pin and set as input, will that work as input interrupt ?


            So, I am not sure what is wrong , Is above code and schematics right ? 

            • 3. Re: push button with denouncing implemented

              Post a project archive -








              “File”                                                             Creator


              “Create Workspace Bundle”




              Regards, Dana.

              • 4. Re: push button with denouncing implemented

                Hi AK,




                it depends on how your input pin is configured. You wrote that the switch is connected to 3.3V. So your input pin must be configured for input with pull-down enabled, otherwise you wouldn't get the low voltage value when the button is not pressed.


                To be compatible with other MCUs it's recommended to connect the switch to GND, because pins are configured for input with pull-up resistor on most MCUs.