15
Computer Peripherals
This chapter discusses about several peripheral devices used by any computer to interact
with the external world. After completion of this chapter, the reader would know about the
underlaying principles of
R Keyboard
R Mouse
R Printers and displays
C HAPTER OBJECTIVES
15.1 INTRODUCTION
In Chapter 8, we have discussed about the input/output organization of computers in general, without
making it device-speci c. However, some widely used peripheral devices need a little more attention
to understand their functioning mechanisms as well as their speci c interfacing issues. In this chapter,
we shall discuss about four such essential peripheral devices, namely keyboard, mouse, printer and
display.
15.2 KEYBOARD
As the most widely used input device for any computer, keyboards are well known to all of us and needs
no introduction apart from the fact that its present layout, known as QWERTY (sequence of alpha keys
from left to right at the top-left position of the keyboard) was in practice even before the appearance
of earliest digital computers. Depending upon the brand of the computer, there are minor variations in
number and type of keys and their layout, in commercially available keyboards.
M15_GHOS1557_01_SE_C15.indd 430M15_GHOS1557_01_SE_C15.indd 430 4/29/11 5:36 PM4/29/11 5:36 PM
Computer Peripherals 431
15.2.1 Keyboard Basics
If we consider only one key as an input device, its working mechanism would be considered as a simple
one. To make it functional, attach it with one input port pin of any I/O port (like 8255, we have discussed
in chapter 8) and connect the port pin with an external pull-up resistor, as shown in Figure 15.1 (a). Now
you need a simple software for reading or sensing this key. Assuming it is done by polling, the processor
has to continuously read the input pin of the port. If the key is not pressed, the input would be logic high.
Whenever the key is pressed, it would generate a logic low input [Figure 15.1 (b)].
Now the reader has to do some eldwork. If an oscilloscope is used to trace the input signal during
pressing and releasing of the key, the signal would appear as in Figure 15.1 (c) and not as Figure 15.1 (b).
The reason behind these oscillations, known as bouncing, is the mechanical property of the key.
Figure 15.1 Schematic of interfacing one key with a processor (a) Hardware details
(b) Ideal input signal and (c) Observed input signal
This bouncing is a phenomenon, which does not last for more than 40 milliseconds in any case. To
sense any key closure or key release correctly, this bouncing phase must be avoided. It is a standard prac-
tice, known as debouncing, to continue sensing any closed or released key for more than 40 milliseconds
and then accept its input signal logic as a valid one.
15.2.2 Multiple Key Scanning and Two-dimensional Matrix
The technique of interfacing any key as described above would be acceptable for a lesser number of keys.
For a larger number of keys this arrangement, one input port pin for each key, would not be economical. In
that case, to optimize the requirement of I/O pins of the I/O device, keys are arranged in the form of a two-
dimensional matrix with several rows and columns. Generally, these rows are interfaced with an input port,
the columns are interfaced with an output port ( Figure 15.2 ) or vice versa. Note that each key is placed at
the intersection of a row-line and a column-line. There is no interconnection between any row and column
line unless the corresponding key is pressed.
To sense all keys, repeated key scanning must be performed through software by activating only one col-
umn at a time, by outputting logic low through it. All remaining inactive columns are subjected to logic high
output. All row inputs are checked one by one after activating one column, about any eventual key closure.
If any key is sensed in this phase, its code is stored and the same process is continued for the remaining rows.
The process is repeated for all columns, making the next column as an active one, which ensures all keys are
sensed once. To ensure proper debouncing, any change of key status is observed for more than 40 millisec-
onds to ensure a steady state. The result is a fully-debounced key code for a unique key, pressed or released
by the user. If more than one key is pressed, this technique would yield the last sensed key code. The key
scanning software may be suitably modi ed to sense more than one key in pressed or released conditions,
which are generally encountered during the usage of SHIFT or CONTROL keys.
M15_GHOS1557_01_SE_C15.indd 431M15_GHOS1557_01_SE_C15.indd 431 4/29/11 5:37 PM4/29/11 5:37 PM
432 Computer Architecture and Organization
15.2.3 Keyboard as an Embedded System
Apart from key sensing, the keyboard is also expected to store multiple key codes, generate inter-
rupt to draw the attention of the host when any key is detected, communicate key code to the host
(mostly in serial format, USB for latest keyboards) and control eventual light-indicators present in
the keyboard (to indicate number-lock, scroll-lock and caps-lock). From the days of introduction
of IBM PCs, a microcontroller inside the keyboard takes care of all these duties. Therefore, the key-
board may be designated as another example of embedded system, which we have already discussed
in Chapter 14. Within any IBM PC keyboard, we can locate one 8748 (or 8749 or some other version
of it), which perform all these duties including a self-test during power-on. Note that for IBM PCs two
separate key codes are generated for every key, one for its closure and another for its release. Schemati-
cally, major interfacing parts of a keyboard as an embedded system is presented in Figure 15.3 .
To conclude our discussions on keyboard, it may be pointed out that neither its layout nor its basic
functioning mechanism have undergone any signi cant change in the last 60 years or so. However,
Figure 15.2 2-D layout of a keyboard
Figure 15.3 Schematic of a keyboard as an embedded system
(for key sensing)
Two-dimensional array of keys
M15_GHOS1557_01_SE_C15.indd 432M15_GHOS1557_01_SE_C15.indd 432 4/29/11 5:37 PM4/29/11 5:37 PM
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.198.81