MCP6271R Microchip Technology Inc., MCP6271R Datasheet - Page 5

no-image

MCP6271R

Manufacturer Part Number
MCP6271R
Description
170 ?a, 2 Mhz Rail-to-rail Op Amp
Manufacturer
Microchip Technology Inc.
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
MCP6271RT-E/OT
Manufacturer:
MCHP
Quantity:
6 004
Part Number:
MCP6271RT-E/OT
Manufacturer:
MICROCHIP/微芯
Quantity:
20 000
The Debounce Debacle
By Bonnie C. Baker, Microchip Technology Inc.
Mechanical switches play an important role in many
microcontroller and microprocessor applications. These types
of switches are simple, inexpensive and easy to install. But, the
perceived simplicity of mechanical switches can be deceiving if
you intend to keep your user happy. For instance, an annoying,
poor switch implementation is a TV button that advances the
channel two or three channels higher instead of the intended
one-channel advance. More critically, a switch sensor could
determine the status of a door. An open door trips an alarm
or motivates an attendant to go to the site. False alarms can
be disruptive and expensive. Some switches reside in time-
critical environments, like in keyboards where a quick, accurate
determination of the switch position is critical.
It is easy to blame these problems on the switch, instead of
the electronics that sense the switch position. An alternative
approach is to examine the dynamic characteristics of your
switch and assess its environmental influences. All switches
demonstrate a switch contact, “bouncing” action as the switch
opens or closes. The switch contacts actually bounce off of
each other several times before the contacts settle to their final
position. If the switch position is sensitive to the touch, a person
who had too much coffee could cause a bouncing action to
occur as a result of human touch. Switch manufacturers call this
“playing” with the switch. You also need to look at environmental
interference, such as vibrations or electromagnetic interference
(EMI). Once you’ve evaluated these system dynamics, you are
ready to design the electronics in your circuit.
You can implement the switch-interface electronics using an
analog or digital solution. The analog solution uses an R/C filter
to control the bouncing signal. A digital gate, with hysteresis,
takes the output of the R/C filter and sends the switch-position
signal into the microcontroller or microprocessor. In this type of
system, the bounce time is assumed slower than the R/C time
constant. You are probably safe if you design with a 500 ms
switch closure time. But, don’t hesitate to verify this timing with
your switch on the bench. You will find that switches bounce
less as they open as compared to when they close. In this
configuration, the microcontroller or microprocessor receives the
switch position after the fact.
Techniques To Minimize Noise
An alternative to the analog solution is a purely digital one. A
digital solution is “almost” free because you no longer need your
external components. The analog option has the additional cost
of materials, installation and board real estate. The pure digital
solution can immediately determine if the switch has changed.
The microcontroller or microprocessor can then filter the switch
bounce digitally. This debounce circuit can be thought of as a
low-pass/decimation filter. The “brute-force debounce” digital
solution uses a programmed delay time in firmware to replace
the analog R/C time constant.
As an alternative, it is possible to adjust this programmed delay
time by using clever programming techniques. This type of
algorithm increments a counter when the switch output signal is
high and decrements the same counter when the switch output is
low. By taking multiple samples, the counter will over range either
high or low, which identifies the switch state. The programmer
determines the number of and timing between samples. The
timing of the samples should not correlate to the main frequency
of microcontroller or microprocessor clocks.
Some say the attention to issues surrounding a switch’s open
and closure action is a lost art. If this is so, evaluating all the
elements of your system is a lost art as well. Electronic systems
in the real world usually have a switch somewhere in the circuit.
The opening or closing of a switch seldom demonstrates a clean
transition. The connection consists of a series of “breaks” and
“makes” before the final “make” (or “break”). This bouncing-
phenomena can occur several to hundreds of times before things
settle. The best, cost-effective solution comes from using the
microcontroller/microprocessor approach. You can change your
design as you experiment, or on the fly at next to no cost.
References
Systems Programming Magazine, 6-16-04.
Technology Inc., DS40051.
Feb. 21, 2002.
“My Favorite Software Debouncers”, Jack Ganssle, Embedded
“PICkit™ 1 Flash Starter Kit, User’s Guide”, Microchip
“Examining Switch-Debounce Circuits”, Ron Mancini, EDN,
Analog and Interface Guide – Volume 2
3

Related parts for MCP6271R