ELM ELM409SM Versatile debounce circuit Datasheet

ELM409
Versatile Debounce Circuit
Description
Features
The ELM409 is digital filter circuit that is used to
interface mechanical contacts to electronic circuits.
All mechanical contacts, whether from switches,
relays, etc. will have inherent ‘bounce’ when they
make or break a connection. When that contact is
used for the electrical input to a digital circuit, the
bounces can easily be incorrectly interpreted as
multiple inputs. The ELM409 contains all of the logic
that is typically required to remove the bounce from
such signals, and provide a signal that has only one
transition.
In addition to providing the standard debounce
function, the ELM409 may also be configured for
other useful functions such as generating pulses or
alternating output levels on signal transitions.
No external components are needed for the
operation of the ELM409, as all timing and logic
functions are performed internally.
•
•
•
•
•
•
•
Standard and extra long debounce times
Schmitt input provides hysteresis
Complementary circuit outputs
Needs no external timing components
Low power CMOS design - typically 1 mA at 5V
Wide supply range - 3.0 to 5.5 volt operation
High current drive outputs
Connection Diagram
PDIP and SOIC
(top view)
VDD
1
8
VSS
A
2
7
Out
B
3
6
Out
C
4
5
In
Applications
•
•
•
•
Pushbutton interface for logic circuits
Limit switch monitoring
Time delay generation
Power on sequencing
Block Diagram
A
B
C
2
3
4
Control Logic
500 msec
debounce
In
pulse
generator
5
25 msec
debounce
ELM409DSA
edge
detectors
edge
detectors
toggle
circuit
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
7
Out
6
Out
1 of 8
ELM409
Pin Descriptions
VDD (pin 1)
This pin is the positive supply pin, and should always
be the most positive point in the circuit. Internal
circuitry connected to this pin is used to provide
power-on reset of the microprocessor, so an external
reset signal is not required. Refer to the Electrical
Characteristics section for further information.
A, B, and C (pins 2, 3, and 4)
These three pins modify the behaviour of the
ELM409, providing eight different configurations.
They determine whether the output should follow the
input, be a momentary pulse, or toggle the output on
each input transition. As well, they can select either
a standard 25 msec debounce period, or a longer
500 msec one. The longer period may be useful for
some very noisy interfaces, or for situations that
need a slight delay. See the “ELM409 Operation”
section for more details on these options.
hysteresis means that very slow moving or noisy
signals can be accommodated by the ELM409
without needing the signal to be preconditioned by
any external circuitry. (A standard CMOS input
should never have a slowly varying signal applied,
as it may cause excessive currents to flow internally,
but a Schmitt input circuit does not have this
limitation.)
Out (pin 7) and Out (pin 6)
The ‘debounced’ and processed signal is output on
pin 7, while the complement of this signal is output
on pin 6. These are high current CMOS drivers, so
will interface to virtually all of the common digital
logic families.
VSS (pin 8)
Circuit common is connected to this pin. This should
be the most negative point in the circuit.
In (pin 5)
The signal that is to be processed is applied to this
pin. Before the signal is ‘debounced’, it is passed
through a Schmitt trigger - a special buffer circuit that
has hysteresis in its gain function. The use of
Ordering Information
These integrated circuits are available in either the 300 mil plastic DIP format, or in the 208 mil SOIC surface
mount type of package. To order, add the appropriate suffix to the part number:
300 mil Plastic DIP............................... ELM409P
208 mil SOIC..................................... ELM409SM
All rights reserved. Copyright 2009 by Elm Electronics Inc.
Every effort is made to verify the accuracy of information provided in this document, but no representation or warranty can be
given and no liability assumed by Elm Electronics with respect to the accuracy and/or use of any products or information
described in this document. Elm Electronics will not be responsible for any patent infringements arising from the use of these
products or information, and does not authorize or warrant the use of any Elm Electronics product in life support devices and/or
systems. Elm Electronics reserves the right to make changes to the device(s) described in this document in order to improve
reliability, function, or design.
ELM409DSA
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
2 of 8
ELM409
Absolute Maximum Ratings
Storage Temperature....................... -65°C to +150°C
Ambient Temperature with
Power Applied....................................-40°C to +85°C
Voltage on VDD with respect to VSS............ 0 to +7.5V
Note:
Stresses beyond those listed here will likely damage
the device. These values are given as a design
guideline only. The ability to operate to these levels
is neither inferred nor recommended.
Voltage on any other pin with
respect to VSS........................... -0.6V to (VDD + 0.6V)
Electrical Characteristics
All values are for operation at 25°C and a 5V supply, unless otherwise noted. For further information, refer to note 1 below.
Characteristic
Minimum
Typical
Supply Voltage, VDD
3.0
5.0
VDD rate of rise
0.05
Maximum Units
5.5
Conditions
V
V/ms
see note 2
Average Supply Current, IDD
1.0
2.4
mA
see note 3
Input (pin 5)
Schmitt trigger
thresholds
2.9
4.0
V
VDD = 5.0V
Input (pin 5)
Schmitt trigger
thresholds
rising
falling
1.0
rising
falling
1.5
1.6
0.6
V
2.4
V
VDD = 3.0V
1.0
V
Output low voltage
0.3
V
Current (sink) = 10 mA
Output high voltage
4.2
V
Current (source) = 10 mA
Standard debounce time
25
msec
see note 4
Long debounce time
500
msec
see note 4
Output pulse width
50
msec
see note 4
Notes:
1. This integrated circuit is produced using one of the Microchip Technology Inc.’s PIC12C5XX products as the
core embedded microcontroller. For further device specifications, and possibly clarification of those given,
please refer to the appropriate Microchip documentation.
2. This spec must be met in order to ensure that a correct power on reset occurs. It is quite easily achieved
using most common types of supplies, but may be violated if one uses a slowly varying supply voltage, as
may be obtained through direct connection to solar cells, or some charge pump circuits.
3. Device only. Does not include any current supplied to external circuits.
4. The ELM409 uses an internal RC oscillator for the timing. This oscillator typically maintains an accuracy of
2% over the allowed temperature and voltage range.
ELM409DSA
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
3 of 8
ELM409
About Contact Bounce
The circuit of Figure 1 below shows one possible
connection that might be made between a mechanical
switch and a digital circuit. The pushbutton could be
used to summon an elevator, or to turn a circuit on, or
it could be a switch that is operated by foot pressure to
count the number of people entering a room. It does
not matter what the function is actually - in every case
we simply need a clean signal to present to the logic.
Normally, the pushbutton will not be pressed, so
its contacts will be open, and the digital circuit will ‘see’
taken from our pushbutton tests (and shows the output
from the ELM409 in the lower trace). Note that the
signal alternates between high and low several times,
bouncing between the levels. This bounce occurs
when the moving contacts of the switch meet the
stationary contacts, and is simply due to the physics of
the two parts meeting one another. The bounces do
not seem to have a defining characteristic that would
allow the behaviour to be predicted and filtered - it is
basically digital noise.
If this signal were to be input to the digital circuit
as it is, it would be seen as at least two switch presses
(and maybe more). Note that when the contacts open,
there is a similar problem, as shown in Figure 3:
Digital
Circuit
Figure 1. Pushbutton input to digital logic
only a resistor to circuit common (a ‘low ‘input). When
the pushbutton is pressed, the contacts close and the
digital circuit will be connected to the positive power
supply, or a logic ‘high’. It should be a simple matter of
processing this signal, but it is often not.
The oscilloscope trace of Figure 2 shows the
voltage that the digital circuit of Figure 1 might see
when the pushbutton is pressed. It is an actual trace
Figure 3. Bounce on switch opening
Seeing multiple inputs for a single switch press is
certainly not what is intended by any circuit, and it
needs to be addressed. The technique of ‘cleaning up’
such a signal is commonly known as ‘debouncing’, and
that is what the ELM409 does. It simply waits until the
bounces stop, then waits an additional time (the
debounce time) to be sure that there are no more
bounces likely to occur. Choosing an appropriate
debounce time is a design choice, but 25 msec seems
to be a good value.
There are several analog methods of performing
the ‘debouncing’ of a signal, many that work extremely
well, but we do not think that any work better than the
ELM409.
Figure 2. Bounce on switch closing
ELM409DSA
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
4 of 8
ELM409
ELM409 Operation
The circuit of Figure 4 shows how the ELM409
would typically be connected to debounce the signal of
Figure 1. Other than powering the ELM409, all that is
needed is to connect the options pins (A, B and C) to
VSS (providing low levels on all three), connect the
noisy switch signal to the input pin, and then connect
the ELM409 output pin to the digital circuit.
The output of the ELM409 in Figure 4 would
appear as shown in the ‘scope traces of Figures 2 and
3 (the lower traces). There is a slight delay (25 msec)
due to the debounce period, but otherwise, the signal
appears as you would expect from an ‘ideal’ switch.
The ELM409 is capable of performing several
other functions on the input signal - it can do more that
just debounce the signal. For example, it can provide
a change in output on the signal edges (transitions
from a low to a high level, or from a high to a low
level), and it can alternate (toggle) the output on each
occurrence of an edge. Each of these possibilities are
selected by changing the logic levels at the A, B and C
pins. The eight combinations are described in Table 1
below, and also appear pictorially on the next page.
4
3
2
1
409
5
6
7
8
Digital
Circuit
Figure 4. Debouncing the pushbutton
Function
A
B
C
Debounce Period
Notes
Follows
Input
0
0
0
25 msec
Standard contact debounce
0
0
1
500 msec
For very noisy circuits
Pulse on
Rising Edge
0
1
0
25 msec
Output pulse is 50 msec wide
0
1
1
500 msec
Output pulse is 50 msec wide
Pulse on
Falling Edge
1
0
0
25 msec
Output pulse is 50 msec wide
1
0
1
500 msec
Output pulse is 50 msec wide
Toggle
on Edge
1
1
0
25 msec
Changes on input H -> L
1
1
1
25 msec
Changes on input L -> H
Table 1. ELM409 options
ELM409DSA
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
5 of 8
ELM409
ELM409 Operation (continued)
The following diagrams provide a pictorial view of
each of the eight ELM409 options:
Input
(pin 5)
ABC = 000 or 001
Output
(pin 7)
ABC = 010 or 011
Output
(pin 7)
25 msec or 500 msec
50 msec
25 msec or 500 msec
ABC = 100 or 101
50 msec
Output
(pin 7)
25 msec or 500 msec
ABC = 110
Output
(pin 7)
25 msec or 500 msec
ABC = 111
Output
(pin 7)
25 msec or 500 msec
Figure 5. ELM409 Timing Diagrams
ELM409DSA
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
6 of 8
ELM409
Example Applications
This section shows several different ways to use
the ELM409. The first example (Figure 6) is actually a
variation of the circuit shown in Figure 4.
Figure 6 adds two components that should always
be considered in every ELM409 design. The first is a
supply bypass capacitor. Digital circuits will often have
transients (‘spikes’) in their current flow due to the
internal switching process. By adding a capacitor very
close to the IC, much of the current for these spikes
can be supplied by the capacitor rather than through
the (inductive) leads from the supply. The net result is
that there will be less noise generated at the supply
by the ELM409. A value of 0.01µF works well.
The other component that was added in Figure 6
is a series resistor at the input (pin 5). This resistor is
recommended when the electrical contact or switch is
any more than a few feet away from the ELM409 IC.
Placing the resistor in series with the input serves to
limit induced currents that might otherwise damage the
ELM409. A minimum value of a few hundred ohms is
recommended, and a larger value (such as the 4.7KΩ
shown), is preferred.
The next example (shown in Figure 7) has the
pushbutton connected between circuit common and
the input, rather than from the positive supply. An
arrow is shown at the output, symbolizing the output
signal, which is then connected as appropriate.
The one difference with this circuit is that the input
voltage will go from a high level to a low level when the
switch is pressed. To accommodate this, the options
pins have been set to 110, providing a toggle function
that changes state on each high to low transition. The
circuit will provide alternating high and low outputs
which change state each time the switch is pressed.
If the options pins had been set to 000 (ie all tied
low), the circuit would provide an output that follows
the switch presses, but might seem inverted. That is,
pin 7 would normally be at a high level, and would go
to a low level when the switch is pressed. If an output
that is normally low and goes high when the switch is
pressed is required, simply use pin 6 for the output
rather than pin 7.
This section concludes on page 8, with three more
example circuits and a short description of each.
4
3
2
0.01µF
1
409
5
6
7
8
4.7KΩ
Digital
Circuit
Figure 6. Debouncing the pushbutton revisited
4
3
2
1
0.01µF
409
5
6
7
8
4.7KΩ
Figure 7. Toggle circuit with the pushbutton to common
ELM409DSA
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
7 of 8
ELM409
Example Applications (continued)
The following are a a few circuits that use the
ELM409, but may not be what comes to mind when
you think of debouncing. They take advantage of the
internal timers in the ELM409 as well as the ability to
change options while the circuit is operational, to
provide some interesting functions.
The first (Figure 8) is a circuit that simply connects
the debounce input to the positive supply. With the
debounce period set for 500 msec, the output will
initially be low, then go high 500 msec after the power
is turned on. This delay may be useful if trying to
sequence the power to different circuits, or enable the
outputs (audio power amplifiers often need this delay
to allow the supplies to settle before connecting the
amplifier outputs to the speakers).
Figure 9 shows a circuit that provides a single
50 msec wide pulse at the output, 25 msec after power
has been applied. It relies on the fact that the
ELM409’s pin 7 output is always at a low level on
power up (and pin 6 is always high), so the initial
options setting will then be 010, for a 50 msec pulse
after a 25 msec debounce period. Once the output
pulse begins, however, the connection from pin 7 to
pin 4 causes the options to change to 011, giving a
debounce period of 500 msec (which can never be
met by a 50 msec pulse). The output remains low from
that time on.
This circuit works because the option pins are
always read just before a 25 msec debounce period is
about to expire (allowing for changes ‘on the fly’). In
this case, the pulse output is at its midpoint when the
pins are read, so the new latched setting becomes
011, and the debounce period changes to 500 msec.
As the pulse never lasts that long, it is ignored by the
500 msec debounce circuit, and the output never
changes again.
The final circuit also uses the output to modify the
input, and the debounce period. The result is a series
of 25 msec pulses with 500 msec gaps in between,
that continually repeat. Low frequency oscillators such
as this may be useful on the test bench, or it may
simply be used to drive an LED in order to attract
attention.
These are just a few of the many applications
possible with the ELM409… Enjoy!
4
3
2
1
409
5
6
7
8
Figure 8. Power on delay
4
3
2
1
409
5
6
7
8
Figure 9. Power on pulse
4
3
2
1
409
5
6
7
8
Figure 10. Low frequency oscillator
ELM409DSA
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
8 of 8
Similar pages