You are here

New hobbyist debounce question | Cypress Semiconductor

New hobbyist debounce question

Summary:8 Replies, Latest post by Bob Marlowe on 24 Apr 2017 01:24 AM PDT
Verified Answers:2
Last post
Log in to post new comments.
simcole_1771416's picture
User
8 posts

Hi,

I recently discovered PSOC after playing with arduino for the past 6 months or so. I'm JUST a hobbiest and have NO formal training in anything like this. I have some basic questions if someone can help me. I want to debounce 5 buttons and have each button do it's own thing. They are N.O. buttons connected to ground. I made 2 pictures to see which is the correct way to do it. I couldn't figure out if I could use 1 debounce routine for all 5 buttons or had to have 5 separate ones. I was also unsure of what Hz or MHz etc to set the clock and reading a datasheet is still mostly Greek to me. :( Which way should i do it based on these pictures?

 

 

user_1377889's picture
User
10803 posts

Welcome in the forum.

Both versions are principially the same, although the second is easier to route.Some things you should care for:

  • Configure the input pins as "Resistive pull up" and "Initially Drive State" to high.
  • Remove the NOT gates, it is easier to do in code.
  • Use a single StateRegister component with 5 inputs
  • Connect the pins (wire) with wires to the debouncer.
  • Use the d-output only
  • Configure the debouncer to act on falling edge only
  • Set the frequency of the clock to the switch bounce-time which is about 10 ms (good switches).Frequency is 100Hz
  • Lastly:Do read the datasheet Knowledge may help you, not knowing does not.

 

Bob

mas129_2256741's picture
User
21 posts

We've been doing all our debounces through code.

simcole_1771416's picture
User
8 posts

Bob,

I just got off work and I was THRILLED to see such a great detailed answer. I am reading the datasheets, but it usually leaves me with more questions than answers when I'm done. I can't believe how powerful this IDE and Product is with programmable GPIO. I have yet to figure out how to find or select LF clock but I may have wrong device selected for my pioneer kit. I'm reading but I haven't found my answer yet. I see frequency divider, but I'll keep reading. Here is my new picture. Thanks so much Bob for such a constructive post.

You can see the clock error in the pic I'm working on.

 

user_1377889's picture
User
10803 posts

Can you please post your complete project, so that we all can have a look at all of your settings.To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

 

Bob

simcole_1771416's picture
User
8 posts

Bob,

Thanks for the hand holding. I'm already wishing the community was as big as arduino, and probably would be if they knew how awesome this thing is. Sometimes finding current examples has proved difficult. I've attached the project. 

user_1377889's picture
User
10803 posts

You will have to extend the project with your needed functionality .

 

Happy coding
Bob

simcole_1771416's picture
User
8 posts

Bob,

Thanks for showing me this. I'm doing some reading on that component now. I would have never found this on my own. I'm going to read over the pdf for the timer and get familiar. Thank you.

user_1377889's picture
User
10803 posts

You are always welcome.

Bob

Log in to post new comments.
RSS Back to Top
Topic locked