This chapter discusses input devices--the devices used to
communicate with the computer. The most common input device
is, of course, the keyboard, and this chapter discusses
keyboards in depth. It also discusses mice and other pointing
device alternatives because they are now a standard
requirement for operating a modern PC with a GUI (graphical
user interface) such as Windows or OS/2. Finally, this chapter
also discusses the game or joystick interface, which is used
to input signals from a joystick, paddles, or other game
devices.
Keyboards
One of the most basic system components is your keyboard.
The keyboard is the primary input device. It is used
for entering commands and data into the system. This section
looks at the keyboards available for PC-compatible systems. It
examines the different types of keyboards, how the keyboard
functions, the keyboard-to-system interface, and keyboard
troubleshooting and repair.
Types of Keyboards
Over the years since the introduction of the original IBM
PC, IBM has created three different keyboard designs for PC
systems, and Microsoft has augmented one of them. They have
become standards in the industry and are shared by virtually
all of the PC-compatible manufacturers. More recently with the
introduction of Windows 95, a modified version of the 101-key
design (created by Microsoft) has appeared. The primary
keyboard types are:
- 83-key PC and XT keyboard
- 84-key AT keyboard
- 101-key enhanced keyboard
- 104-key enhanced Windows keyboard
This section discusses each keyboard type, and shows their
layout and physical appearance. Because most systems use
keyboards based on the 101- and 104-key enhanced keyboard
designs, these versions are emphasized.
83-Key PC and XT Keyboard
When the original PC was first introduced, it had something
that few other personal computers had at the time: an external
detachable keyboard. Most other small personal computers of
the time had the keyboard built in, like the Apple II.
Although the external design was a good move on IBM's part,
the keyboard design was not without its drawbacks. One of the
most criticized components of the original 83-key keyboard is
the awkward layout (see Figure 9.1). The Shift keys are small
and in the wrong place on the left side. The Enter key is also
too small. These oversights were especially irritating at the
time because IBM had produced the Selectric typewriter,
perceived as a standard for good keyboard layout.
FIG.
9.1 PC and XT 83-key keyboard
layout.
This keyboard has a built-in processor that communicates
with the motherboard via a special serial data link. The
communication is one-way, which means that the mother-board
cannot send commands or data back to the keyboard. For this
reason, IBM 83-key keyboards have no Light Emmiting Diode
(LED) indicator lights. Because the status of the Caps Lock,
Num Lock, and Scroll Lock are maintained by the motherboard,
there is no way to make sure that any LED indicator lights
remain in sync with the actual status of the function.
Many aftermarket (non-IBM) PC keyboards added the lights,
and the keyboard attempted to keep track of the three
functions independently of the motherboard. This worked in
most situations, but it was entirely possible to see the LEDs
become out of sync with the actual function status. Rebooting
corrected this temporary problem, but it was annoying
nonetheless.
The original 83-key PC/XT keyboard is no longer used and is
not electrically compatible with AT-compatible motherboards,
although some aftermarket units may be compatible by moving an
XT/AT switch usually found on the bottom of the keyboard.
84-Key AT Keyboard
When the AT was introduced in 1984, it included a new
keyboard--the 84-key unit (see Figure 9.2). This keyboard
corrected many problems of the original PC and XT keyboards.
The position and arrangement of the numeric keypad was
modified. The Enter key was made much larger, like that of a
Selectric typewriter. The Shift key positions and sizes were
corrected. IBM also finally added LED indicators for the
status of the Caps Lock, Scroll Lock, and Num Lock
toggles.
FIG.
9.2 AT 84-key keyboard layout.
These keyboards use a slightly modified interface protocol
that is bi-directional. This means that the processor built
into the keyboard can talk to another processor (called the
8042 keyboard controller chip) built into the
motherboard. The keyboard controller on the motherboard can
send commands and data to the keyboard, which allows functions
such as changing the keyboard typematic (or repeat) rate as
well as the delay before repeating begins. The keyboard
controller on the motherboard also performs scan code
translation, which allow a much easier integration of
foreign language keyboards into the system. Scan codes
are the names for the hexadecimal codes actually sent by the
keyboard to the motherboard. The bi-directional interface can
be used to control the LED indicators on the keyboard, thus
ensuring that the status of a particular function and the
corresponding indicator are always in sync.
The 84-key unit that came with the original AT system is no
longer used, although its electrical design is compatible with
newer systems. It lacks some of the keys found in the newer
keyboards and does not have as nice a numeric keypad section,
but many users prefer the more Selectric-style layout of the
alphanumeric keys. Likewise, some users prefer to have the 10
function keys arranged on the left-hand side as opposed to the
enhanced arrangement in which 12 function keys are lined up
along the top.
Enhanced 101-Key (or 102-Key) Keyboard
In 1986, IBM introduced the "corporate" enhanced 101-key
keyboard for the newer XT and AT models (see Figure 9.3). I
use the word "corporate" because this unit first appeared in
IBM's RT PC, which is a RISC (Reduced Instruction Set
Computer) system designed for scientific and engineering
applications; keyboards with this design are now supplied with
virtually every type of system and terminal that IBM sells.
Other companies quickly copied this design, and it has been
the standard in PC-compatible systems ever since.
This universal keyboard has a further improved layout over
that of the 84-key unit, with perhaps the exception of the
Enter key, which reverted to a smaller size. The 101-key
enhanced keyboard was designed to conform to international
regulations and specifications for keyboards. In fact, other
companies such as Digital Equipment Corporation (DEC) and
Texas Instruments (TI) had already been using designs similar
to the IBM 101-key unit. The IBM 101-key units originally came
in versions with and without the status indicator LEDs,
depending on whether the unit was sold with an XT or AT
system. Now there are many other variations to choose from,
including some with integrated pointing devices.
FIG.
9.3 101-key enhanced keyboard
layout.
The enhanced keyboard is available in several different
variations, but all are basically the same electrically and
can be interchanged. IBM and its Lexmark keyboard and printer
subsidiary have produced a number of versions, including
keyboards with built-in pointing devices and new ergonomic
layouts. Most of the enhanced keyboards attach to the system
via the standard 5-pin DIN (Deutsche Industrie Norm)
connector, but many others come with cables for the 6-pin
mini-DIN connector found on many newer systems, including the
IBM PS/2s and most Slimline compatibles. Although the
connectors may be physically different, the keyboards are not,
and you can either interchange the cables or use a cable
adapter to plug one type into the other.
The 101-key keyboard layout can be divided into the
following four sections:
- Typing area
- Numeric keypad
- Cursor and screen controls
- Function keys
The 101-key arrangement is similar to the Selectric
keyboard layout with the exception of the Enter key. The Tab,
Caps Lock, Shift, and Backspace keys have a larger striking
area and are located in the familiar Selectric locations. Ctrl
and Alt keys are on each side of the space bar. The typing
area and numeric keypad have home-row identifiers for touch
typing.
The cursor and screen-control keys have been separated from
the numeric keypad, which is reserved for numeric input. (As
with other PC keyboards, you can use the numeric keypad for
cursor and screen control when the keyboard is not in Num Lock
mode.) A division-sign key and an additional Enter key have
been added to the numeric keypad.
The cursor-control keys are arranged in the inverted T
format. The Insert, Delete, Home, End, Page Up, and Page Down
keys, located above the dedicated cursor-control keys, are
separate from the numeric keypad. The function keys, spaced in
groups of four, are located across the top of the keyboard.
The keyboard has two additional function keys: F11 and F12.
The Esc key is isolated in the upper-left corner of the
keyboard. Dedicated Print Screen/Sys Req, Scroll Lock, and
Pause/Break keys are provided for commonly used functions.
Foreign language versions of the enhanced keyboard include
102-keys and a slightly different layout from the 101-key U.S.
versions.
One of the many useful features of the enhanced keyboard is
removable keycaps. With clear keycaps and paper inserts, you
can customize the keyboard. Keyboard templates are also
available to provide specific operator instructions.
The enhanced keyboard will probably come with any
PC-compatible desktop system for quite some time. It is
currently the most popular design and does not show any signs
of being replaced in the future. Because most compatible
systems use this same type of keyboard, it is relatively easy
to move from one system to another without relearning the
layout.
104-Key Windows Keyboard
If you are a touch typist like I am, then you really hate
to take your hands off of the keyboard to use a mouse. Windows
95 makes this even more of a problem, because it exploits both
mouse buttons. Many new keyboards, especially those in
portable computers, include a variation of the IBM Trackpoint
or the Alps Glidepoint (both of which are discussed later in
this chapter), which allow touch typists to keep their hands
on the keyboard even while moving the pointer, but there is
still another alternative that can help. Microsoft has come up
with a specification that calls for three new Windows-specific
keys to be added to the keyboard. These new keys help with
functions that would otherwise require multiple keystrokes or
mouse clicks.
Microsoft has released a Windows keyboard specification
that outlines a set of new keys and key combinations. The
familiar 101-key layout grows to 104 keys, with the addition
of left and right Windows keys and an Application key. These
keys will be used for operating-system and application-level
keyboard combinations, similar to today's Ctrl and Alt
combinations. You don't need the new keys to use Windows 95 or
NT, but software vendors are starting to add specific
functions to their Windows products that will use the new
Application key (which is the same as the right mouse button).
Figure 9.4 shows the standard Windows keyboard layout
including the three new keys.
FIG.
9.4 104-key Windows keyboard
layout.
The recommended Windows keyboard layout calls for the Left
and Right Windows keys (called WIN keys) to flank the
Alt keys on each side of the space bar, and an Application key
on the right of the Right Windows key. Note that the exact
placement of these keys is up to the keyboard designer, so you
will see variations from keyboard to keyboard.
The WIN keys open the Start menu, which then can be
navigated with the arrow keys. The Application key simulates
the right mouse button; in most applications, it brings up
context-sensitive pop-up menus. Several WIN key combinations
offer preset macro commands as well. For example, you press
WIN+E to bring up the Windows Explorer. The following table
shows a list of all the new Windows 95 key combinations:
Key Combination |
Action |
WIN+R |
Displays the Run dialog box. |
WIN+M |
Minimizes All. |
Shift+WIN+M |
Undoes Minimize All. |
WIN+F1 |
Starts Help. |
WIN+E |
Starts Windows Explorer. |
WIN+F |
Finds files or folders. |
Ctrl+WIN+F |
Finds the computer. |
WIN+Tab |
Cycles through taskbar buttons. |
WIN+Break |
Displays the System properties dialog
box. |
The Windows keyboard specification requires that keyboard
makers increase the number of trilograms in their keyboard
designs. A trilogram is a combination of three rapidly
pressed keys that perform a special function, such as
Ctrl+Alt+Delete. Designing a keyboard so that the switch
matrix will correctly register trilograms is expensive, and
this plus the additional Windows keys themselves will cause
the price of these keyboards to rise. Volume sales should keep
the price reasonable, as well as the natural market
competition.
Virtually every keyboard manufacturer is now producing
keyboards with these Windows-specific keys. Some are also
combining these new keys with other features. For example,
besides the new Windows keys, the Microsoft Natural
Keyboard includes ergonomic features, such as split
keypads that are rotated out from the middle to encourage a
straight wrist position. It takes some getting used to.
Unfortunately, this keyboard (made by Keytronics for
Microsoft) does not have nearly the feel of the mechanical
switch designs like Alps, Lite-On, or NMB, or the extremely
high-quality feel of the Lexmark keyboards.
In addition to the Windows keys, other companies like
Lexmark, NMB, and Alps have licensed a new space bar design
called Erase-Ease from Keyboard Enhancements, Inc. This
new design splits the space bar into two parts, using the
shorter left (or optionally the right) half as an additional
Backspace key. If you see a keyboard advertising 105-keys,
then it probably has both the three additional Windows keys
plus the extra Backspace key next to the space bar.
Although the new Windows keys are not mandatory when
running Windows, and certainly not everybody will have them, I
do expect more and more new PC systems to include keyboards
with these extra keys. They can make it easier for both
experienced touch typists as well as novice users to access
some of the functions of Windows and their applications.
Compatibility
The 83-key PC/XT type is different from all the others and
normally plugs into only 8-bit PC/XT systems that do not use
the motherboard-based 8042-type keyboard controller chip. This
is definitely true for IBM's keyboards and also is true for
many compatible units. Some compatibles may be switchable to
work with an AT-type motherboard via an XT/AT switch.
The 84-key unit from IBM works on only AT-type 16-bit (or
greater) motherboards and does not work at all with PC/XT
systems. Again, some aftermarket designs may have an XT/AT
switch to allow for compatibility with PC/XT-type systems. If
you have the keyboard set in the wrong mode, it will not work,
but no damage will occur.
The enhanced keyboards from IBM are universal and
auto-switching, which means that they work in virtually
any system from the XT to the PS/2 or any PC-compatible by
simply plugging them in. Some may require that a switch be
moved on the keyboard to make it compatible with PC/XT systems
that do not have the 8042-type keyboard controller on the
motherboard. In some cases, you may also need to switch to a
different cable with the proper system end connector, or use
an adapter.
Although the enhanced keyboard is electrically compatible
with any AT-type mother-board and even most PC/XT-type
motherboards, many older systems will have software problems
using these keyboards. IBM changed the ROM on the systems to
support the new keyboard properly, and the compatible vendors
followed suit. Very old (1986 or earlier) machines may require
a ROM upgrade to use properly some of the features on the
101-key enhanced keyboards, such as the F11 and F12 keys. If
the individual system ROM BIOS is not capable of operating the
101-key keyboard correctly, the 101-key keyboard may not work
at all (as with all three ROM versions of the IBM PC); the
additional keys (F11 and F12 function keys) may not work; or
you may have problems with keyboard operation in general. In
some cases, these compatibility problems cause improper
characters to appear when keys are typed (causing the system
to beep), and general keyboard operation is a problem. These
problems can often be solved by a ROM upgrade to a newer
version with proper support for the enhanced keyboard.
If you have an older IBM system, you can tell whether your
system has complete ROM BIOS support for the 101-key unit:
When you plug in the keyboard and turn on the system unit, the
Num Lock light automatically comes on and the numeric keypad
portion of the keyboard is enabled. This method of detection
is not 100 percent accurate, but if the light goes on, your
BIOS generally supports the keyboard. A notable exception is
the IBM AT BIOS dated 06/10/85; it turns on the Num Lock
light, but still does not properly support the enhanced
keyboard. All IBM BIOS versions dated since 11/15/85 have
proper support for the enhanced keyboards.
In IBM systems that support the enhanced keyboard, if it is
detected on power up, Num Lock is enabled and the light goes
on. If one of the older 84-key AT-type keyboards is detected,
the Num Lock function is not enabled because these keyboards
do not have arrow keys separate from the numeric keypad. When
the enhanced keyboards first appeared in 1986, many users
(including me) were irritated on finding that the numeric
keypad was automatically enabled every time the system boots.
Most compatibles began integrating a function into the system
setup that allowed specification of the Num Lock status on
boot.
Some thought that the automatic enabling of Num Lock was a
function of the enhanced keyboard because none of the earlier
keyboards seemed to operate this way. Remember that this
function is not really a keyboard function; it is a function
of the motherboard ROM BIOS, which identifies an enhanced
101-key unit and turns on the Num Lock as a "favor." In
systems that cannot disable the automatic numeric keypad
enable feature, you can use the DOS 6.0 or higher version
NUMLOCK= parameter in CONFIG.SYS to turn Num Lock on
or off as desired. If you are running a version of DOS earlier
than 6.0, you can use one of the many public domain programs
available for turning off the Num Lock function. Inserting the
program to disable Num Lock in the AUTOEXEC.BAT file turns off
the numeric keypad whenever the system reboots.
In an informal test, I plugged the new keyboard into an
earlier XT. The keyboard seemed to work well. None of the keys
that did not exist previously, such as F11 and F12, were
operable, but the new arrow keys and the numeric keypad
worked. The enhanced keyboard seems to work on XT or AT
systems, but it does not function on the original PC systems
because of BIOS and electrical interface problems. Many
compatible versions of the 101-key enhanced keyboards have a
manual XT/AT switch on the bottom that may allow the keyboard
to work in an original PC system.
Keyboard Technology
The technology that makes up a typical PC keyboard is very
interesting. This section focuses on all aspects of keyboard
technology and design, including the key switches, the
interface between the keyboard and the system, scan codes, and
the keyboard connectors.
Key Switch Design
Several types of switches are used in keyboards today. Most
keyboards use one of several variations on a mechanical key
switch. A mechanical key switch relies on a mechanical
momentary contact type switch to make electrical contact in a
circuit. Some high-end keyboard designs use a totally
different nonmechanical design that relies on capacitive
switches. This section discusses these switches and the
highlights of each design. The most common type of key switch
is the mechanical type, available in the following variations:
- Pure mechanical
- Foam element
- Rubber dome
- Membrane
The pure mechanical type is just that--a simple
mechanical switch that features metal contacts in a momentary
contact arrangement. Often a tactile feedback
mechanism-- consisting of a clip and spring arrangement to
give a "clicky" feel to the keyboard and offer some resistance
to pressing the key--is built in. Several companies, including
Alps Electric, Lite-On, and NMB Technologies, manufacture this
type of keyboard using switches primarily from Alps Electric.
Mechanical switches are very durable, usually have
self-cleaning contacts, and normally are rated for 20 million
keystrokes, which is second only to the capacitive switch.
They also offer excellent tactile feedback.
Foam element mechanical switches were a very popular
design in some older keyboards. Most of the older compatible
keyboards, including those made by Keytronics and many others,
use this technology. These switches are characterized by a
foam element with an electrical contact on the bottom that is
mounted on the bottom of a plunger attached to the key itself
(see Figure 9.5).
FIG.
9.5 Typical foam element mechanical key
switch.
When the switch is pressed, a foil conductor on the bottom
of the foam element closes a circuit on the printed circuit
board below. A return spring pushes the key back up when the
pressure is released. The foam dampens the contact, helping to
prevent bounce, but unfortunately gives these keyboards a
"mushy" feel. The big problem with this type of key switch
design is that there is often little in the way of tactile
feedback, and systems with these keyboards often resort to
tricks such as clicking the PC's speaker to signify that
contact has been made. Compaq has used keyboards of this type
(made by Key-tronics) in many of their systems, but perhaps
the most popular user today is Packard Bell. Preferences in
keyboard feel are somewhat subjective; I personally do not
favor the foam element switch design.
Another problem with this type of design is that it is
prone to corrosion on the foil conductor and the circuit board
traces below. When this happens, the key strikes may become
intermittent, which can be frustrating. Fortunately, these
keyboards are among the easiest to clean. By disassembling
this type of keyboard completely, you can usually remove the
circuit board portion without removing each foam pad
separately, and expose the bottoms of all the pads. Then you
can easily wipe the corrosion and dirt off the bottom of the
foam pads and the circuit board, thus restoring the keyboard
to a "like-new" condition. Unfortunately, over time the
corrosion problem will occur again. I recommend using some
Stabilant 22a from D.W. Electrochemicals to improve the switch
contact action and to prevent future corrosion. Because of
problems like this, the foam element design is not used much
anymore and has been superseded in popularity by the rubber
dome design.
Rubber dome switches are mechanical switches that
are similar to the foam element-type but are improved in many
ways. Instead of a spring, these switches use a rubber dome
that has a carbon button contact on the underside. As you
press a key, the key plunger presses on the rubber dome,
causing it to resist and then collapse all at once, much like
the top of an oil can. As the rubber dome collapses, the user
feels the tactile feedback, and the carbon button makes
contact between the circuit board traces below. When the key
is released, the rubber dome re-forms and pushes the key back
up.
The rubber eliminates the need for a spring and provides a
reasonable amount of tactile feedback without any special
clips or other parts. A carbon button is used because it is
resistant to corrosion and also has a self-cleaning action on
the metal contacts below. The rubber domes are formed into a
sheet that completely protects the contacts below from dirt,
dust, and even minor spills. This type of design is the
simplest, using the fewest parts. These things make this type
of keyswitch very reliable and help make rubber dome-type
keyboards the most popular in service today.
If rubber dome keyboards have a drawback at all, it is that
the tactile feedback is not as good as many users would like.
Although it is reasonable for most, some users prefer more
tactile feedback than rubber dome keyboards normally
provide.
The membrane keyboard is a variation on the rubber
dome type in which the keys themselves are no longer separate,
but are formed together in a sheet that sits on the rubber
dome sheet. This severely limits key travel, and membrane
keyboards are not considered usable for normal touch typing
because of this. They are ideal in extremely harsh
environments. Because the sheets can be bonded together and
sealed from the elements, membrane keyboards can be used in
situations in which no other type could survive. Many
industrial applications use membrane keyboards especially for
terminals that do not require extensive data entry but are
used to operate equipment such as cash registers.
Capacitive switches are the only nonmechanical type
of switch in use today (see Figure 9.6). These are the
Cadillac of key switches. They are much more expensive than
the more common mechanical rubber dome, but they also are more
resistant to dirt and corrosion and offer the highest-quality
tactile feedback of any type of switch.
A capacitive switch does not work by making contact between
conductors. Instead, two plates usually made of plastic are
connected in a switch matrix designed to detect changes in the
capacitance of the circuit.
When the key is pressed, the plunger moves the top plate
relative to the fixed bottom plate. Usually a mechanism
provides for a distinct over-center tactile feedback with a
resounding "click." As the top plate moves, the capacitance
between the two plates changes and is detected by the
comparator circuitry in the keyboard.
FIG.
9.6 A capacitive key switch.
Because this type of switch does not rely on metal
contacts, it is nearly immune to corrosion and dirt. These
switches are very resistant to key bounce problems that result
in multiple characters appearing from a single strike. They
are also the most durable in the industry--rated for 25
million or more keystrokes, as opposed to 10 to 20 million for
other designs. The tactile feedback is unsurpassed because a
relatively loud click and strong over-center feel normally are
provided. The only drawback to this design is the cost.
Capacitive switch keyboards are among the most expensive
designs, but the quality of the feel and their durability are
worth it.
Traditionally, the only vendors of capacitive key switch
keyboards have been IBM and its keyboard division, Lexmark,
which is why these keyboards have always seemed to stand out
as superior from the rest.
The Keyboard Interface
A keyboard consists of a set of switches mounted in a grid
or array called the key matrix. When a switch is
pressed, a processor in the keyboard itself identifies which
key is pressed by identifying which grid location in the
matrix shows continuity. The keyboard processor also
interprets how long the key is pressed and can even handle
multiple keypresses at the same time. A 16-byte hardware
buffer in the keyboard can handle rapid or multiple
keypresses, passing each one in succession to the system.
When you press a key, in most cases the contact actually
bounces slightly, meaning that there are several rapid on-off
cycles just as the switch makes contact. This is called
bounce, and the processor in the keyboard is designed
to filter this, or debounce the keystroke. The keyboard
processor must distinguish bounce from a double keystrike
actually intended by the keyboard operator. This is fairly
easy because the bouncing is much more rapid than a person
could simulate by striking a key quickly several times.
The keyboard in an PC-compatible system is actually a
computer itself. It communicates with the main system through
a special serial data link that transmits and receives data in
11-bit packets of information consisting of 8 data bits in
addition to framing and control bits. Although it is indeed a
serial link (the data flows on one wire), it is not compatible
with the standard RS-232 serial port commonly used to connect
modems.
The processor in the original PC keyboard was an Intel 8048
microcontroller chip. Newer keyboards often use an 8049
version that has built-in ROM or other microcontroller chips
compatible with the 8048 or 8049. For example, in its enhanced
keyboards, IBM has always used a custom version of the
Motorola 6805 processor, which is compatible with the Intel
chips. The keyboard's built-in processor reads the key matrix,
debounces the keypress signals, converts the keypress to the
appropriate scan code, and transmits the code to the
motherboard. The processors built into the keyboard contain
their own RAM, possibly some ROM, and a built-in serial
interface.
In the original PC/XT design, the keyboard serial interface
is connected to an 8255 Programmable Peripheral Interface
(PPI) chip on the motherboard of the PC/XT. This chip is
connected to the interrupt controller IRQ1 line, which is used
to signal that keyboard data is available. The data itself is
sent from the 8255 to the processor via I/O port address 60h.
The IRQ1 signal causes the main system processor to run a
subroutine (INT 9h) that interprets the keyboard scan
code data and decides what to do.
In an AT-type keyboard design, the keyboard serial
interface is connected to a special keyboard controller on the
motherboard. This is an Intel 8042 Universal Peripheral
Interface (UPI) slave microcontroller chip in the original AT
design. This microcontroller is essentially another processor
that has its own 2K of ROM and 128 bytes of RAM. An 8742
version that uses EPROM (Erasable Programmable Read Only
Memory) can be erased and reprogrammed. Often when you get
a motherboard ROM upgrade from a motherboard manufacturer, it
includes a new keyboard controller chip because it has
somewhat dependent and updated ROM code in it as well. Some
systems may use the 8041 or 8741 chips, which differ only in
the amount of ROM or RAM built in, whereas other systems now
have the keyboard controller built into the main system
chipset.
In an AT system, the (8048-type) microcontroller in the
keyboard sends data to the (8042-type) motherboard keyboard
controller on the motherboard. The motherboard-based
controller can also send data back to the keyboard. When the
keyboard controller on the motherboard receives data from the
keyboard, it signals the motherboard with an IRQ1 and sends
the data to the main motherboard processor via I/O port
address 60h, just as in the PC/XT. Acting as an agent between
the keyboard and the main system processor, the 8042-type
keyboard controller can translate scan codes and perform
several other functions as well. Data also can be sent to the
8042 keyboard controller via port 60h, which is then passed on
to the keyboard. Additionally, when the system needs to send
commands to or read the status of the keyboard controller on
the motherboard, it reads or writes through I/O port 64h.
These commands are also usually followed by data sent back and
forth via port 60h.
In most older systems the 8042 keyboard controller is also
used by the system to control the A20 memory address line,
which controls access to system memory greater than 1M. More
modern motherboards usually incorporate this functionality
directly in the motherboard chipset. This aspect of the
keyboard controller is discussed in Chapter 7, "Memory," in
the section that covers the High Memory Area (HMA).
Typematic Functions
If a key on the keyboard is held down, it becomes
typematic, which means that the keyboard repeatedly
sends the keypress code to the motherboard. In the AT-style
keyboards, the typematic rate is adjustable by sending the
keyboard processor the appropriate commands. This is not
possible for the earlier PC/XT keyboard types because the
keyboard interface is not bi-directional.
AT-style keyboards have a programmable typematic repeat
rate and delay parameter. The DOS MODE command in
versions 4.0 and later enables you to set the keyboard
typematic (repeat) rate as well as the delay before typematic
action begins. The default value for the RATE
parameter (r) is 20 for PC-compatible systems and 21
for IBM PS/2 systems. The default value for the DELAY
parameter is 2. Thus for most systems, the standard keyboard
typematic speed is 10cps (characters per second), and the
delay before typematic action occurs is 0.5 seconds.
To use the DOS MODE command to reset the keyboard
typematic rate and delay, use the following command: MODE CON[:] [RATE=r DELAY=d]
The acceptable values for the rate r and the
resultant typematic rate in cps are shown in Table 9.1.
Table 9. .1 DOS 4.0+ MODE Command Keyboard
Typematic Rate Parameters
Rate No. |
Rate ± 20% |
Rate No. |
Rate ± 20% |
32 |
30.0cps |
16 |
7.5cps |
31 |
26.7cps |
15 |
6.7cps |
30 |
24.0cps |
14 |
6.0cps |
29 |
21.8cps |
13 |
5.5cps |
28 |
20.0cps |
12 |
5.0cps |
27 |
18.5cps |
11 |
4.6cps |
26 |
17.1cps |
10 |
4.3cps |
25 |
16.0cps |
9 |
4.0cps |
24 |
15.0cps |
8 |
3.7cps |
23 |
13.3cps |
7 |
3.3cps |
22 |
12.0cps |
6 |
3.0cps |
21 |
10.9cps |
5 |
2.7cps |
20 |
10.0cps |
4 |
2.5cps |
19 |
9.2cps |
3 |
2.3cps |
18 |
8.6cps |
2 |
2.1cps |
17 |
8.0cps |
1 |
2.0cps |
Table 9.2 shows the values for DELAY and the
resultant delay time in seconds.
Table 9.2 DOS MODE Command Keyboard Typematic
Delay Parameters
DELAY No. |
Delay Time |
1 |
0.25sec |
2 |
0.50sec |
3 |
0.75sec |
4 |
1.00sec | For example, I
always place the following command in my AUTOEXEC.BAT
file:
MODE CON: RATE=32 DELAY=1
This command sets the typematic rate to the maximum speed
possible, or 30cps. It also trims the delay to the minimum of
0.25 seconds before repeating begins. This command
"turbocharges" the keyboard and makes operations requiring
repeated keystrokes work much faster, such as moving within a
file using arrow keys. The quick typematic action and short
delay can sometimes be disconcerting to ham-fisted keyboard
operators. In that case, slow typists might want to leave
their keyboard speed at the default until they become more
proficient.
NOTE: If you have an older system or keyboard, you
may receive the following message:
Function not supported on this computer
This indicates that your system, keyboard, or both do not
support the bi-directional interface or commands required to
change the typematic rate and delay. Upgrading the BIOS or
the keyboard may enable this function, but it is probably
not cost-effective to do this on an older system.
NOTE: Many BIOS versions feature keyboard speed
selection capability; however, not all of them allow full
control over the speed and delay.
Windows maintains its own independent settings for the
keyboard typematic rate and delay. This means that even if you
use the MODE command to set them in DOS, when Windows
is loaded it will override any previous settings. Fortunately,
the keyboard typematic rate and delay can easily be viewed or
changed from within Windows. To do this, first open the
Control Panel, then select the Keyboard icon where you will
see the repeat rate and delay settings. If you want to adjust
the typematic rate, drag the Repeat Rate slider to the desired
setting. If you want to adjust the time delay before repeating
occurs, drag the Repeat Delay slider to the desired setting.
You can test the repeat delay and repeat rate by clicking the
box below the sliders and then holding down a key.
Keyboard Key Numbers and Scan Codes
When you press a key on the keyboard, the processor built
into the keyboard (8048- or 6805-type) reads the keyswitch
location in the keyboard matrix. The processor then sends to
the motherboard a serial packet of data that contains the scan
code for the key that was pressed. In AT-type motherboards
that use an 8042-type keyboard controller, the 8042 chip
translates the actual keyboard scan code into one of up to
three different sets of system scan codes, which are sent to
the main processor. It can be useful in some cases to know
what these scan codes are, especially when troubleshooting
keyboard problems or when reading the keyboard or system scan
codes directly in software.
When a keyswitch on the keyboard sticks or otherwise fails,
the scan code of the failed keyswitch is usually reported by
diagnostics software, including the POST (Power On
Self-Test), as well as conventional disk-based
diagnostics. This means that you have to identify the
particular key by its scan code. Tables 9.3 through 9.7 list
all the scan codes for every key on the 83-, 84-, and 101-key
keyboards. By looking up the reported scan code on these
charts, you can determine which keyswitch is defective or
needs to be cleaned.
NOTE: 101-key enhanced keyboards are capable of three
different scan code sets. Set 1 is the default. Some
systems, including some of the PS/2 machines, use one of the
other scan code sets during the POST. For example, the IBM
P75 I have uses Scan Code Set 2 during the POST but switches
to Set 1 during normal operation. This is rare and really
threw me off in diagnosing a stuck key problem at one time,
but it is useful to know if you are having difficulty
interpreting the Scan Code number.
IBM also assigns each key a unique key number to
distinguish it from the others. This is important when you are
trying to identify keys on foreign keyboards, which may use
different symbols or characters from the U.S. models. In the
case of the enhanced keyboard, most foreign models are missing
one of the keys (key 29) found on the U.S. version and have
two other additional keys (keys 42 and 45) as well. This
accounts for the 102-key total rather than the 101-keys found
on the U.S. version.
Figure 9.7 shows the keyboard numbering and character
locations for the original 83-key PC keyboard. Table 9.3 shows
the scan codes for each key relative to the key number and
character.
FIG.
9.7 83-key PC keyboard key number and
character locations.
Table 9.3 83-Key (PC/XT) Keyboard Key Numbers
and Scan Codes
Key Number |
Scan Code |
Key |
1 |
01 |
Esc |
2 |
02 |
1 |
3 |
03 |
2 |
4 |
04 |
3 |
5 |
05 |
4 |
6 |
06 |
5 |
7 |
07 |
6 |
8 |
08 |
7 |
9 |
09 |
8 |
10 |
0A |
9 |
11 |
0B |
0 |
12 |
0C |
- |
13 |
0D |
= |
14 |
0E |
Backspace |
15 |
0F |
Tab |
16 |
10 |
q |
17 |
11 |
w |
18 |
12 |
e |
19 |
13 |
r |
20 |
14 |
t |
21 |
15 |
y |
22 |
16 |
u |
23 |
17 |
i |
24 |
18 |
o |
25 |
19 |
p |
26 |
1A |
[ |
27 |
1B |
] |
28 |
1C |
Enter |
29 |
1D |
Ctrl |
30 |
1E |
a |
31 |
1F |
s |
32 |
20 |
d |
33 |
21 |
f |
34 |
22 |
g |
35 |
23 |
h |
36 |
24 |
j |
37 |
25 |
k |
38 |
26 |
l |
39 |
27 |
; |
40 |
28 |
` |
41 |
29 |
` |
42 |
2A |
Left Shift |
43 |
2B |
\ |
44 |
2C |
z |
45 |
2D |
x |
46 |
2E |
c |
47 |
2F |
v |
48 |
30 |
b |
49 |
31 |
n |
50 |
32 |
m |
51 |
33 |
, |
52 |
34 |
. |
53 |
35 |
/ |
54 |
36 |
Right Shift |
55 |
37 |
* |
56 |
38 |
Alt |
57 |
39 |
Space bar |
58 |
3A |
Caps Lock |
59 | <TD |