Switch DebounceHaving a component with memory can help us design circuits to solve a real variety of problems. To see how flexible flops are, we'll look at the problem of switch debounce. Consider this circuit, which is a fairly standard design for getting digital input from a push=button:
Now imagine what happens when we actually push button. We'd like the signal to have a sharp transition from LOW to HIGH, so it would look like this:
However, since the button is made of physical materials like metal, there will be some elastic vibrations, which result something like the following signal:
That switch bounce can wreak havoc on our edge triggered digital circuits, which can and will interpret each of the tiny peaks in the switch bounce as a new signal pulse. We could get rid of the bounce by using a low-pass filter. However, this would slow down our response time, since we'd now have to allow for the RC curve. Instead, we'll feed the output of our physical switch into a D-flop, and clock the flop with regular pulses from a 555 timer.
The timing diagram of the switch debouncer will look something like this:
The clock pulse should be fast enough to catch the shortest possible switch pressing, but slow enough not to be confused by the switch bounce, which typically lasts for about 1ms. So, if we feed the flop with square waves that have a period of 1.5ms, we'll satisfy both constraints. |
|
  Back           Next |