PSOC Creator Debouncer Component and Terminal width

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I'm trying to use an input consisting of 2 buttons on a bus to a Debouncer Component.  Readings will be handled the same.  Specifically, a TCPWM timer capture and/or and Interrupt.  How would I configure Top Design to do this, sense all outputs will have a terminal width of 2 bits and the Timer and interrupts only accept 1 bit?

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Easiest will be to look for the inputs in an interrupt handler every 10ms. finding 10 consecutive same results would result in a button press.
When you use Capsense instead, de-bouncing is handled by the component.

   

 

   

Bob

View solution in original post

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Easiest will be to look for the inputs in an interrupt handler every 10ms. finding 10 consecutive same results would result in a button press.
When you use Capsense instead, de-bouncing is handled by the component.

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Maybe you can tell me what's wrong here.  I'm having trouble deciphering the  TCPWM Timer Counter data sheet and using ReadCounter variables just for debugging, I can't seem to make it actually count Up or Down, let alone actually toggle an interrupt.  Just to give some insight on what's going on:  I have 2 buttons on a bus to a Debouncer Component.  The results of 'q' are '1' or '2' if either button is pressed, '3' (both are high-pinned) if not.  This way, I can debounce one of the 2 buttons, then use the Timer to start and define a click/hold type and associate it with the active button.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Your input frequency to the TCPWM is 25kHz, the period is set to 60000. So interrupts will occur only every 2.4s which is probably not what you want. I would suggest to build an internal clock which is updated every 1 to 10 ms using a timer and incrementing a ms-counter. This timebase you can easily use to setup some software logic to decide how long a button is pressed.

   

 

   

Bob