Foghorn 8 Posted April 8, 2014 Share Posted April 8, 2014 I implemented Jack Ganssle's State Button Debouncer Algorithm as C/C++ platform independent libraries. This is a fairly robust algorithm that can play nicely with interrupts (if the library is set up to be used that way) and can also work with setups where the button pins are polled on a regular interval instead. The library can debounce buttons on an 8 bit port in parallel and is efficient in that it only requires 14 bytes of RAM per instantiation, is malleable in that the amount of RAM consumed by each instantiation can be reduced if desired, and uses no computationally expensive operations such as multiplication and division to perform the debouncing. If you would like a detailed explanation of the theory behind the algorithm, feel free to follow the link provided below: http://www.ganssle.com/debouncing.htm The rest of the documentation can be found inside of the header files within the zipped file below. EDIT: Updated the button debouncer to revision 1.1. Now instead of specifying pullups or pulldowns are being used for an entire port, you can pick and choose which button pins will have pullups or pulldowns respectively. Also, there is no additional performance or extra RAM penalty for this approach. So, enjoy the extra functionality. Button Debouncer Rev 1.1.zip bluehash, tripwire, Automate and 1 other 4 Quote 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.