DIP Switches and Buttons
A DIP switch is a set of electric switches that are packaged together dual in-line package (DIP).
All mechanical components (DIP-switches, pushbuttons etc) suffer from debouncing problem. Whenewer the position of a switch is changed or a button is pushed, it takes approximately 20ms for the switch/button output to settle into its new value.
Let us try to clarify this problem by means of an example: Assume that the output of the unpressed button is 0. Now somebody presses the button and its output eventually settle at 1. But immediately after it is being pressed, its output will oscillate between 0 and 1 before being settled into 1. This is called “bouncing”. In practical terms, we can say that after being pressed, the output of the button will be unavailable for 20 ms.
Now assume that the person who pressed the button released it. The button output will eventually settle to 0. But immediately after it is being released, its output will oscillate between 0 and 1 before being settled into 0. In practical terms, we can say that after being pressed, the output of the button will be unavailable for 20 ms.
It is possible to buy “debounced switches and buttons” in the market. These components have additional hardware ingredients inside them which filter out the 20ms oscillations and give a clean 0-1 or 1-0 transition to the user. The four buttons on your De0-nano kits are all debounced. Naturally, such components are more expensive..
In sequential designs working under a clock, bouncing buttons werak havoc. Such buttons must be “debounced” before use. We will se how this is done in a future chapter.