Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Efficient switch polling

Status
Not open for further replies.

qtommer

Member
I am polling 3 TACT switches in a continuous loop using a MCU. Should a switch be asserted, the worst case delay that the switch has to wait for the program to poll it again is 14us. Is there any sort of RC arrangement I can apply to the switch to hold the value (once asserted) for at least 14us so that the MCU can receive it without any possibility of 'missing' the switch input.

I know 14us is very short, but I want the reading of the switches to be as smooth and efficient as possible.

Thanks:)
 
To avoid noise and switch bounce, 14 µs is too short.

I would count at least 100 times that, and probably 1000 times, so 14 ms or more, before I registered the switch as being pressed. I would also apply the same on release.

It will still seem instant to the user.
 
There was flickering of the output (on an LED) when it was too short. The contact of the button when pressed was way longer than the program execution. I added a delay in between and everything's sweet now. Thanks!:)
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top