debouncing - 2004 The Ganssle Group. This work may be used...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 2004 The Ganssle Group. This work may be used by individuals and companies, but all publication rights reserved A Guide to Debouncing August 2004 Rev 1: April, 2006 Rev 2: April, 2007 Rev 3: June, 2008 Jack G. Ganssle The Ganssle Group PO Box 38346 Baltimore, MD 21231 (410) 504-6660 fax (647) 439-1454 Page 1 A Guide to Debouncing The beer warms a bit as you pound the remote control. Again and again, temper fraying, you click the channel up key until the TV finally rewards your efforts. But it turns out channel 345 is playing Jeopardy so you again wave the remote in the general direction of the set and continue fiddling with the buttons. Some remotes work astonishingly well, even when you bounce the beam off three walls before it impinges on the TVs IR detector. Others dont. One vendor told me reliability simply isnt important as users will subconsciously hit the button again and again till the channel changes. When a single remote press causes the tube to jump two channels, we developers know lousy debounce code is at fault. The FM radio on my sailboat has a tuning button that advances too far when I hit it hard. The usual suspect: bounce. When the contacts of any mechanical switch bang together they rebound a bit before settling, causing bounce. Debouncing, of course, is the process of removing the bounces, of converting the brutish realities of the analog world into pristine ones and zeros. Both hardware and software solutions exist, though by far the most common are those done in a snippet of code. Surf the net to sample various approaches to debouncing. Most are pretty lame. Few are based on experimental bounce parameters. A medley of anecdotal tales passed around the newsgroups substitute for empirical evidence. Ask most developers about the characteristics of a bounce and theyll toss out a guess at a max bounce time. But theres an awful lot going on during the bounce. How can we build an effective bounce filter, in hardware or software, unless we understand the entire event? During that time a long and complex string of binary bits is hitting our code. What are the characteristics of that data? Were writing functions that process an utterly mysterious and unknown input string. Thats hardly the right way to build reliable code. The Data So I ran some experiments. I pulled some old switches out of my junk box. 20 bucks at the ever-annoying local Radio Shack yielded more (have you noticed that Radio Shack has fewer and fewer components? Its getting hard to buy a lousy NPN transistor there). Baynesville Electronics (, Baltimores best electronics store, proved a switch treasure trove. Eventually I had 18 very different kinds of switches....
View Full Document

This document was uploaded on 02/08/2012.

Page1 / 26

debouncing - 2004 The Ganssle Group. This work may be used...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online