Up: Lab 6: Debouncing Switches
Previous: 1 Prelab
Subsections
- Build the switch of Figure 3. For now, just use a
wire as the switch. Plug the wire into GND to bring OUT (the switch
output) low, alternatively, unplug it to bring OUT high.
Figure 3:
A simple switch
|
- Test the circuit with a logic probe and make sure it works as
described above.
- Connect the output of the switch to one channel of your logic
analyzer. Set up the logic analyzer for a 5 MHz internal clock.
Start with your switch closed (wire in the GND hole). Click on the
single running man button, pull the wire out, and see if you can
observe switch bounce.
- You couldn't see the switch bounce in the above part because the
logic analyzer is much faster than you are. By the time you pulled
out the wire after you started sampling, the analyzer had already
finished sampling, so you were not able to observe the low-to-high
transition of the switch. In order to observe this transition you
need to have the logic analyzer stop shortly after this transition.
Making the logic analyzer stop after observing a desired pattern is
called triggering. To trigger the logic analyzer on the low-to-high
transition of your switch, do the following:
- Click on the ``Trig'' icon, click on the channel you are
going to use and select ``1'' to capture the input on whenever
your channel is 1. After the line goes high, it will sample for
a while longer, then show the logic trace both before and after
the trigger condition. Then click the ``ok'' button, and you
are ready to start sampling.
- Pull the wire out of the GND hole. The logic analyzer should
stop, and display the switch bouncing.
- Capture the waveform for several switch bounces. How many bounces
do you typically get? What is the typical length of a bounce? From
the initial low-to-high transition, how long does it take the
switch to reach a constant high value?
- Repeat with the switch initially in the open position.
- Build the circuit shown in Figure 2. Use
resistors. Use a wire to simulate your switch.
- Connect R, S, Q, and Q' to the logic analyzer.
- Observe the outputs when you toggle your switch.
- Does this circuit eliminate the bouncing?
- The switch you are using is a single-pole two-throw switch. When your
switch is oriented with the hinge on the top:
- The common leads will be the two on top.
- The normally closed lead is the one on the left, and the
normally open lead is on the right.
- With this information you should be able to build a
debounced switch by substituting your single-pole
double-throw switch for the wire, in the previous circuit.
- Again, observe your circuit using the logic analyzer.
Up: Lab 6: Debouncing Switches
Previous: 1 Prelab
Copyright © 2008, Electrical Engineering Department, New Mexico Tech
Last Modified 2009-10-13