- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We've been doing all our debounces through code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are always welcome.
Bob