24-12-2012, 06:55 PM
Interfacing a Microprocessor To Keyboard
Interfacing a Microprocesso.pdf (Size: 95.57 KB / Downloads: 229)
When you press a key on your computer, you are
activating a switch. There are many different ways of
making these switches. An overview of the construction
and operation of some of the most common types.
1. Mechanical key switches: In mechanical-switch keys,
two pieces of metal are pushed together when you press
the key. The actual switch elements are often made of a
phosphor-bronze alloy with gold platting on the contact
areas. The key switch usually contains a spring to return
the key to the nonpressed position and perhaps a small
piece of foam to help damp out bouncing.
Keyboard Circuit Connections and Interfacing
In most keyboards, the keyswitches are connecting in a
matrix of rows and columns, as shown in fig.
• We will use simple mechanical switches for our
examples, but the principle is same for other type of
switches.
• Getting meaningful data from a keyboard, it requires the
following three major tasks:
1. Detect a keypress.
2. Debounce the keypress.
3. Encode the keypress
Keyboard Circuit Connections and Interfacing
Once the columns are found to be all high, the program
enters another loop, which waits until a low appears on one
of the columns, indicating that a key has been pressed.
This second loop does the detect task for us. A simple 20-
ms delay procedure then does the debounce task.
• After the debounce time, another check is made to see if
the key is still pressed. If the columns are now all high,
then no key is pressed and the initial detection was caused
by a noise pulse or a light brushing past a key. If any of the
columns are still low, then the assumption is made that it
was a valid keypress.