Jump to content
Sign in to follow this  
zeke

Switches: Polled or Interrupts?

Recommended Posts

Hi Guys,

 

I'm starting to work with the switches on my dev board and I wanted to see what everyone else is doing.

 

Are you polling your switches or are you using an ISR?

 

How are you debouncing them - hardware or software?

Share this post


Link to post
Share on other sites

I was contemplating a combination of the two.

 

Here's what I'm thinking:

- Wait for a switch interrupt

- Once received, deactivate those interrupts and,

- Start polling the switches every ~50 ms to debounce

- Deactivate polling and reactivate switch interrupts in ~250ms

 

Overkill?

Share this post


Link to post
Share on other sites
I was contemplating a combination of the two.

 

Here's what I'm thinking:

- Wait for a switch interrupt

- Once received, deactivate those interrupts and,

- Start polling the switches every ~50 ms to debounce

- Deactivate polling and reactivate switch interrupts in ~250ms

 

Overkill?

No! It's not 'overkill'. That's one of a few excellent ways to do it...

 

Take care & cheerful regards...

Share this post


Link to post
Share on other sites

Hmmm... I wonder how I could implement this into my code. I don't put my processor into low power mode. This AN puts the device into LPM4.

 

It's a cool method. I just have to figure out how to make it work for me.

 

Thanks #.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...