Input Devices.

advertisement
Computer Fundamentals
1st stage
Lec. (9)
College of Computer Technology
Input Devices.
Disk units, tape units, and drum units are all input and output (I/O) devices, and they
share a common use for mass storage. In this section, we look at a few devices that are used
exclusively for input of data. We start with one of the most prevalent devices – the keyboard.
1- Keyboard:
By far the most common input device is the keyboard. It is standard equipment on
virtually every personal computer. the essential elements of a keyboard are a switch matrix
and a keyboard interface encoder chip. The keyboard encoder is a microprocessor with an
in-built ROM. The switch matrix consists of a number of horizontal and vertical lines
crossing each other. At each crossing, a small switch operated by a spring –loaded key is
located. When a key is pressed, the switch closes and relevant horizontal and vertical lines are
shorted. This is then detected by the keyboard encoder, which generates a special 8-bit code
known as the scan code. Each key is allocated its own unique scan code. The scan code is
entered into internal buffer for transmission to the computer via especial serial cable on the
computer side, a keyboard controller. Also known as the keyboard bios chip receives the
serial data stream and converts it into an appropriate ASCII code. The keyboard controller is
another dedicated processor with an in-built few kilobytes of ROM and hundred bytes Of
RAM. The characters you type are stored until the CPU is ready to accept them.
2-Mouse:
since the keyboard is likely to remain the dominate device for entering text. But many
operations on personal computers involve pointing selecting or removing items already on the
screen, often you can perform these tasks more quickly with pointing devices, such as the
touch screen and the mouse.
42
The function of a mouse is to convert a small movement of the mouse into digital
signals, which may be interpreted into corresponding movement at pointer on the screen.
There are two types of mouse: 1-the mechanical, and 2- the optical. The mouse is
connected to one of the available serial ports, normally com1.
3-Touch screen:
Most people would say that their finger is the most nature pointing device. The touch
screen uses infrared sensors to tell where a finger or pencil touches the surface of the screen.
A touch screen comes in two forms, photonic and electrical. An illustration of the
photonic version is shown in Figure 13.
Figure 13 A user selecting an object on a touchscreen.
A matrix of beams covers the screen in the horizontal and vertical dimensions. If the
beams are interrupted (by a finger for example) then the position is determined by the
interrupted beams. In an alternative version of the touch screen, the display is covered with a
touch sensitive surface. The user must make contact with the screen in order to register a
selection.
Output devices
The Monitors: The video display unit (VDU) or monitor is one of two principle interfaces
between the user and computer, the other being the keyboard.
43
Two types of monitors are in common use in pc: The raster or CRT (cathode Ray Tube) and
the LCD (liquid crystal Display).
The inside of the screen consist of a large number of very small dots known as pixels (an
abbreviation of picture element) is the smallest display element on the screen. To keep a
constant image on the screen, the electron beam must have travel each scan line many times
per second (50-70) times per second.
The resolution of a monitor is the total number of pixels available on the screen given as :
Horizontal pixels * Vertical pixels.
For example' a monitor with 640 pixels per line (horizontal) and 480 lines (vertical) has a
resolution of 640*480. The size of the monitor, which is usually given in inches, refers to the
diagonal measurement of the screen. Thus .
A l4-inch monitor has a width of 1 1.2 inches and height of 8.4 inches , where:
(Size)^2 = (1 1 .22) ^2+ (8.4) ^2=125.44+70.56=196
Size= 196 =14
Adapter card: Is the heart of the display system slots into a pc expansion slot. The video
adaptor translates text and graphic instruction into video signals which are fed to the monitor
for display
Printers:
There are three types of printers:
l- Letter quality printers: Create each character by striking an embossed image of a full
formed character against an inked ribbon and paper. The most common type of letter quality
printers is a daisy-wheel printer.
A daisy wheel is a circle of plastic or metal with a set of 16 or more spokes connected from
the center- On the tip of each spoke is an embossed image of a character. The wheel rotates
continuously. As the required spoke moves in front of the printer hammer, the spoke is struck
into the ribbon and paper. They generate high quality output, but they are slow compared
with other printers. Print rates are between 15 and, 70 characters per second (cps)- And like
other impact printers, daisy-wheel printers are noisy.
44
2- Dot matrix printers: create each character by printing dots in a pattern. Matrix printers
have several important features:
a- Matrix printers are cheaper than letter-quality printers
b- Matrix printers are much faster (200 cps) than letter quality printers.
:r_
C- Most matrix printers are not limited to one size or style character, because the characters
are formed from patterns.
d- Most matrix printers can print graphical images as text. For example:
1- Thermal printers.
2- ink-jet printers.
3- LASER PRINTERS
A laser printer consists of a charged drum in which a laser discharges selected areas
according to a bit mapped representation of a page to be printed.
Programming Languages
There are two major types of programming languages. These are Low Level Languages
and High Level Languages. Low Level languages are further divided in to Machine language
and Assembly language.
Low Level Languages
The term low level means closeness to the way in which the machine has been built.
Low level languages are machine oriented and require extensive knowledge of computer
hardware and its configuration.
(a) Machine Language
Machine Language is the only language that is directly understood by the computer. It
does not needs any translator program. We also call it machine code and it is written as
strings of 1's (one) and 0’s (zero). When this sequence of codes is fed to the computer, it
45
recognizes the codes and converts it in to electrical signals needed to run it. For example, a
program instruction may look like this:
1011000111101
It is not an easy language for you to learn because of its difficult to understand. It is efficient
for the computer but very inefficient for programmers. It is considered to the first generation
language. It is also difficult to debug the program written in this language.
Advantage
The only advantage is that program of machine language run very fast because no
translation program is required for the CPU.
Disadvantages
1.It is very difficult to program in machine language. The programmer
has to know details of hardware to write program.
2.The programmer has to remember a lot of codes to write a program
which results in program errors.
3.It is difficult to debug the program.
(b) Assembly Language
It is the first step to improve the programming structure. You should know that computer
can handle numbers and letter. Therefore some combination of letters can be used to
substitute for number of machine codes.
The set of symbols and letters forms the Assembly Language and a translator program is
required to translate the Assembly Language to machine language. This translator program is
called `Assembler'. It is considered to be a second-generation language.
Advantages:
1.The symbolic programming of Assembly Language is easier to
understand and saves a lot of time and effort of the programmer.
2.It is easier to correct errors and modify program instructions.
3.Assembly Language has the same efficiency of execution as the
machine level language. Because this is one-to-one translator between
46
assembly language program and its corresponding machine language
program.
Disadvantages:
One of the major disadvantages is that assembly language is machine dependent. A
program written for one computer might not run in other computers with different hardware
configuration.
HIGH LEVEL LANGUAGES
You know that assembly language and machine level language require deep knowledge
of computer hardware where as in higher language you have to know only the instructions in
English words and logic of the problem irrespective of the type of computer you are using.
Higher level languages are simple languages that use English and mathematical symbols like
+, -, %, / etc. for its program construction.
You should know that any higher level language has to be converted to machine language for
the computer to understand.
Higher level languages are problem-oriented languages because the instructions are
suitable for solving a particular problem. For example COBOL (Common Business Oriented
Language) is mostly suitable for business oriented language where there is very little
processing and huge output. There are mathematical oriented languages like FORTRAN
(Formula Translation) and BASIC (Beginners All-purpose Symbolic Instruction Code) where
very large processing is required.
Thus a problem oriented language designed in such a way that its instruction may be
written more like the language of the problem. For example, businessmen use business term
and scientists use scientific terms in their respective languages.
Advantages of High Level Languages
Higher level languages have a major advantage over machine and assembly languages
that higher level languages are easy to learn and use. It is because that they are similar to the
languages used by us in our day to day life.
Compiler
47
It is a program translator that translates the instruction of a higher level language to
machine language. It is called compiler because it compiles machine language instructions for
every program instructions of higher level language. Thus compiler is a program translator
like assembler but more sophisticated. It scans the entire program first and then translates it
into machine code.
The programs written by the programmer in higher level language is called source
program. After this program is converted to machine languages by the compiler it is called
object program.
Higher Level Language --> (Compile) ---> Program --> Machine Language Program
A compiler can translate only those source programs, which have been written, in that
language for which the compiler is meant for. For example FORTRAN compiler will not
compile source code written in COBOL language.
Object program generated by compiler is machine dependent. It means programs
compiled for one type of machine will not run in another type. Therefore every type of
machine must have its personal compiler for a particular language. Machine independence is
achieved by using one higher level language in different machines.
Interpreter
An interpreter is another type of program translator used for translating higher level
language into machine language. It takes one statement of higher level languages, translate it
into machine language and immediately execute it. Translation and execution are carried out
for each statement. It differs from compiler, which translate the entire source program into
machine code and does involve in its execution.
The advantage of interpreter compared to compiler is its fast response to changes in
source program. It eliminates the need for a separate compilation after changes to each
program. Interpreters are easy to write and do not require large memory in computer.
The disadvantage of interpreter is that it is time consuming method because each time a
statement in a program is executed then it is first translated. Thus compiled machine
language program runs much faster than an interpreted program.
48
Download