Unformatted text preview:

MICROPROCESSOR SUPERVISOR CIRCUITS Sep 01, 2000 APPLICATION NOTE 287Switch Bounce and Other Dirty Little SecretsMaxim provides a simple solution to reduce the effects of switch ringing. These devices are applicable for applications with push-button panels, touch screen displays, and simple push-button devices. These devices also provide overvoltage and ESD protection. The MAX6816/MAX6817/MAX6818 integrates numerous functions into a single IC, thus eliminating numerous discrete components.Switches can do some really odd things. Most engineers learn this dirty little secret soon after connecting a switch or a relay to a digital system. Switches don't make and break cleanly on the time scales of digital systems. Instead, a typical switch makes multiple transitions during the tens of milliseconds required to open or close, due to effects that include age, operating inertia, mechanical design, and the microscopic condition of the switch-contact surfaces. Commonly called "switch bounce," this behavior is an inescapable fact of life.After connecting a standard switch to a digital counting circuit, you can observe several counts on opening and several counts on closing (Figures 1 and 2). This erratic action can wreak havoc on data, because the exact number of counts does not necessarily repeat in the long term. Switch bounce is not consistent from unit to unit, lot to lot, or even over the life of an individual switch. Membrane switches and some other types don't appear to bounce when new, but all mechanical switches bounce sometimes. Nothing can ensure that another switch of the same type will act the same way, or that a particular switch will remain bounce-free as it ages. Figure 1. This rising-edge switch bounce for a small pushbutton switch shows an approximate 5ms bounce interval that includes 10 transitions. Like a bouncing ball, the switch-action frequency increases toward the right. Figure 2. Another rising-edge switch bounce (for a 5A contact relay) shows an approximate 5.5ms bounce interval that includes 20 full-amplitude transitions and a few smaller ones.In addition to bounce, switches and digital systems have other annoying habits. Strange things happen, for example, when you run switch wiring in a noisy industrial environment. An open switch has high impedance by definition, so interfering signals have an easy load to work against. Any noise impulse that is capacitively or inductively coupled to the switch wiring can cause phantom switch closures.Imagine a kind of specialized industrial computer called a programmable logic controller (PLC) that controls a motor through a hefty relay. A limit switch placed near the motor provides position feedback to a digital input on the PLC. When the PLC tells the motor to start, a surge of current flowing to the relay and the motor can couple to other conductors in the long wiring runs, causing ground bounce or a capacitively coupled spike in the digital input. If not designed properly, the PLC can interpret this spike as a premature switch closure and shut down the operation. Similar things can happen when the PLC turns the load off, due to the effect of wiring capacitance, wiring inductance, and the inductive kick of the relay and the motor. If the PLC and its digital inputs are not designed properly, these spikes and transients can cause erroneous readings on the digital inputs. The digital and analog inputs on equipment used in the home, the office, and industry are subject to the effects of overvoltage, voltage transients, and ESD strikes. Overvoltage is caused by improper wiring, miscellaneous fault conditions, and power-supply sequencing (in which one box with power off is connected to another with power on, even temporarily). Voltage transients are often associated with capacitively or inductively coupled spikes, as discussed above. ESD can strike a connector, an operator console, or a terminal strip during installation. Any of these transients can cause destruction if the system latches up. If not destructive, they can cause CPU resets, watchdog overflows, and other types of erratic operation. System designers should be aware of these problems and the methods used to combat them. One solution for such interface problems is a new series of ICs. Available in low-cost easy-to-use configurations, the ICs (MAX6816/6817/6818 single/dual/octal switch debouncers) offer foolproof, software-free debouncing, along with protection against overvoltage and ESD. This article highlights the application of IC switch debouncers, while describing the classic methods for thwarting overvoltage, voltage/current spikes, switch bounce, and ESD.Switch Bounce If asked, most engineers would say that switches are debounced in software and that debouncing presents "no problem." Both assumptions are true if you pay proper attention to the details. Software debouncing takes care of the bounce, but it does not address the problems of overvoltage, ESD, or other transients. Debouncing with resistors and capacitors is also possible. In general, you need a pullup resistor, a resistor and a capacitor in series, a resistor to the input of a Schmitt-trigger buffer, and (often) a diode to ensure that the capacitor charge doesn't force lots of current through the buffer's input-protection network during power-down. The resulting parts count can be unwieldy for multiple-input systems (Figure 3), so this approach will not be covered in any detail.Figure 3. Discrete components can provide debouncing with protection against ESD and overvoltage, but a properly designed discrete interface that accounts for all likely faults is unwieldy for more than a few inputs.Debouncing by means of software is the primary method in use today. A good debouncing routine is actually real-time software that acts as a simple low-pass digital filter. Nonswitch digital inputs are often routed through debounce filters as well. That technique can eliminate short transients at the input by ensuring a stable state before reporting the input open or closed.The pseudo code below illustrates a software-debounce routine for one input. It accommodates multiple inputs if you generalize the routine and use pointer-based variables, etc. Though a mediocre approach at best, this type of routine is often used in spite of the problems and the flaws discussed below.Action Comments 1. Input timer: expired? A timer bit is polled in the main routine.2. Return if no timer. Go do something more useful.3. Get


View Full Document

OSU ECE 473 - APPLICATION NOTE 287

Download APPLICATION NOTE 287
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view APPLICATION NOTE 287 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view APPLICATION NOTE 287 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?