Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > keypad using interrupts

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



keypad using interrupts
Moderator:
ANCY

Post Reply
Follow this topic



keypad using interrupts

mahmoud posted on 04 May 2013 12:17 PM PST
Top Contributor
67 Forum Posts

I trying to implement a 4 buttons keypad using interrupts. should I connect the push buttons directly to the ISRs or should I use PWMs connected as one shots to the ISRs?




Re: keypad using interrupts

hli posted on 04 May 2013 01:26 PM PST
Top Contributor
675 Forum Posts

Neither - use the debouncer component (under digital/functions), and connect that one to the ISR.



Re: keypad using interrupts

Bob Marlowe posted on 04 May 2013 01:33 PM PST
Top Contributor
1768 Forum Posts

I was tought NEVER to connect an interrupt directly to a mechanical switch since that may lead into troubles caused by bouncing.

 

Bob



Re: keypad using interrupts

mahmoud posted on 04 May 2013 01:36 PM PST
Top Contributor
67 Forum Posts

 ok thanks :)



Re: keypad using interrupts

danaaknight posted on 04 May 2013 01:42 PM PST
Top Contributor
1773 Forum Posts

Take a look at this for GPIO interrupt discussion www.cypress.com/

 

The debouncer usage discussion in datasheet suggests the following -

 

When to Use a Debouncer


A Debouncer component can be used to debounce the input digital signal from most types of
switches. Since it does a lot of work that could otherwise be done by firmware, it can be used
when a firmware-based switch debouncing solution is not practical.

 

Basically its pretty easy to debounce in firmware a pin generated interrupt, so if you are

concerned about total HW usage consider that as an approach. Uses no HW cells or routes.

 

Regards, Dana.



Re: keypad using interrupts

Bob Marlowe posted on 05 May 2013 02:32 AM PST
Top Contributor
1768 Forum Posts

... and of course I would like to introduce my "Making of a Keypad" elaborate. Bit old, but still working...

Dive into it here : http://www.cypress.com/?app=forum&id=2492&rID=68603

 

Bob

 



Re: keypad using interrupts

danaaknight posted on 05 May 2013 10:42 AM PST
Top Contributor
1773 Forum Posts

"I was tought NEVER to connect an interrupt directly to a mechanical switch since that may lead into troubles caused by bouncing."

 

I too have heard that before, and in general I use firmware to debounce.

 

But then if you examine what our peers have told us, re no mech sw to an interrupt, implication

is ISR rate potentially too high, you run up against the facts, mechanical that is, and contact inertia

causing relatively low rates. All the scope captures I have ever seen put those rates in the 10's of

uS to 10's of mS rates. In a 1 MIPs processor that was probably an issue. The other problem is if mech

sw input is used as clock or as data failing to meet Ts and Th times, but edge triggered ISRs pretty much

take care of that.

 

So in short I think the idea was born out of level triggered ISRs, slow cpu's, and a little fllooby dust thrown in.

 

That being said I think most of us still use firmware to handle.

 

Regards, Dana.

 

switch q



Re: keypad using interrupts

H L posted on 05 May 2013 04:15 PM PST
Top Contributor
679 Forum Posts

"I was tought NEVER to connect an interrupt directly to a mechanical switch since that may lead into troubles caused by bouncing."

Same here.

I guess debounce routine is one of those that we learned to write when we start our programming job. Because the boss always say that hardware increase prodcution cost, and software is not.

 

 



Re: keypad using interrupts

Bob Marlowe posted on 06 May 2013 12:13 AM PST
Top Contributor
1768 Forum Posts

Although there are several aproaches to de-bouncing I found some that will run questionary under bad conditions especially aging.

Or haven't you got some "old" equipment where the keys do not come up as pressed or come more than once? Despite a brokencontact this could be an indication of a, well, not-as-good-as-it-could-be debouncing method.

 

Bob



Re: keypad using interrupts

mahmoud posted on 11 May 2013 02:41 AM PST
Top Contributor
67 Forum Posts

 thanks :)






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20