Software Debouncing

Debounce waveform

The old documentation was gathered from 1988 and put through LaTeX in 2011, with a download:
Software Debouncing Digital Inputs 175 kBytes softDebounce.pdf

At varsity we were told how to debouce a digital circuit; assuming a pushbutton on a nicely grounded printed circuit board that two flip flops and a couple of AND gates could sort out. An edge or two amongst friends, but then came the clunky mechanical contactor, followed by factories who used the cheapest (upfront cost) equipment to start motors. Watching a whole panel of relays chatter on output cards when a large motor was started “direct on-line” next to our monitoring equipment in a tannery was an eye opener. Not exactly the place where you would want to put down any test equipment, so as the lights dimmed when the motor started we assumed that the supply dropped. A few years after that, armed with an oscilloscope connected to a supposedly grounded panel almost two hundred meters from a 1 megawatt motor in a tyre plant, the noise was so bad that it was a surprise that anything worked. (A pretty good design by Reliance Electric for their drive that was driving a retread conveyor, and tripped when the mixer motor started. After showing the plant engineer their ‘ground’ they did something about that part of the factory).

Early software debouncing of simulating a shift register chain with either all outputs low or all high did not work in these environments. One glitch and the whole chain takes a hiccup. The idea of counting up or down for various edges might look intuitive once it has been explained, but when we first tried it out, we were so impressed that it could have such high throughput with low-end processors, we documented it for our customers. Unfortunately, we did not do a decent study or publish it in a freely available brochure, so are making it available here as a foundation of what our next cards will include. The first trials were on 16MHz 68000 processors pre-1988, and when a client had a quadrature counting problem, we used the same software code on a 50MHz ARM in 2008 to handle proximity sensors with a 1kHz waveform due to a spinning slotted disk. We had plenty of spare capacity, but the battery powered drill fixture could not spin faster and the proximity sensors were rated up to 2kHz (but their waveform edges at 1kHz were unimpressive). Well, not everyone had seen this before, so have a look and feel free to use it. I never checked any patent issues, so maybe have a cursory look before you plunge headlong into the touch sensor business—a patent mine field on the obvious.

Averaging, weighted last values etc., were also tried on analogue readings. The counting with threshold limits overcomes any “reserve build up” when input values are unchanged. The code will be used in our alarm processing (yes we will post that soon),...