Up: Lab 6: Debouncing Switches Previous: 1 Prelab

Subsections

# 2 Lab

## 2.1 Switch Bounce

1. 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.
2. Test the circuit with a logic probe and make sure it works as described above.
3. 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.
4. 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.

5. 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?

6. Repeat with the switch initially in the open position.

## 2.2 Debouncing Your Switch with an SR latch

1. Build the circuit shown in Figure 2. Use resistors. Use a wire to simulate your switch.
2. Connect R, S, Q, and Q' to the logic analyzer.
3. Observe the outputs when you toggle your switch.
4. Does this circuit eliminate the bouncing?

## 2.3 Building a Real Debounced Switch

1. 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.
2. Again, observe your circuit using the logic analyzer.

Up: Lab 6: Debouncing Switches Previous: 1 Prelab