cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

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
Reply
1 Solution
Esteemed Contributor II

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
Reply
3 Replies
Esteemed Contributor II

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
Reply
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
Reply
Esteemed Contributor II

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