Advanced button debouncing

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

cross mob
DaKo_463136
Level 5
Level 5
10 likes received 10 likes given 5 likes given

Hello,

I am trying to achieve the following functionality and not sure, whether I am proceeding in the right direction.

I have a two button design (functionally named Start and Option). My PSoC4 device is most of the time in stop mode and is reset by pressing the Start button P0.7. This part works OK and I don't care about debouncing the button for this function, because there is a much longer functionality after start that is not affected by this Start button.

However, when in active mode, I would like to use the Start and Option button to do some functionality. I need to know about both pressing and releasing the buttons (all the four ON/OFF button states have a meaning). My idea is to lead the pins into a Debouncer component and trigger the interrupt when either edge is detected. But I am lost, when would this Button_Status_Int be fired. I have also no idea, how to clear this interrupt, there is no API generated for this.

pastedImage_0.png

Is this the good approach or do you have any suggestion? I looked into AN60024, but not sure about the implementation of my idea. I don't have all the code written, so I am not posting a complete project at the moment.

Thank you,

David

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

David,

Attached is a project demo of the Button Switch debouncer, implemented entirely in software. It consumes no hardware resources and very little CPU cycles (<0.1%), which is particular useful for PSoC4. This is a draft version of the component, no datasheet or App Note available.

Check if it can be useful. In my view,  using hardware debouncing for non-real time events, such as pressed buttons, is not justified on PSoC4 with limited resources. This is where software debounce fits well.

/odissey1

ButtonSw_P4_WDT_callback_ex.png

P4_WDT auto generated_01b.png

View solution in original post

1 Reply
lock attach
Attachments are accessible only for community members.
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

David,

Attached is a project demo of the Button Switch debouncer, implemented entirely in software. It consumes no hardware resources and very little CPU cycles (<0.1%), which is particular useful for PSoC4. This is a draft version of the component, no datasheet or App Note available.

Check if it can be useful. In my view,  using hardware debouncing for non-real time events, such as pressed buttons, is not justified on PSoC4 with limited resources. This is where software debounce fits well.

/odissey1

ButtonSw_P4_WDT_callback_ex.png

P4_WDT auto generated_01b.png