0% found this document useful (0 votes)
21 views138 pages

Csc101 Lecture Note

The document provides an introduction to computers, defining them as electronic devices that process information through programs. It outlines the basic components of digital computers, their functions, and characteristics such as speed, accuracy, and versatility. Additionally, it discusses the various applications of computers across different fields including education, health, science, business, and government, highlighting their significant impact on society.

Uploaded by

genius.rio121
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views138 pages

Csc101 Lecture Note

The document provides an introduction to computers, defining them as electronic devices that process information through programs. It outlines the basic components of digital computers, their functions, and characteristics such as speed, accuracy, and versatility. Additionally, it discusses the various applications of computers across different fields including education, health, science, business, and government, highlighting their significant impact on society.

Uploaded by

genius.rio121
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 138

CHAPTER ONE

INTRODUCTION TO COMPUTER
What is Computer
Computer is an electronic device that is designed to work with Information. The term computer is
derived from the Latin term ‘computare’, this means to calculate or programmable machine.
Computer cannot do anything without a Program. It represents the decimal numbers through a
string of binary digits. The Word 'Computer' usually refers to the Centre Processor Unit plus
Internal memory. Charles Babbage is called the "Grand Father" of the computer. The First
mechanical computer designed by Charles Babbage was called Analytical Engine. It uses read-
only memory in the form of punch cards. Computer is an advanced electronic device that takes
raw data as input from the user and processes these data under the control of set of instructions
(called program) and gives the result (output) and saves output for the future use. It can process
both numerical and non-numerical (arithmetic and logical) calculations.

Digital Computer Definition


The basic components of a modern digital computer are: Input Device, Output Device, Central
Processor Unit (CPU), mass storage device and memory. A Typical modern computer uses Large
Scale Integration (LSI) Chips. Four functions of computer are to accept data (input), process data
(processing), produce output and store the results. Input is the raw information entered into a
computer from the input devices. It is the collection of letters, numbers, images and so on.
Process is the operation of data as per given instruction. It is totally internal process of the
computer system. Output, also known as the result, is the processed data given by computer after
data processing. Results can be saved in the storage devices for future use. Basic characteristics of
computer are:

1. Speed: - Computer can work very fast. It takes only few seconds for calculations that we take
hours to complete. You will be surprised to know that computer can perform millions (1,000,000)
of instructions and even more per second. Therefore, we determine the speed of computer in
terms of microsecond (10-6 part of a second) or nanosecond (10 to the power -9 part of a second).
From this you can imagine how fast your computer performs work.

2. Accuracy: - The degree of accuracy of computer is very high and every calculation is
performed with the same accuracy. The accuracy level is 7 determined on the basis of design of
computer. The errors in computer are due to human and inaccurate data.

1
3. Diligence: - A computer is free from tiredness, lack of concentration, fatigue, etc. It can work
for hours without creating any error. If millions of calculations are to be performed, a computer
will perform every calculation with the same accuracy. Due to this capability it overpowers
human being in routine type of work.

4. Versatility: - It means the capacity to perform completely different type of work. You may use
your computer to prepare payroll slips. Next moment you may use it for inventory management or
to prepare electric bills.

5. Power of Remembering: - Computer has the power of storing any amount of information or
data. Any information can be stored and recalled as long as you require it, for any numbers of
years. It depends entirely upon you how much data you want to store in a computer and when to
lose or retrieve these data.

6. No Intelligence Quotient (IQ): - Computer is a dumb machine and it cannot do any work
without instruction from the user. It performs the instructions at tremendous speed and with
accuracy. The user decides what to do and in what sequence. So, a computer cannot take decision
independent of the user.

7. No Feeling: - It does not have feelings or emotion, taste, knowledge and experience. Thus, it
does not get tired even after long hours of work. It does not distinguish between users.

8. Storage: - The Computer has an in-built memory where it can store a large amount of data.
You can also store data in secondary storage devices such as floppies, which can be kept outside
your computer and can be carried to other computers.

Computer and its Various Components


A computer can process data, pictures, sound and graphics. They can solve highly complicated
problems quickly and accurately. As shown in Figure 1, computer performs basically five major
computer operations or functions irrespective of their size and make. It accepts data or
instructions by way of input, stores data, process data as required by the user, gives results in the
form of output and controls all operations inside a computer.

Input: This is the process of entering data and programs in to the computer system. Computer
like any other electronic machine takes as inputs raw data, performs some processing and gives
out processed data. Therefore, the input unit of the computer takes data from us in an organized
manner for processing.
2
PROGRAM
& DATA
INPUT UNIT STORAGE UNIT OUTPUT UNIT
RESULTS

CONTROL UNIT

ARITHEMETIC AND
LOGIC UNIT

CENTRAL PROCESSING UNIT

Figure 1: Computer and its basic components

Storage: The process of saving data and instructions permanently is known as storage. Data has
to be fed into the system before the actual processing starts. It is because the processing speed of
Central Processing Unit (CPU) is so fast that the data has to be provided to CPU with the same
speed. Therefore, the data is first stored in the storage unit for faster access and processing. This
storage unit or the primary storage of the computer system is designed to do the above
functionality. It provides space for storing data and instructions. The function of the storage unit
is to store all data and instructions before and after processing. It also store intermediate results of
processing.

Processing: The task of performing operations like arithmetic and logical operations is called
processing. The Central Processing Unit (CPU) takes data and instructions from the storage unit
and makes all sorts of calculations based on the instructions given and the type of data provided.
It is then sent back to the storage unit.

Output: This is the process of producing results from the data for getting useful information.
Similarly, the output produced by the computer after processing must also be kept somewhere
inside the computer before being presented in human readable form. The output is also stored
inside the computer for further processing.

Control: This determines manner of how instructions are executed as well as how the operations
are performed. Controlling of all operations like input, processing and output are performed by
control unit. It takes care of step by step processing of all operations inside the computer.

COMPUTER FUNCTIONAL UNITS


3
The computer system is divided into three separate units for its operation. They are:
a. Arithmetic logical unit
b. Control unit.
c. Central processing unit.
Arithmetic Logical Unit (ALU)
After the entering of data through the input device, it is stored in the primary storage unit. The
actual processing of the data and instruction are performed by the ALU. The major operations
performed by the ALU are addition, subtraction, multiplication, division, logic and comparison.
Data is transferred to ALU from storage unit when required. After processing the output is
returned back to storage unit for further processing or storage.

Control Unit (CU)


The next component of computer is the Control Unit, which acts like the supervisor seeing that
things are done in proper fashion. Control Unit is responsible for co-ordinating various operations
using time signal. It determines the sequence in which computer programs and instructions are
executed. It oversees the processing of programs stored in the main memory, interpretation of the
instructions and issuing of signals for other units of the computer to execute them. It also acts as a
switch board operator when several users access the computer simultaneously, thereby
coordinating the activities of computer’s peripheral equipment as they perform the input and
output operations.

Central Processing Unit (CPU)


The ALU and the CU of a computer system are jointly known as the central processing unit. You
may call CPU as the brain of any computer system. It is just like brain that takes all major
decisions, makes all sorts of calculations and directs different parts of the computer functions by
activating and controlling the operations. Everything computer does is controlled by the CPU and
is sometimes referred to simply as the central processor or Nerve Centre or heart, but more
commonly called processor.

In terms of computing power, the CPU is the most important element of a computer system. It
adds and compares its data in CPU chip. A CPU or Processors of all computers, whether micro,
mini or mainframe must have three elements or parts, namely primary storage, arithmetic logic
unit (ALU) and control unit. Control Unit (CU) - decodes the program instruction. CPU chip
used in a computer is partially made out of Silica. On other words silicon chip used for data
processing are called Micro Processor.

4
Central processing unit (CPU) is the central component of the Pc. Sometimes it is called as
processor. It is the brain that runs the show inside the Pc. All work that is done on a computer is
performed directly or indirectly by the processor. Obviously, it is one of the most important
components of the Pc. It is also, scientifically, not only one of the most amazing parts of the PC,
but one of the most amazing devices in the world of technology. The processor plays a significant
role in the following important aspects of your computer system;

Performance: The processor is probably the most important single determinant of system
performance in the Pc. While other components also playa key role in determining performance,
the processor's capabilities dictate the maximum performance of a system. The other devices only
allow the processor to reach its full potential.

Software Support: Newer, faster processors enable the use of the latest software. In addition,
new processors such as the Pentium with MMX Technology, enable the use of specialized
software not usable on earlier machines.

Reliability and Stability: The quality of the processor is one factor that determines how reliably
your system will run. While most processors are very dependable, some are not. This also
depends to some extent on the age of the processor and how much energy it consumes.

Energy Consumption and Cooling: Originally processors consumed relatively little power
compared to other system devices. Newer processors can consume a great deal of power. Power
consumption has an impact on everything from cooling method selection to overall system
reliability.

Motherboard Support: The processor that decides to use in your system will be a major
determining factor in what sort of chipset we must use, and hence what motherboard you buy.
The motherboard in turn dictates many facets of. The system's capabilities and performance.

Uses of Computer
Computer is used in the following areas:
Education: Getting the right kind of information is a major challenge as is getting information to
make sense. College students spend an average of 5-6 hours a week on the internet. Research
shows that computers can significantly enhance performance in learning. Students exposed to the
internet say they think the web has helped them improve the quality of their academic research
and of their written work. One revolution in education is the advent of distance learning. This
offers a variety of internet and video-based online courses.
5
Health and Medicine: Computer technology is radically changing the tools of medicine. All
medical information can now be digitized. Software is now able to computer the risk of a disease.
Mental health researchers are using computers to screen troubled teenagers in need of
psychotherapy. A patient paralyzed by a stroke has received an implant that allows
communication between his brain and a computer; as a result, he can move a cursor across a
screen by brainpower and convey simple messages.

Science: Scientists have long been users of it. A new adventure among scientists is the idea of a
“collaboratory”, an internet based collaborative laboratory, in which researchers all over the
world can work easily together even at a distance. An example is space physics where space
physicists are allowed to band together to measure the earth’s ionosphere from instruments on
four parts of the world.

Business: Business clearly sees the interest as a way to enhance productivity and
competitiveness. Some areas of business that are undergoing rapid changes are sales and
marketing, retailing, banking, stock trading, etc. Sales representatives not only need to be better
educated and more knowledgeable about their customer’s businesses, but also must be
comfortable with computer technology. The internet has become a popular marketing tool. The
world of cybercash has come to banking – not only smart cards but internet banking, electronic
deposit, bill paying, online stock and bond trading, etc.

Recreation and Entertainment: Our entertainment and pleasure-time have also been affected by
computerization. For example:
• In movies, computer generated graphics give freedom to designers so that special effects and
even imaginary characters can play a part in making movies, videos, and commercials.
• In sports, computers compile statistics, sell tickets, create training programs and diets for
athletes, and suggest game plan strategies based on the competitor’s past performance.
• In restaurants, almost everyone has eaten food where the clerk enters an order by indicating
choices on a rather unusual looking cash register; the device directly enters the actual data
into a computer, and calculates the cost and then prints a receipt.

Government: Various departments of the Government use computer for their planning, control
and law enforcement activities. To name a few – Traffic, Tourism, Information & Broadcasting,
Education, Aviation and many others.
6
Defence: There are many uses computers in Defence such as:
• Controlling UAV or unmanned air-crafts an example is Predator. If you have cable I would
recommend watching the shows “Future Weapons" and “Modern Marvels". The show future
weapon gives an entire hour to the predator.
• They are also used on Intercontinental Ballistic Missiles (ICBMs) that uses GPS and
Computers to help the missile get to the target.
• Computers are used to track incoming missiles and help slew weapons systems onto the
incoming target to destroy them.
• Computers are used in helping the military find out where all their assets are (Situational
Awareness) and in Communications/Battle Management Systems.
• Computers are used in the logistic and ordering functions of getting equipments to and around
the battlefield.
• Computers are used in tanks and planes and ships to target enemy forces, help run the
platform and more recently to help diagnose any problems with the platforms.
• Computers help design and test new systems.
• Sports:

In today's technologically growing society, computers are being used for several purpose
including:

Recording Information: Official statistics keepers and some scouts use computers to record
statistics, take notes and chat online while attending and working at a sports event.

Analyzing Movements: The best athletes pay close attention to detail. Computers can slow
recorded video and allow people to study their specific movements to try to improve their
tendencies and repair poor habits.

Writers: Many sportswriters attend several sporting events a week, and they take their computers
with them to write during the game or shortly after while their thoughts are fresh in their mind.

Scoreboard: While some scoreboards are manually updated, most professional sports venues
have very modern scoreboards that are programmed to update statistics and information
immediately after the information is entered into the computer.

7
Safety: Computers have aided in the design of safety equipment in sports such as football helmets
to shoes to mouth guards

Impact of Computers on Society


During the last decade computers have become an integral part of our daily lives. There is hardly
any activity which does not make use of computers at some stage or the other. Even when
someone on a holiday wishes to call a friend using his/her cell phone, he/she is using computers
indirectly as messages are handled and directed by them. Similarly, on any given day, even if we
are not directly working on computers on our desks, we make use of computers many times while
using a mobile or a land line phone, purchasing from a modem outlet, and other such activities.
Facilities such as e-mail and web have become the life-line of our modem society as well as of the
world of business.
Almost all the normal activities in present day society are controlled by computers including the
functioning of offices, factories, research and development laboratories, along with development
in the fields of teaching, sports, telecommunication, entertainment, etc. Activities that are closely
linked with the developments in computer systems include weather forecasts, developments in
science and technology, outer-space exploration, breakthroughs in medical sciences, and so on.
The term 'computer system' includes both the hardware and software. The hardware of a system
consists of the physical components that are connected together to function as a computer. The
working and functioning of a computer is governed by the software. All computers operate by
carrying out the instructions contained in operating systems and other programs which comprise
the software. The last decade has seen rapid development in computer hardware as well as
software systems. As a result, the speed with which the present-day computers carry out
instructions has increased tremendously. For instance, super computers are capable of carrying
out trillions of instructions per second. At the same time, the costs of operations have reduced to a
large extent. This has made it possible for a common man to possess a computer at home or office
or shop in the form of a desktop or carry with him/her in the form of a laptop or a notebook while
travelling. Modem desktops and laptops which a common person can now afford are much more
powerful than the dream computers of a few top scientists of the world visualized just two
decades ago.

Due to widespread applications and facilities associated with computers, everyone wants to
possess them. Besides the computational facilities that a computer provides, one can also avail
facilities such as reservation for train and air travel, payment of bills and taxes, filing of tax
returns, watching a movie using a DVD or on the internet, chatting with your friends using video
8
chat, conducting a conference between people sitting thousands of miles apart, ordering an
essential drug, grocery or fore-shopping and e-selling, etc. Students can make use of internet
knowledge sources such as e-tutorials and other e-leaming devices such as CDs and DVDs, and e-
libraries, which greatly aid in garnering useful information and gathering study material. Because
of these advantages computer has become an extremely essential tool for every student and is not
necessarily restricted to students of computer science.

CLASSIFICATION OF COMPUTERS
Computing machines can be classified in many ways depending on their purpose, baseline
technology, usage, capacity or size, the era in which they were used, their basic operating
principle and the kinds of data they process.

Classification by Purpose
General purpose computers are designed to perform a range of tasks. They have the ability to
store numerous programs, but lack in speed and efficiency. Specific purpose computers are
designed to handle a specific problem or to perform a specific task. A set of instructions is built
into the machine.

Classification by Technology
This classification is a historical one and it is based on what performs the computer operation, or
the technology behind the computing skill. Before the advent of any kind of computing device at
all, human beings performed computation by themselves. This involved the use of fingers, toes
and any other part of the body. Wood became a computing device when it was first used to design
the Abacus. Shickard in 1621 and Polini in 1709 were both instrumental to this development.
Metals were used in the early machines of Pascal, Thomas, and the production versions from
firms such as Brundsviga, Monroe and so on. Electromechanical devices as differential analyzers
were present in the early machines of Zuse, Aiken, Stibitz and many others. Electronic elements
were equally used in the Colossus, ABC, ENIAC, and the stored program computers. Several
kinds of new electro technological devices have been used in the past decades.

Classification by Capacity
Computers can be classified according to their capacity. The term ‘capacity’ refers to the volume
of work or the data processing capability a computer can handle. Their performance is determined
by the amount of data that can be stored in memory, speed of internal operation of the computer,
number and type of peripheral devices, amount and type of software available for use with the
9
computer. The capacity of early generation computers was determined by their physical size - the
larger the size, the greater the volume. Recent computer technology however is tending to create
smaller machines, making it possible to package equivalent speed and capacity in a smaller
format. Computer capacity is currently measured by the number of applications that it can run
rather than by the volume of data it can process. This classification is therefore done as follows:

Microcomputers
The microcomputer is a digital computer system that is controlled by a stored program that uses a
microprocessor, a programmable read-only memory (ROM) and a random-access memory
(RAM). The ROM defines the instructions to be executed by the computer while RAM is the
functional equivalent of computer memory. A Microcomputer has the lowest level capacity and
memories that are generally made of semiconductors fabricated on silicon chips. Large-scale
production of silicon chips began in 1971 and this has been of great use in the production of
microcomputers. The Apple IIe, the Radio Shack TRS-80, and the Genie III are examples of
microcomputers and are essentially fourth generation devices. Microcomputers have from 4k to
64k storage location and are capable of handling small, single-business application such as sales
analysis, inventory, billing and payroll.

Minicomputers
In the 1960s, the growing demand for a smaller stand-alone machine brought about the
manufacture of the minicomputer, to handle tasks that large computers could not perform
economically. Minicomputer systems provide faster operating speeds and larger storage
capacities than microcomputer systems. Operating systems developed for minicomputer systems
generally support both multiprogramming and virtual storage. This means that many programs
can be run concurrently. This type of computer system is very flexible and can be expanded to
meet the needs of users. Minicomputers usually have from 8k to 256k memory storage location,
and relatively established application software. The PDP-8, the IBM systems 3 and the
Honeywell 200 and 1200 computer are typical examples of minicomputers.

Medium-Size Computers
Medium-size computer systems provide faster operating speeds and larger storage capacities than
minicomputer systems. They support large number of high-speed input/output devices and several
disk drives can be used to provide online access to large data files as required for direct access
processing and their operating systems also support both multiprogramming and virtual storage.
This allows the running of variety of programs concurrently. A medium-size computer can
10
support a management information system and can therefore serve the needs of a large bank,
insurance company or university. They usually have memory sizes ranging from 32k to 512k. The
IBM System 370, Burroughs 3500 System and NCR Century 200 system are examples of
medium-size computers.

Large Computers
Large computers are next to Super Computers and have bigger capacity than the Medium-size
computers. They usually contain full control systems with minimal operator intervention. Large
computer system ranges from single-processing configurations to nationwide computer-based
networks involving general large computers. Large computers have storage capacities from 512k
to 8192k, and these computers have internal operating speeds measured in terms of nanosecond,
as compared to small computers where speed is measured in terms of microseconds.
Expandability to 8 or even 16 million characters is possible with some of these systems. Such
characteristics permit many data processing jobs to be accomplished concurrently. Large
computers are usually used in government agencies, large corporations and computer services
organizations. They are used in complex modelling, or simulation, business operations, product
testing, design and engineering work and in the development of space technology. Large
computers can serve as server systems where many smaller computers can be connected to it to
form a communication network.

Supercomputers
The supercomputers are the biggest and fastest machines today and they are used when billion or
even trillions of calculations are required. These machines are applied in nuclear weapon
development, accurate weather forecasting and as host processors for local computer and time
sharing networks. Super computers have capabilities far beyond even the traditional large-scale
systems. Their speed ranges from 100 million-instruction-per-second to well over three billion.
Because of their size, supercomputers sacrifice a certain amount of flexibility. They are therefore
not ideal for providing a variety of user services. For this reason, supercomputers may need the
assistance of a medium-size general purpose machines (usually called front-end processor) to
handle minor programs or perform slower speed or smaller volume operation.

Classification by Size
Super Computer: The fastest and most powerful type of computer Supercomputers are very
expensive and are employed for specialized applications that require immense amounts of
mathematical calculations. For example, weather forecasting requires a supercomputer. Other
11
uses of supercomputers include animated graphics, fluid dynamic calculations, nuclear energy
research, and petroleum exploration.
The chief difference between a supercomputer and a mainframe is that a supercomputer channels
all its power into executing a few programs as fast as possible, whereas a mainframe uses its
power to execute many programs concurrently.

Mainframe Computer: A very large and expensive computer capable of supporting hundreds, or
even thousands, of users simultaneously. In the hierarchy that starts with a simple microprocessor
(in watches, for example) at the bottom and moves to supercomputers at the top, mainframes are
just below supercomputers. In some ways, mainframes are more powerful than supercomputers
because they support more simultaneous programs. But supercomputers can execute a single
program faster than a mainframe.

Mini Computer: A midsized computer. In size and power, minicomputers lie between
workstations and mainframes. In the past decade, the distinction between large minicomputers
and small mainframes has blurred, however, as has the distinction between small minicomputers
and workstations. But in general, a minicomputer is a multiprocessing system capable of
supporting from 4 to about 200 users simultaneously.

Micro Computer or Personal Computer: Micro or personal computers include:


• Desktop Computer: a personal or micro-mini computer sufficient to fit on a desk.
• Laptop Computer: a portable computer complete with an integrated screen and keyboard. It
is generally smaller in size than a desktop computer and larger than a notebook computer.
• Palmtop Computer/Digital Diary /Notebook /PDAs: a hand-sized computer. Palmtops have
no keyboard but the screen serves both as an input and output device.
Workstations: A terminal or desktop computer in a network. In this context, workstation is just a
generic term for a user's machine (client machine) in contrast to a "server" or "mainframe."

Classification by Basic Operating Principle


Using this classification technique, computers are divided into Analog, Digital and Hybrid
systems.

Analog Computers: These are computers were well known in the 1940s although they are now
uncommon. An analog computer accept inputs which vary with respect to time and are directly
applied to various devices which performs the computing operations of additions, subtraction,
multiplication, division, integration and function generation. Numbers to be used in some
12
calculation were represented by physical quantities - such as electrical voltages. The computing
units of analog computers respond immediately to the changes which they detect in the input
variables. Analog computers excel in solving differential equations and are faster than digital
computers.

Digital Computers: Digital computers represent information discretely and use a binary (two-
step) system that represents each piece of information as a series of zeroes and ones for
calculation. They are designed to process data in numerical form and manipulate them more
easily with their circuits performing directly the mathematical operations of addition, subtraction,
multiplication, and division. Due to the discrete for of digital information, it can be copied exactly
while it is difficult to make exact copies of analog information.

Hybrid Computers: These are machines that can work as both analog and digital computers.
During the period from the early 1960s to the early 1970s, electronic analog computers were
increasingly combined with a digital computer in hybrid systems. The idea was to combine the
easy programmability of a general purpose digital computer with the ability of a large electronic
analog computer to solve substantial, complex problems, notably large sets of nonlinear
differential equations, or to simulate challenging spaceflights and "person-in-the-Loop" situations
in real time. A number of specialty hybrid systems emerged in the mid- to late 1960s and early
1970s. An unusual such system was the Trice digital analog computer developed by the Packard
Bell Company and used by NASA for spaceflight simulation

THE COMPUTER EVOLUTION


The computer evolution is indeed an interesting topic that has been explained in some different
ways over the years, by many authors. Each generation of computer is characterized by a major
technological development that fundamentally changed the way computers operate, resulting in
increasingly smaller, cheaper, more powerful and more efficient and reliable devices. The various
generations of computers are listed below:

The Mechanical Era (1623-1945)


Trying to use machines to solve mathematical problems can be traced to the early 17th century.
Wilhelm Schickhard, Blaise Pascal, and Gottfried Leibnitz were among mathematicians who
designed and implemented calculators that were capable of addition, subtraction, multiplication,
and division included The first multi-purpose or programmable computing device was probably
Charles Babbage's Difference Engine, which was begun in 1823 but never completed. In 1842,
13
Babbage designed a more ambitious machine, called the Analytical Engine but unfortunately it
also was only partially completed. Babbage, together with Ada Lovelace recognized several
important programming techniques, including conditional branches, iterative loops and index
variables. Babbage designed the machine which is arguably the first to be used in computational
science. In 1933, George Scheutz and his son, Edvard began work on a smaller version of the
difference engine and by 1853 they had constructed a machine that could process 15-digit
numbers and calculate fourth-order differences. The US Census Bureau was one of the first
organizations to use the mechanical computers which used punch-card equipment designed by
Herman Hollerith to tabulate data for the 1890 census. In 1911 Hollerith's company merged with
a competitor to found the corporation which in 1924 became International Business Machines
(IBM).

First Generation (1946-1954)


In 1946 there was no 'best' way of storing instructions and data in a computer memory. There
were four competing technologies for providing computer memory: electrostatic storage tubes,
acoustic delay lines (mercury or nickel), magnetic drums (and disks), and magnetic core
storage. The digital computes using electronic valves (Vacuum tubes) are known as first
generation computers. the first 'computer' to use electronic valves (i.e. vacuum tubes). The high
cost of vacuum tubes prevented their use for main memory. They stored information in the form
of propagating sound waves. The vacuum tube consumes a lot of power. The Vacuum tube was
developed by Lee De Forest in 1908. These computers were large in size and writing programs on
them was difficult. Some of the computers of this generation were:

Mark I: The IBM Automatic Sequence Controlled Calculator (ASCC), called the Mark I by
Harvard University, was an electro-mechanical computer. Mark I is the first machine to
successfully perform a long services of arithmetic and logical operation. Mark I is the First
Generation Computer. it was the first operating machine that could execute long computations
automatically. Mark I computer which was built as a partnership between Harvard and IBM in
1944. This was the first programmable digital computer made in the U.S. But it was not a purely
electronic computer. Instead the Mark I was constructed out of switches, relays, rotating shafts,
and clutches. The machine weighed 5 tons, incorporated 500 miles of wire, was 8 feet tall and 51
feet long, and had a 50 ft rotating shaft running its length, turned by a 5 horsepower electric
motor.

ENIAC: It was the first general-purpose electronic computer built in 1946 at University of
Pennsylvania, USA by John Mauchly and J. Presper Eckert. The completed machine was
14
announced to the public the evening of February 14, 1946. It was named Electronic Numerical
Integrator and Calculator (ENIAC). ENIAC contained 17,468 vacuum tubes, 7,200 crystal diodes,
1,500 relays, 70,000 resistors, 10,000 capacitors and around 5 million hand-soldered joints. It
weighed more than 30 short tons (27 t), was roughly 8 by 3 by 100 feet (2.4 m × 0.9 m × 30 m),
took up 1800 square feet (167 m2), and consumed 150 kW of power. Input was possible from an
IBM card reader, and an IBM card punch was used for output. These cards could be used to
produce printed output offline using an IBM accounting machine, such as the IBM 405. Today
your favourite computer is many times as powerful as ENIAC, still size is very small.

EDVAC: It stands for Electronic Discrete Variable Automatic Computer and was developed in
1950.it was to be a vast improvement upon ENIAC, it was binary rather than decimal, and was a
stored program computer. The concept of storing data and instructions inside the computer was
introduced here. This allowed much faster operation since the computer had rapid access to both
data and instructions. The other advantage of storing instruction was that computer could do
logical decision internally. The EDVAC was a binary serial computer with automatic addition,
subtraction, multiplication, programmed division and automatic checking with an ultrasonic serial
memory. EDVAC's addition time was 864 microseconds and its multiplication time was 2900
microseconds (2.9 milliseconds). The computer had almost 6,000 vacuum tubes and 12,000
diodes, and consumed 56 kW of power. It covered 490 ft² (45.5 m²) of floor space and weighed
17,300 lb (7,850 kg).

EDSAC: This stands for Electronic Delay Storage Automatic Computer and was developed by
M.V. Wilkes at Cambridge University in 1949. Two groups of individuals were working at the
same time to develop the first stored-program computer. In the United States, at the University of
Pennsylvania the EDVAC (Electronic Discrete Variable Automatic Computer) was being worked
on. In England at Cambridge, the EDSAC (Electronic Delay Storage Automatic Computer) was
also being developed. The EDSAC won the race as the first stored-program computer beating the
United States’ EDVAC by two months. The EDSAC performed computations in the three
millisecond range. It performed arithmetic and logical operations without human intervention.
The key to the success was in the stored instructions which it depended upon solely for its
operation. This machine marked the beginning of the computer age. EDSAC is the first computer
is used to store a program

UNIVAC-1: Ecker and Mauchly produced it in 1951 by Universal Accounting Computer setup. it
was the first commercial computer produced in the United States. It was designed principally by
J. Presper Eckert and John Mauchly, the inventors of the ENIAC. The machine was 25 feet by 50
15
feet in length, contained 5,600 tubes, 18,000 crystal diodes, and 300 relays. It utilized serial
circuitry, 2.25 MHz bit rate, and had an internal storage capacity 1,000 words or 12,000
characters. It utilized a Mercury delay line, magnetic tape, and typewriter output. The UNIVAC
was used for general purpose computing with large amounts of input and output. Power
consumption was about 120 kva. Its reported processing speed was 0.525 milliseconds for
arithmetic functions, 2.15 milliseconds for multiplication and 3.9 Milliseconds for division. The
UNIVAC was also the first computer to come equipped with a magnetic tape unit and was the
first computer to use buffer memory.

Other Important Computers of First Generation


Some other computers of this time worth mentioning are the Whirlwind, developed at
Massachusetts Institute of Technology, and JOHNNIAC by the Rand Corporation. The
Whirlwind was the first computer to display real time video and use core memory. The
JOHNNIAC was named in honour of Jon Von Neumann. Computers at this time were usually
kept in special locations like government and university research labs or military compounds.

Limitations of First Generation Computer


Followings are the major drawbacks of First generation computers.
i. They used valves or vacuum tubes as their main electronic component.
ii. They were large in size, slow in processing and had less storage capacity.
iii. They consumed lots of electricity and produced lots of heat.
iv. Their computing capabilities were limited.
v. They were not so accurate and reliable.
vi. They used machine level language for programming.
vii. They were very expensive.
Example: ENIAC, UNIVAC, IBM 650 and so on.

Second Generation (1955-1964)


The second-generation computer used transistors for CPU components & ferrite cores for main
memory & magnetic disks for secondary memory. They used high-level languages such as
FORTRAN (1956), ALGOL (1960) & COBOL (1960 - 1961). I/O processor was included to
control I/O operations. Around 1955 a device called Transistor replaced the bulky Vacuum tubes
in the first generation computer. Transistors are smaller than Vacuum tubes and have higher
operating speed. They have no filament and require no heating. Manufacturing cost was also very
low. Thus the size of the computer got reduced considerably. It is in the second generation that
the concept of Central Processing Unit (CPU), memory, programming language and input and
16
output units were developed. The programming languages such as COBOL, FORTRAN were
developed during this period. Some of the computers of the Second Generation were the
following:

i. IBM 1620: Its size was smaller as compared to First Generation computers and mostly used
for scientific purpose.
ii. IBM 1401: Its size was small to medium and used for business applications.
iii. CDC 3600: Its size was large and is used for scientific purposes.

Features:
i. Transistors were used instead of Vacuum Tube.
ii. Processing speed is faster than First Generation Computers (Micro Second)
iii. Smaller in size (51 square feet)
iv. The input and output devices were faster.
Example: IBM 1400 and 7000 Series, Control Data 3600 etc.

Third Generation (1964-1977)


This began with the development of a small chip consisting of 300 or more transistors. These ICs
are popularly known as Chips. A single IC has many transistors, registers and capacitors built on
a single thin slice of silicon. So it is quite obvious that the size of the computer got further
reduced. Some of the computers developed during this period were IBM-360, ICL-1900, IBM-
370, and VAX-750. Higher level language such as BASIC (Beginners All purpose Symbolic
Instruction Code) was developed during this period. Computers of this generation were small in
size, low cost, large memory and processing speed is very high. Very soon ICs Were replaced by
LSI (Large Scale Integration), which consisted about 100 components. An IC containing about
100 components is called LSI.

Features:
i. They used Integrated Circuit (IC) chips in place of the transistors.
ii. Semi conductor memory devices were used.
iii. The size was greatly reduced, the speed of processing was high, they were more accurate
and reliable.
iv. Large Scale Integration (LSI) and Very Large-Scale Integration (VLSI) were also
developed.
17
v. The mini computers were introduced in this generation.
vi. They used high level language for programming.
Example: IBM 360, IBM 370 etc.

Fourth Generation
An IC containing about 100 components is called LSI (Large Scale Integration) and the one,
which has more than 1000 such components, is called as VLSI (Very Large Scale Integration). It
uses large scale Integrated Circuits (LSIC) built on a single silicon chip called microprocessors.
Due to the development of microprocessor it is possible to place computer’s central processing
unit (CPU) on single chip. These computers are called microcomputers. Later very large scale
Integrated Circuits (VLSIC) replaced LSICs. Thus the computer which was occupying a very
large room in earlier days can now be placed on a table. The personal computer (PC) that you see
in your school is a Fourth Generation Computer Main memory used fast semiconductors chips up
to 4 M bits size. Hard disks were used as secondary memory. Keyboards, dot matrix printers etc.
were developed. OS-such as MS-DOS, UNIX, Apple’s Macintosh were available. Object oriented
language, C++ etc were developed.

Features:
i. They used Microprocessor (VLSI) as their main switching element.
ii. They are also called as micro computers or personal computers.
iii. Their size varies from desktop to laptop or palmtop.
iv. They have very high speed of processing; they are 100% accurate, reliable, diligent and
versatile.
v. They have very large storage capacity.
vi. Example: IBM PC, Apple-Macintosh etc.

Fifth Generation (1991-continued)


The 5th generation computers use ULSI (Ultra-Large Scale Integration) chips. Millions of
transistors are placed in a single IC in ULSI chips. 64 bit microprocessors have been developed
during this period. Data flow & EPIC architecture of these processors have been developed. RISC
& CISC, both types of designs are used in modern processors. Memory chips and flash memory
up to 1 GB, hard disks up to 600 GB & optical disks up to 50 GB have been developed fifth
generation digital computer will be Artificial intelligence.

The Active Players in Computer Technology

18
Hundreds of people from different parts of the world played prominent roles in the history of
computer. This section highlights some of those roles as played in several parts of the world.

The American Participation


America indeed played big roles in the history of computer. John Atanasoff invented the
Atanasoff-Berry Computer (ABC) which introduced electronic binary logic in the late 1930s.
Atanasoff and Berry completed the computer by 1942, but it was later dismantled. Howard Aiken
is regarded as one of the pioneers who introduced the computer age and he completed the design
of four calculators (or computers). Aiken started what is known as computer science today and
was one of the first explorers of the application of the new machines to business purposes and
machine translation of foreign languages. His first machine was known as Mark I (or the Harvard
Mark I), and originally named the IBM ASCC and this was the first machine that could solve
complicated mathematical problems by being programmed to execute a series of controlled
operations in a specific sequence.

The ENIAC (Electronic Numerical Integrator and Computer) was displayed to the public on
February 14, 1946, at the Moore School of Electrical Engineering at the University of
Pennsylvania and about fifty years after, a team of students and faculty started the reconstruction
of the ENIAC and this was done, using state-of-the-art solid-state CMOS technology.

The German Participation


The DEHOMAG D11 tabulator was invented in Germany. It had a decisive influence on the
diffusion of punched card data processing in Germany. The invention took place between the
period of 1926 and 1931. Korad Zuse is popularly recognized in Germany as the father of the
computer and his Z1, a programmable automaton built from 1936 to 1938, is said to be the
world’s ‘first programmable calculating machine’. He built the Z4, a relay computer with a
mechanical memory of unique design, during the war years in Berlin. Eduard Stiefel, a professor
at the Swiss Federal Institute of Technology (ETH), who was looking for a computer suitable for
numerical analysis, discovered the machine in Bavaria in 1949. Around 1938, Konrad Zuse began
work on the creation of the Plankalkul, while working on the Z3. He wanted to build a
Planfertigungsgerat, and made some progress in this direction in 1943 and in 1944, he prepared a
draft of the Plankalkul, which was meant to become a doctoral dissertation some day. The
Plankalkul is the first fully-fledged algorithmic programming language. Years later, a small group
under the direction of Dr. Heinz Billing constructed four different computers, the G1 (1952), the
G2 (1955), the Gla (1958) and the G3 (1961), at the Max Planck Institute in Gottingen.
19
Lastly, during the World war II, a young German engineer, Helmut Hoelzer studied the
application of electronic analog circuits for the guidance and control system of liquid-propellant
rockets and developed a special purpose analog computer, the ‘Mischgerat’ and integrated it into
the rocket. The development of the fully electronic, general purpose, analog computer was a spin-
off of this work. It was used to simulate ballistic paths by solving the equations of motion.

The British Participation


The Colossus was designed and constructed at the Post Office Research Laboratories at Dollis
Hill in North London in 1943 to help Bletchley Park in decoding intercepted German telegraphic
messages. Colossus was the world’s first large electronic valve programmable logic calculator
and ten of them were built and were operational in Bletchley Park, home of Allied World War II
code-breaking. Between 1948 and 1951, four related computers were designed and constructed in
Manchester and each machine has its innovative peculiarity. The SSEM (June 1948) was the first
such machine to work. The Manchester Mark 1 (Intermediate Version, April 1949) was the first
full-sized computer available for use. The completed Manchester Mark 1 (October 1949), with a
fast random access magnetic drum, was the first computer with a classic two-level store. The
Ferranti Mark 1 (February 1951) was the first production computer delivered by a manufacturer.
The University of Manchester Small-Scale Experimental Machine, the ‘Baby’ first ran a stored
program on June 21, 1948, thus claiming to be the first operational general purpose computer.
The Atlas computer was constructed in the Department of Computer Science at the University of
Manchester. After its completion in December 1962, it was regarded as the most powerful
computer in the world and it had many innovative design features of which the most important
were the implementation of virtual addressing and the one-level store.

The Japanese Participation


In the second half of the 1950s, many experimental computers were designed and produced by
Japanese national laboratories, universities and private companies. In those days, many
experiments were carried out using various electronic and mechanical techniques and materials
such as relays, vacuum tubes, parametrons, transistors, mercury delay lines, cathode ray tubes,
magnetic cores and magnetic drums. These provided a great foundation for the development of
electronics in Japan. Between the periods of 1955 and 1959, computers like ETL-Mark 2, JUJIC,
MUSASINO I, ETL-Mark-4, PC-1, ETL-Mark-4a, TAC, Handai-Computer and K-1 were built.

20
The African Participation
Africa evidently did not play any major roles in the recorded history of computer, but indeed it
has played big roles in the last few decades. Particularly worthy of mention is the contribution of
a Nigerian who made a mark just before the end of the twentieth century. Former American
President – Bill Clinton (2000) said “One of the great minds of the Information Age is a Nigerian
American named Philip Emeagwali. He had to leave school because his parents couldn't pay the
fees. He lived in a refugee camp during your civil war. He won a scholarship to university and
went on to invent a formula that lets computers make 3.1 billion calculations per second”. Philip
Emeagwali, supercomputer and Internet pioneer, was born in 1954, in Nigeria, Africa. In 1989, he
invented the formula that used 65,000 separate computer processors to perform 3.1 billion
calculations per second. Emeagwali is regarded as one of the fathers of the internet because he
invented an international network which is similar to, but predates that of the Internet. He also
discovered mathematical equations that enable the petroleum industry to recover more oil.
Emeagwali won the 1989 Gordon Bell Prize, computation's Nobel prize, for inventing a formula
that lets computers perform the fastest computations, a work that led to the reinvention of
supercomputers.

Computer System Components


A block diagram of the basic setup of a typical computer system appears in Figure 2. The major
components are as follows:

Figure 2: Components of a computer system

CPU
As mentioned earlier, this is the central processing unit, often called simply the processor,
where the actual execution of a program takes place. (Since only machine language programs can
execute on a computer, the word program will usually mean a machine language program. Recall
21
that we might write such a program directly, or it might be produced indirectly, as the result of
compiling a source program written in a high-level language (HLL) such as C.)

Memory
A program’s data and machine instructions are stored here during the time the program is
executing. Memory consists of cells called words, each of which is identifiable by its address. If
the CPU fetches the contents of some word of memory, we say that the CPU reads that word. On
the other hand, if the CPU stores a value into some word of memory, we say that it writes to that
word. Reading is analogous to watching a video cassette tape, while writing is analogous to
recording onto the tape. Ordinary memory is called RAM, for Random Access Memory, a term
which means that the access time is the same for each word.1 There is also ROM (Read-Only
Memory), which as its name implies, can be read but not written. ROM is used for programs
which need to be stored permanently in main memory, staying there even after the power is
turned off. For example, an autofocus camera typically has a computer in it, which runs only one
program, a program to control the operation of the camera. Think of how inconvenient - to say the
least - it would be if this program had to be loaded from a disk drive every time you took a
picture! It is much better to keep the program in ROM.

I/O Devices
A typical computer system will have several input/output devices, possibly even hundreds of
them. Typical examples are keyboards/monitor screens, floppy and fixed disks, CDROMs,
modems, printers, mice and so on. Specialized applications may have their own special I/O
devices. For example, consider a vending machine, say for tickets for a regional railway system
such as the San Franciso Bay Area’s BART, which is capable of accepting dollar bills. The
machine is likely to be controlled by a small computer. One of its input devices might be an
optical sensor which senses the presence of a bill, and collects data which will be used to analyze
whether the bill is genuine. One of the system’s output devices will control a motor which is used
to pull in the bill; a similar device will control a motor to dispense the railway ticket. Yet another
output device will be a screen to give messages to the person buying the ticket, such as “please
deposit 25 cents more.”

The common feature of all of these examples is that they serve as interfaces between the
computer and the “outside world.” Note that in all cases, they are communicating with a program
which is running on the computer. Just as you have in the past written programs which input from
a keyboard and output to a monitor screen, programs also need to be written in specialized
22
applications to do input/output from special I/O devices, such as the railway ticket machine
application above. For example, the optical sensor would collect data about the bill, which would
be input by the program. The program would then analyze this data to verify that the bill is
genuine.
System Bus
A bus is a set of parallel wires (usually referred to as “lines”), used as communication between
components. The system bus plays the role of communication between the CPU and, memory
and I/O devices. It is also possible for I/O devices to communicate directly with memory, an
action which is called direct memory access (DMA), and again this is done through the bus. The
bus is broken down into three sub-buses:

Data Bus:
As its name implies, this is used for sending data. When the CPU reads a memory word, the
memory sends the contents of that word along the data bus to the CPU; when the CPU writes a
value to a memory word, the value flows along the data bus in the opposite direction. Since the
word is the basic unit of memory, a data bus usually has as many lines as there are bits in a
memory word. For instance, a machine with 32-bit word size would have a data bus consisting of
32 lines.

Address Bus:
When the CPU wants to read or write a certain word of memory, it needs to have some
mechanism with which to tell memory which words it wants to read or write. This is the role of
the address bus. For example, if the CPU wants to read Word 504 of memory, it will put the value
504 on the address bus, along which it will flow to the memory, thus informing memory that
Word 504 is the word the CPU wants. The address bus usually has the same number of lines as
there are bits in the computer’s addresses.

Control Bus:
How will the memory know whether the CPU wants to read or write? This is one of the functions
of the control bus. For example, the control bus in typical PCs includes lines named MEMR and
MEMW, for “memory read” and “memory write.” If the CPU wants to read memory, it will
assert the MEMR line, by putting a low voltage on it, while for a write, it will assert MEMW.
Again, this signal will be noticed by the memory, since it too is connected to the control bus, and
so it can act accordingly. As an example, consider a machine with both address and word size
equal to 32 bits. Let us denote the 32 lines in the address bus as A31 through A0, corresponding to
23
Bits 31 through 0 of the 32-bit address, and denote the 32 lines in the data bus by D31 through
D0, corresponding to Bits 31 through 0 of the word being accessed. Suppose the CPU executes an
instruction to fetch the contents of Word 0x000d0126 of memory. This will involve the CPU
putting the value 0x000d0126 onto the address bus. Remember, this is hex notation, which is just
a shorthand abbreviation for the actual value, 000000000000000011010000000100100110.
So, the CPU will put 0s on lines A31 through A20, a 1 on Line A19, a 1 on Line A18, a 0 on Line
A17, and so on. At the same time, it will assert the MEMR line in the control bus. The memory,
which is attached to these bus lines, will sense these values, and “understand” that we wish to
read Word 0x000d0126. Thus the memory will send back the contents of that word on the data
bus. If for instance c(0x000d0126) = 0003, then the memory will put 0s on Lines D31 through
D2, and 1s on Lines D1 and D0, all of which will be sensed by the CPU.
Some computers have several buses, thus enabling more than one bus transaction at a time,
improving performance.

CPU Components
The following are components make up a typical CPU. Included are an arithmetic and logic unit
(ALU), and various registers.
The ALU, as its name implies, does arithmetic operations, such as addition, subtraction,
multiplication and division, and also several logical operations. The latter category of operations
is similar to the &&, || and ! operators in the C language) used in logical expressions such as if (a
< b && c == 3) x = y;
The ALU does not store anything. Values are input to the ALU, and results are then output from
it, but it does not store anything, in contrast to memory words, which do store values. An analogy
might be made to telephone equipment. A telephone inputs sound, in the form of mechanical
vibrations in the air, and converts the sounds to electrical pulses to be sent to the listener’s phone,
but it does not store these sounds. A telephone tape-recording answering machine, on the other
hand, does store the sounds which are input to it. Registers are storage cells similar in function to
memory words. The number of bits in a register is typically the same as that for memory words.
We will even use the same c( ) notation for the contents of a register as we have used for the
contents of a memory word. For example, c(PC) will denote the contents of the register PC
described below, just as, for instance, c(0x22c4) means the contents of memory word 0x22c4.
(For convenience, we are assuming 16-bit words and addresses here.) Keep in mind, though, that
registers are not in memory; they are inside the CPU. Here are some details concerning the
registers shown in Figure 2.2.

24
PC: This is the program counter. Recall that a program’s machine instructions must be stored in
memory while the program is executing. The PC contains the address of the currently executing
instruction.

SP: The stack pointer contains the address of the “top” of a certain memory region which is
called the stack. A stack is a type of data structure which the machine uses to keep track of
function calls and other information, as we will see in Chapter 5.
XR: An index register helps programs access arrays. Its name comes from the fact that in an
array element, say y[i] for an int array y, the subscript i is often called the index. The instruction
itself would specify the address of y, and i size of (int) would be placed in XR. The circuitry in
the CPU adds these two quantities, thus producing the proper location to access y[i].

PS: The processor status register contains miscellaneous pieces of information, including the
condition codes. The latter are indicators of information such as whether the most recent
computation produced a negative, positive or zero result. Note that there are wires leading out of
the ALU to the PS. These lines keep the condition codes up to date. Each time the ALU is used,
the condition codes are immediately updated according to the results of the ALU operation.
Generally, the PS will contain other information in addition to condition codes. A bit in the PS
will record which mode is used.

DRs: Data registers are usually used as “fast memory,” i.e. as temporary places to store data to
which we need quick access. Because they are in the CPU, an instruction executing within the
CPU can access them much faster than it can access memory, since memory is outside the CPU.
Different CPU types have different numbers of DRs.

MAR: The memory address register is used as the CPU’s connection to the address bus. For
example, if the currently executing instruction needs to read Word 0x0054 from memory, the
CPU will put 0x0054 into MAR, from which it will flow onto the address bus.

MDR: The memory data register is used as the CPU’s connection to the data bus. For example,
if the currently executing instruction needs to read Word 0x0054 from memory, the memory will
put c(0x0054) onto the data bus, from which it will flow into the MDR in the CPU. On the other
hand, if we are writing to Word 0x0054, say writing the value 0x0019, the CPU will put 0x0019
in the MDR, from which it will flow out onto the data bus and then to memory. At the same time,

25
we will put 0x0054 into the MAR, so that the memory will know to which word the 0x0019 is to
be written.

IR: This is the instruction register. When the CPU is ready to start execution of a new
instruction, it fetches the instruction from memory. The instruction is returned along the data bus,
and thus is deposited in the MDR. The CPU needs to use the MDR for further accesses to
memory, so it enables this by copying the fetched instruction into the IR, so that the original copy
in the MDR may be overwritten.

The PC, SP, XR and MAR all contain addresses, and thus typically have sizes equal to the
address size of the machine. Similarly, DRs and the MDR typically have sizes equal to the word
size of the machine. The PS stores miscellaneous information, and thus its size has no particular
relation to the machine’s address or word size. The IR must be large enough to store the longest
possible instruction for that machine. A CPU also has internal buses, similar in function to the
system bus, which serve as pathways with which transfers of data from one register to another can
be made. Figure 2.2 shows a CPU having only one such bus, but some CPUs have two or more.
Internal buses are beyond the scope of this book, and thus any reference to a “bus” from this point
onward will mean the system bus. The reader should pay particular attention to the MAR and
MDR. They will be referred to at a number of points in the following chapters, both in text and in
the exercises - not because they are so vital in their own right, but rather because they serve as
excellent vehicles for clarifying various concepts that we will cover in this book. In particular,
phrasing some discussions in terms of the MAR and MDR will clarify the fact that some CPU
instructions access memory while others do not. Again, the CPU structure shown above should
only be considered “typical,” and there are many variations. RISC CPUs, not surprisingly, tend to
be somewhat simpler than the above model, though still similar.

Software Components of the Computer “Engine”


There are many aspects of a computer system which people who are at the learning stage typically
take for granted as being controlled by hardware, but which are actually controlled by software.
An example of this is the backspace action when you type the backspace key on the keyboard.
You are accustomed to seeing the last character you typed now disappear from the screen, and the
cursor moving one position to the left. You might have had the impression that this is an inherent
property of the keyboard and the screen, i.e. that their circuitry was designed to do this. However,
for most computer systems today this is not the case. The bare hardware will not take any special

26
action when you hit the backspace key. Instead, the special action is taken by whichever
operating system (OS) is being used on the computer.

The OS is software - a program, which a person or group of people wrote to provide various
services to user programs. One of those services is to monitor keystrokes for the backspace key,
and to take special actions (move the cursor leftward one position, and put a blank where it used
to be) when encountering that key. When you write a program, say in C, you do not have to do
this monitoring yourself, which is a tremendous convenience. Imagine what a nuisance it would
be if you were forced to handle the backspace key yourself: You would have to include some
statements in each program you write to check for the backspace key, and to update the screen if
this character is encountered. The OS relieves you of this burden. This backspace-processing is an
example of one of the many services that an OS provides. Another example is maintenance of a
file system. Again the theme is convenience. When you create a file, you do not have to burden
yourself with knowing the physical location of your file on the disk. You merely give the file a
name. The OS finds unused space on the disk to store your file, and enters the name and physical
location in a table that the OS maintains. Subsequently, you may access the file merely by
specifying the name, and the OS service will translate that into the physical location and access
the file on your behalf. In fact, a typical OS will offer a large variety of services for accessing
files. So, a user program will make use of many OS services, usually by calling them as functions.
For example, consider the C-language function scanf(). Though, of course, you did not write this
function yourself, someone did, and in doing so that person (or group of people) relied heavily on
calls to an OS subroutine read(). In terms of our “look under the hood” theme, we might phrase
this by saying that a look under the hood of the C scanf() source code would reveal system calls
to the OS function read(). For this reason, the

OS is often referred to as “low-level” software. Also, this reliance of user programs on OS


services shows why the OS is included in our “computer engine” metaphor - the OS is indeed one
of the sources of “power” for user programs, just as the hardware is the other source of power. To
underscore that the OS services do form a vital part of the computer’s “engine,” consider the
following example. Suppose we have a machine-language program - which we either wrote
ourselves or produced by compiling from C - for a DEC computer with a MIPS CPU. Could that
program be run without modification on a Silicon Graphics machine, which also uses the MIPS
chip? The answer is no. Even though both machines do run a Unix OS, there are many different
“flavors” of Unix. The DEC version of Unix, called Ultrix, differs somewhat from the SGI
version, called IRIX. The program in question would probably include a number of calls to OS
27
services - recall from above that even reads from the keyboard and writes to the screen are
implemented as OS services - and those services would be different under the two OSs. Thus
even though individual instructions of the program written for the DEC would make sense on the
SGI machine, since both machines would use the same type of CPU, some of those instructions
would be devoted to OS calls, which would differ.

Since an OS consists of a program, written to provide a group of services, it follows that several
different OSs - i.e. several different programs which offer different groups of services - could be
run on the same hardware. For instance, this is the case for PCs. The most widely used OS for
these CPUs is Microsoft Windows, but there are also several versions of Unix for PCs, notably
the free, public-domain Linux and the commercial SCO.

Figure 4: Simplified block diagram of one of the first-generation microprocessors

28
CHAPTER TWO
PROGRAMMING METHODOLOGY AND ALGORITHM
INTRODUCTION
Programming languages are languages through which we can instruct the computer to carry out
some processes or tasks. They are also designed to communicate ideas about algorithms between
human beings and computers. Programming languages can be used to execute a wide range of
algorithms, that is, an instruction could be executed through more than a procedure of execution.
The full concept of algorithm will be explained later. A program is a set of codes that instructs
the computer to carry out some processes. Programming is the process of writing programs.

LEVELS OF PROGRAMMING LANGUAGES


Programs and programming languages have been in existence since the invention of computers,
and there are three levels of programming languages. These are:

Machine Language:
Machine language is a set binary coded instruction, which consists of zeros (0) and ones (1).
Machine language is peculiar to each type of computer. The first generation of computers was
coded in machine language that was specific to each model of computer. Some of the
shortcomings of the machine language were:
i. Coding in machine language was a very tedious and boring job
ii. Machine language was not user-friendly. That is the user had to remember a long list of
codes, numbers or operation codes and know where instructions were stored in computer
memory.
iii. Debugging any set of codes is a very difficult task since it requires going through the
program instruction from the beginning to the end.
The major advantage of machine language is that it requires no translation since it is already in
machine language and is therefore faster to execute.

Low Level Language:


This is a level of programming language which is different from the machine language. That is,
the instructions are not entirely in binary coded form. It also consists of some symbolic codes,
which are easier to remember than machine codes. In assembly language, memory addresses are
referenced by symbols rather than addresses in machine language. Low level programming
language is also called assembly language, because it makes use of an assembler to translate
codes into machine language. An example of assembly language statement is:

29
MOVE A1, A2 ® Move the contents of Register A2 to A1
JMP b ®Go to the process with label b

The disadvantages of assembly language are that:


i. It is specific to particular machines
ii. It requires a translator called an assembler

The major advantage of the assembly language is that programs written in it are easier to read and
more user friendly than those written in machine language, especially when comments are
inserted in the codes

High Level Language:


This programming language consists of English-like codes. High-level language is independent of
the computer because the programmer only needs to pay attention to the steps or procedures
involved in solving the problem for which the program is to be used to execute the problem.
High-level language is usually broken into one or more states such as: Main programs, sub-
programs, classes, blocks, functions, procedures, etc. The name given to each component differs
from one language to the other.

Some advantages of high-level language:


i. It is more user friendly, that is, easy to learn and write
ii. It is very portable, that is, it can be used on almost any computer
iii. It saves much time and effort when used compared to any other programming level
language.
iv. Codes written in this language can easily be debugged.

Features of Programming Languages


There are some conventional features which a programming language must possess, these
features are:
i. It must have syntactic rules for forming statements.
ii. It must have a vocabulary that consists of letters of the alphabet.
iii. It must have a language structure, which consists of keywords, expressions and statements.
iv. It may require a translator before it can be understood by a computer.
v. Programming languages are written and processed by the computer for the purpose of
communicating data between the human being and the computer.
30
PROGRAMMING METHODOLOGIES AND APPLICATION DOMAIN
Some programming methodologies are stated below:
Procedural Programming:
A procedural program is a series of steps, each of which performs a calculation, retrieves input, or
produces output. Concepts like assignments, loops, sequences and conditional statements are the
building blocks of procedural programming. Major procedural programming languages are
COBOL, FORTRAN, C, AND C++.

Object-Oriented (OO) Programming:


The OO program is a collection of objects that interact with each other by passing messages that
transform their state. The fundamental building blocks of OO programming are object modelling,
classification and inheritance. Major object-oriented languages are C++, Java etc.

Functional Programming:
A functional program is a collection of mathematical functions, each with an input (domain) and a
result (range). Interaction and combination of functions is carried out by functional compositions,
conditionals and recursion. Major functional programming languages are Lisp, Scheme, Haskell,
and ML.

Logic (Declarative) Programming:


A logic programme is a collection of logical declarations about what outcome a function should
accomplish rather than how that outcome should be accomplished. Logic programming provides a
natural vehicle for expressing non-determinism, since the solutions to many problems are often
not unique but manifold. The major logic programming language is Prolog.
Event Driven Programming:
An event driven program is a continuous loop that responds to events that are generated in an
unpredictable order. These events originate from user actions on the screen (mouse clicks or
keystrokes, for example), or else from other sources (like readings from sensors on a robot).
Major event-driven programming languages include Visual basic and Java.
Concurrent Programming:
31
A concurrent program is a collection of cooperating processes, sharing information with each
other from time to time but generally operating asynchronously. Concurrent programming
languages include SR, Linda, and High performance FORTRAN.

Application Areas
The programming communities that represent distinct application areas can be grouped in the
following way:

Scientific Computing:
It is concerned with making complex calculations very fast and very accurately. The calculations
are defined by mathematical models, which represent scientific phenomena. Examples of
scientific programming languages include, Python, Fortran 90, C, and High-Performance Fortran
Management Information System (MIS):
Programs for use by institutions to manage their information systems are probably the most

prolific in the world. These systems include an organisation’s payroll system, online sales and

marketing systems, inventory and manufacturing systems, and so forth. Traditionally, MIS have
been developed in programming languages like COBOL, RPG, and SQL.

Artificial Intelligence:
The artificial intelligence programming community has been active since the early 1960s. This
community is concerned about developing programs that model human intelligent behaviour,
logical deduction, and cognition. Examples of AI programming languages are prominent
functional and logic programming languages like Prolog, CLP, ML, Lisp, Scheme and Haskell.
Systems:

System programmers are those who design and maintain the basic software that runs systems –

operating system components, networks software, programming language compilers and


debuggers, virtual machines and interpreters, and so on. Some of these programs are written in the
assembly language of the machine, while many others are written in a language specifically
designed for systems programming. The primary example of a system programming language is
C.

Web-centric:
The most dynamic area of new programming community growth is the World Wide Web, which
is the enabling vehicle for electronic commerce and a wide range of applications in academia,

32
government, and industry. The notion of Web-centric computing, and then Web-centric
programming, is motivated by an interactive model, in which a program remains in an infinite
loop waiting for the next request or event to arrive, responding to that event, and returning to its
looping state. Programming languages that support Web-centric computing require a paradigm
that encourages system-user interaction, or event-driven programming. Programming languages
that support Web-centric computing include Perl, Tc1/Tk, Visual basic, and Java

Translators
A translator is a program that translates another program written in any programming language
other than the machine language to an understandable set of codes for the computer and in so
doing produces a program that may be executed on the computer. The need for a translator arises
because only a program that is directly executable on a computer is the machine language.
Examples of a translator are:-

Assembler: This is a program that converts programs written in assembly or low-level language
to machine language.

Interpreters and Compilers:


These consist of programs that convert programs in high level programming language into
machine language. The major difference between interpreters and compilers is that a compiler
converts the entire source program into object code before the entire program is executed while
the interpreter translates the source instructions line by line. In the former, the computer
immediately executes one instruction before translating the next instruction.

Features of Translators
i. They exist to make programs understandable by the computer
ii. There exist different translators for different levels and types of programming languages
iii. Without them, the programs cannot be executed.

The Programming Environment


Programming environments comprise of the following:

The Editor: An editor allows a program to be retrieved from the disk and amended as necessary.
In order to type any program on the keyboard and save the program on a disk, it will be necessary
to run a program called an editor.
33
The Compiler: This will translate a program written in high level language stored in a text mode
on a disk to the program stored in a machine-oriented language on a disk.

The Linker/Loader: A linker/loader picks up the machine-oriented program and combines it


with any necessary software (already in machine oriented form) to enable the program to be run.
Before a compiled program can be run or executed by the computer, it must be converted into an
executable form.

Algorithms
Algorithm is a procedure through which we obtain the solution of a problem. In other words, a
sequence of statements that, when executed one after the other, allow one to calculate the solution
of the problem starting from the information provided as input.

An algorithm is characterized by:


i. non-ambiguity: the statements must be interpretable in a unique way by whom is executing
them
ii. executability: it must be possible to execute each statement (in a finite amount of time)
given the available resources
iii. finiteness: the execution of the algorithm must terminate in a finite amount of time for each
possible set of input data

Example of an algorithm: scan the person names, one after the other as they appear in the registry,
until you have found the requested one; return the associated telephone number. Different
algorithms exist for solving the same problem. Once we have found/developed an algorithm, we
have to code it in the selected programming language.

Computer Problem Solving Strategies


Computer problem strategies are the approaches adopted for obtaining satisfactory solution to a
problem. The following are the major computer problems solving strategies:

Decomposition
The first step to solving any problem is to decompose the problem description. A good way to do
this would be to perform syntactic analysis on the description. We can do this in four steps.

34
Identify all of the nouns in the sentence.
Given the 3 dimensions of a box (length, width, and height), calculate the volume. The nouns in
the problem specification identify descriptions of information that you will need to either identify
or keep track of. Once these nouns are identified, they should be grouped into one of two
categories:
Input (items that are already know or are expected from the user)
Output (items that are determined through manipulation of the input)
Input Output
Dimensions Volume We need to calculate this
Length We are told these
Width Dimensions are ‘given’
Height
Box
Them

Eliminate redundant or irrelevant information.


There may be some information in the problem description that made it into our input/output
chart that we really don’t need to solve the problem (that is, not all of the nouns may be relevant).
Also, there may be some nouns that appear redundant (information we already have in our table,
just in a different form).

Input Output
Dimensions We don’t need the noun dimensions because Volume We need to calculate this
Length we already have length, width and height.
Width
Height
Box We do not need the box to calculate volume if we know the dimensions, not needed.
Them Another word for dimensions, not needed.

You may ask why we eliminated “dimensions” instead of “length,” “width,” and “height.” The
rule of thumb for eliminating redundant information is to always eliminate the most general item.
In other words, you wish to keep the most specific nouns possible in your table. When in doubt,
try to piece it together logically: when figuring out the volume, which nouns would be the most
useful to you?

Identify all of the verbs in the sentence.

35
Given the 3 dimensions of a box (length, width, and height), calculate the volume. The verbs in
the problem specification identify what actions your program will need to take. These actions,
known as processing are the steps between your input and your output.
Input Processing Output

Length Calculate
Width
Height

Link your inputs, processes, and output


This step is as simple as drawing lines between the relevant information in your chart. Your lines
show what inputs need to be processed to get the desired output. In our example, we need to take
our length, width, and height and multiply them, to give us our desired volume.
Input Processing Output

Length
Width Calculate Volume
Height
Figure 5: Linking input, process and output
Use external knowledge to complete your solution
In the solution, we have used a general verb calculate. It is at this point we are required to
determine what “calculate” means. In some arbitrary problem, calculate could refer to applying
some mathematical formula or other transformation to some input data in order to reach the
desired output. External knowledge (such as your background in mathematics) often provides
basis to “fill in the blanks.” In this case, by elementary geometry, the volume of a box can be
found using the following formula:
Volume = length * width * height

Flowcharting
The second step in solving our problem involves the use of flowcharting. Flowcharting is a
graphical way of depicting a problem in terms of its inputs, outputs, and processes. Though the
shapes we will use in our flowcharts will be expanded as we cover more topics, some of the basic
elements are presented in Figure 6.

Oval (start/end of a program) Parallelogram (program input and output)


36
Uni-directional
arrow (indicate the
flow of program)
Pseudocode
The final step in analyzing a problem is to step from flowchart to pseudocode. Pseudocode
involves writing down all of the major steps you will use in the program as depicted in your
flowchart. This is similar to writing final statements in your programming language without
needing to worry about program syntax, but retaining the flexibility of program design. Like
flowcharting, there are many elements to pseudocode design, only the most rudimentary are
described here.
Get used to get information from the user
Display used to display information for the user
Compute perform an arithmetic operation
+, -, *, /, =, ( ) standard arithmetic operators
Store store a piece of information for later use

A typical pseudocode is presented as follows:

Get length, width, height


Compute volume
volume = length * width * height
Store volume
Display volume

Exercise: Work through the three steps of decomposition, flowcharting, and pseudocode for a
program on the following example. Lemons and oranges are sold in a store. Oranges are N30 each
and lemons are N15 each. The program gets from the user the numbers of oranges and lemons
he/she wants and outputs the total amount of money to be paid.

37
INTRODUCTION TO PROGRAMMING LANGUAGE

Programming at a glance
In every event, activity or operation to be performed by human beings, there is always the need
for it to be organised in such a way so as to arrive at a certain conclusion. For example, in a social
gathering, there is need for a programme of events. This programme of events will go a long way
in facilitating optimum utilization of the available time and resources. The major difference
between the execution of operation by man and machine (computer) is that there may be lapses
during execution by man. For example, in man’s execution there may be inability to start or end
at the specified time and it is also possible to rearrange events without stopping the entire process.
But in machine’s execution, such lapses are rare. Once a machine starts execution of a program,
changes cannot be made unless the entire process is stopped for such changes to be made and then
resumed thereafter. Therefore, machine’s execution of a program is more accurate, timely and
efficient than that of man.

The need for a computer program cannot be over emphasised. Examples are in the area of
banking, where transactions across the entire regions of country and the world as a whole take
place within seconds; the simulation of spacecrafts to land safely or perform specific tasks above
the visible region of the earth, the use of robots in industries and in medicine for carrying out
surgeries on delicate organs (brain, heart etc.) and recently in the field of Information and
Communication Technology (ICT) which has reduced the world to a global village through
internet technologies. All these and more couldn’t have been possible without accurate and
precise computer programs.

Computer Program
Before the discussion on computer program it is necessary to note the steps to take in order to
develop a correct program devoid of errors. This is because; even though computers have
enormous capabilities to process large volume of data, it has ‘no sense’ and ‘no knowledge’ on its
own. Therefore, the program/instructions it receives must specify precisely what it should do in
all situations. This underscores the important of algorithms in problem solving using computers.
The translation of the algorithm into a computer program using appropriate programming
languages provides the blueprint that computers need to do their jobs.

Algorithm

38
The term algorithm was coined out from a nineteenth century Persian Mathematician named Al-
Khowarizimi.
Algorithm according to Iwuagwu (1998) can be defined as a solution procedure for a specific
problem given in form of finite number of instructions that are unambiguous, deterministic and
guaranteed to terminate on execution of these instructions.

Algorithm is a procedure through which we obtain the solution of a problem. In other words, a
sequence of statements that, when executed one after the other, allow one to calculate the solution
of the problem starting from the information provided as input.

An algorithm is characterized by:


i. non ambiguity: the statements must be interpretable in a unique way by whom is executing
them
ii. executability: it must be possible to execute each statement (in a finite amount of time)
given the available resources
iii. finiteness: the execution of the algorithm must terminate in a finite amount of time for each
possible set of input data
Example of an algorithm: scan the person names, one after the other as they appear in the registry,
until you have found the requested one; return the associated telephone number. Different
algorithms exist for solving the same problem. Once we have found/developed an algorithm, we
have to code it in the selected programming language.

Steps in Algorithm formulation


This consists of a set of manageable steps to adopt in formulating an algorithm for a problem.
These steps are:
1. Analysis of the problem
An attempt to proffer solution to a problem without first analysing it is inappropriate, no
matter how simple the problem may look. Problem analysis helps you to fully understand
the nature of the problem, the requirements of an acceptable solution and the shape or
form of input data that will give the desired solution or result.
2. Decomposition of the main problem into simpler sub-problems
A Problem no matter how complex it may look can be reduced significantly by breaking it
down into simpler, relatively independent sub-problems. The decomposition of a problem
into series of simpler sub-problems and solving the sub-problems separately and
sequentially leads to the solution of the problem.
39
3. Stepwise Refinement
Here, the individual sub-problems of step 2 are further broken down into simpler
relatively independent sub-problems. Solving the individual sub-sub problems
independently and sequentially ultimately leads to the form that can be coded into a
program using a programming language. This approach is referred to as ‘top-down’ design
approach. Note that any error in the solution to any of the sub-problems will lead to
incorrect result by the entire program.
4. Review of proposed solution procedure
The proposed solution steps or procedures are reviewed or cross-checked to ensure that
they are error free. This is necessary because errors (logical errors) that are undetected in
algorithm ultimately lead to incorrect programs. Reviewing or cross-checking is also
necessary to ensure that the individual solution procedures are compatible.

Example of an Algorithm
Supposing you are to use the computer to input or receive 20 numbers from the keyboard,
calculate the sum and average of the numbers and print the results.

Solution 1
Step 1: Input the 20 numbers
Step 2: calculate sum, average
Step 3: print results

Solution 2
Step 1: Initialize variables (Counter, Sum)
Step 2: Input a number
Step 3: Calculate Sum
Step 4: Increment Counter by 1
Step 5: If Counter is less than 20 goto step 2
Step 6: Calculate Average
Step 7: Print result (Sum, Average)
Step 8: End
Solution 1 even though is an algorithm for the problem but lack necessary details. Solution 2
therefore is a more efficient algorithm for the problem because of it explicit nature.

What is a Program?

40
A program can be defined in many ways. A concise definition is given thus: A program is a set of
instructions that are ordered logically, written in a programming language to perform specific
task(s) or solve specific problem(s).

A program describes how a specific task can be accomplished. Programs are stored in the
computer memory for the computer to execute.
From the algorithm (solution 2) above, let us call the algorithm ‘Average’. Therefore, ‘Average’
is a breakdown of the problem and can be represented graphically in a form called flowchart. The
job of the computer programmer is to translate the algorithm or flowchart of figure 1 to a program
using appropriate high-level programming language such as C, C++, Pascal, Fortran, Algol,
Visual Basic, BASIC etc. The program is what achieves the desired result. The computer program
is said to model the solution process. A program for the algorithm or flowchart above written in
BASIC programming language will look like this:

Program 1
10 REM ** AVERAGE OF NUMBERS**
20 COUNT = 1
30 SUM = 0
40 INPUT “ ENTER A NUMBER”, NUMBER
50 SUM = SUM + NUMBER
60 IF COUNT < 20 THEN COUNT = COUNT + 1 : GOTO 40
70 AVERAGE = SUM / 20
80 PRINT “SUM = “; SUM, “AVERAGE = “; AVERAGE
90 END

The program can be rewritten in different format, all yielding the same result as we shall see later
when we discuss control structures in BASIC.
Assignment: Redraw the flowchart in figure and rewrite the program such that the value of
counter is initialised to 0.

What is Programming?
Programming in general could be defined as the art of writing or developing a computer program
to solve a specific problem. It becomes clearer from the definition that programming starts from
the time a solution to a problem is conceived, the various steps involved in its algorithm
development, the program design, coding/implementation, debugging, testing and maintenance of
the completed program or software.

41
Introduction to Programming in Basic
BASIC is an acronym for Beginners-All Purpose Symbolic Instruction Code. BASIC was
originally developed by John Kemeny and Thomas Kurtz in 1964 at Dartmouth College, USa.
The earliest version of BASIC by Kemeny and Kurtz is what is today referred to as True BASIC.
Several versions of the language have evolved. For example, Turbo BASIC, ANSI BASIC,
BASICA, Microsoft BASIC (GW-BASIC, QBASIC and Quick BASIC). Most versions of BASIC
use interpreter but Quick Basic uses a compiler version of the language that allows one to create
object code (i.e. compiled code) separately and run later.

Structure of a BASIC Program


i. Every instruction/statement must begin with a line number (Quick BASIC may or may not
begin with line number)
ii. Program statements are executed in line number order beginning with the lowest
numbered line.
iii. No two statements can appear with the same line number unless they are separated by a
colon (:).
iv. The line numbers must increase with successive statements.
v. Each statement number must be followed by a BASIC keyword of statement which
indicate the type of instruction to execute or an identifier in an expression.
vi. The length of a statement may or may not exceed one line.
vii. BASIC programs end with an END statement

Data and Variable Types in BASIC


Every programming language has a character set. A language’s character set represents the set of
characters allowed in the language.
Constants
Constants in BASIC refer to quantities or identifiers that do not change or whose values do not
change in a program or during execution of a program. BASIC has two types of constants:
i. Numeric Constants
ii. String Constants

Numeric Constants or Numeric Literals


These are numbers that lie in the range -999999 to +999999. However, the range is not fixed and
depends on the computer used. Numeric constants can be whole numbers or fractions. Examples:
42
222, +574, -0.028, 64.2, -24.7E2, and so on. numeric constants can take the form of integer
quantities (whole numbers without a decimal point) or as floating-point quantities (numbers with
exponents). The values of numeric constants can be as large as 1038 as small as 10-38.

String Constants
A string constant is a set or sequence of characters (letter, numbers and certain special characters)
enclosed between quotation marks. Examples: “My class”, “….My school”, “12345”, “+45db?”.
Most versions of BASIC allow at least 255 characters (quotation marks exclusive) for strings.
However, there are some versions that permit up to 32,767 characters.

Variables
A variable is an identifier whose value can change in a program or during execution of a program.
Variable values can be numeric quantity or string. The name of a variable must begin with a
letter. A variable name can be a combination of letters, numbers and other characters like ( _ ) or (
. ) for some versions provided the first character is a letter (A, B, ….Z or a, b, …z). a dollar sign
($) proceeds or ends every string variable. Some versions of BASIC allow variable names to
contain up to 31 characters. Some even allow more characters in a variable name. Examples:

Numeric variables: X, A, Y, Azu, Bmax, Weight


String variables: Name$, Dept$, State$.

BASIC Keywords
All versions of BASIC have or include keywords or reserved words whose meaning are already
defined in the BASIC library file and cannot be used as variable names. Examples of keywords
are: IF, INPUT, PRINT, NEXT, WHILE, WRITE, REM, CASE etc.

Operators and Expressions in BASIC


Arithmetic operators are special symbols used to indicate arithmetic operations (addition,
subtraction, division, multiplication and exponentiation). These operators are used in forming
numeric (arithmetic) expressions.
Arithmetic Expression is a numeric constant and/or a variable connected or joined by arithmetic
operators.
Arithmetic operators are:

43
+ Addition
- Subtraction
* Multiplication
/ Division
^ or  Exponentiation
Many versions of BASIC have additional arithmetic operators such as
\ Integer division
MOD Integer remainder

Both of them round up the value to integer first, before division and the resulting quotient
truncated to an integer. For the integer remainder operation, the remainder resulting from an
integer division is provided. Examples of the use of operators:
J = I/2
PAY = BASICSAL + ALLOWANCE
PI = 3.142 * RADIUS ^ 2
17/3 = 5.6
17\3 = 5
17 MOD 3 = 2
The hierarchy of operations is given as:
i. Exponentiation
ii. Multiplication and Division
iii. Integer division
iv. Integer remainder
v. Addition and subtraction.
However, the use of parenthesis alters the precedence with the operation enclosed in the
parenthesis being performed first.
Relational Operators
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
<> Not equal to
= Equal to

For example, IF X <> Y THEN PRINT “X not equal to Y”

44
Data Type notation in BASIC
% represents integer variable (2 bytes)
! represents single precision (4 bytes)
# represents double precision
$ represents string (32 bytes)
Examples:
SERYEAR% = PREVSERVICE + CURSERVICE
PROFIT! SELPRICE – COSTPRICE
ANNUALSAL# = MONTHSALES + INTEREST
NAME$ = “IBAM”

String Expressions
String constants or string variables cannot be used in a numeric expression. String can be
concatenated (joined, one behind the other) in most versions of BASIC. The ampersand (&) is the
standard string concatenation operator being used. However, some versions of BASIC use the
plus sign (+) for concatenation too.

Examples:
SURNAME$ = “IBAM”
FIRSTNAME$ = “ONWUKA”
FULLNAME$ = SURNAME$ & “ “ & FIRSTNAME$
FULLNAME$ = SURNAME$ + “ “ + FIRSTNAME$

Assignment Statement (LET Statement)


Variables (numeric and string) are assigned values in a program using the LET statement. The
general format of the LET statement is:
Ln LET v = exp
Where: Ln = line number
v = BASIC variable name
exp = arithmetic or string expression
Examples:
10 LET K = L – M
40 LET C = 10
50 LET Y = C – K * 5
For Strings:
20 LET A$ = “CHIBUZO”
60 LET CHILD$ = A$ & “ CHINEME”
70 LET OPR$ = “20”
45
The equal sign (=) in the above statements does not indicate equality of values of variables in left-
hand side with that of the right-hand side. It implies that the values of the variables in the left-
hand side be replaced with values on the right-hand side. LET is a keyword that shows explicitly
that a statement is an assignment statement. However, many versions of BASIC may or may not
use the LET keyword in its assignment statements. For such versions, statements in examples
above are written as:
10 K = L + M
30 Y = C + K * 5
Some versions of BASIC use a single LET to assign the same value to two or more variables.
Examples:
70 LET X = Y = Z = 700
90 NEW1$ = OLD1$ = “UNDERGRADUATE”

Remark Statement (REM)


To attach comments to a program or segments of a program, the REM statement is used. The
format of the remark statement is:
Ln REM CD
Where: Ln = line number
CD = context description
REM = a keyword
Examples:
10 REM B.TECH CLASS
20 REM FOR UNDERGRADUATES ONLY

The remark statement is a non-executable statement. To attach side comments against a statement
in a program, the apostrophe (‘) is inserted at the end of the statement after giving enough blank
spaces
Example:
30 IF X < Y THEN GOTO 60 ‘stop if condition is true.

Data Input statements (READ, INPUT)


On input, data values can be declared statically or supplied during program execution. There are
two BASIC statements used for inputting data.
i. INPUT and
ii. READ statements

46
READ Statement
The format of the statement is:
Ln READ variable list

Examples:
50 READ B, Y, C
60 READ REGNO$

Note: Every READ statement in BASIC must have a associated DATA statement of the form:
Ln DATA variable list
Example:
70 DATA 100, 25.6, 2000
READ statement with corresponding DATA statement:
30 READ V, U, W
...
...
...
90 DATA 28, 95, 65.4
It is possible to have several READ statements with one DATA statement.
Example:
20 READ V, U, W
30 READ X, Y
40 READ NAME$, STATE$, AGE
…….
……

80 DATA 28, 95, 65.4, 20, 92, “SUNDAY”, “AKURE”, 25

Note: The number of data values must not be less than the number of variables and the data
values must match the data types of the variables.

INPUT statement
INPUT statement is used to enter data values dynamically during program execution. The
computer halts on encountering the keyword INPUT and displays a question mark (?). The user is
requested to key in the variable’s value and press the ‘Enter’ key before it can proceed to execute
the next stamen following the INPUT.
Examples:
60 INPUT NUMBER1

47
70 INPUT X, Y, Z
80 INPUT NAME$, DEPT$
It is a good programming practice to use quoted strings to tell the program user what to enter.
Example:
60 INPUT “Enter first number “; NUMBER1
70 INPUT “Enter sch fees, accom. Fee, levy “; X, Y, Z
80 INPUT “Enter name of student and dept. “; NAME$, DEPT$

PRINT statement
The PRINT statement transmit numeric or string data from the processing unit and displays on
the screen (VDU) or output device specified. The format is:
Ln PRINT list
Where: list = the list of numeric and or string expressions separated by commas, semicolon or
colon.
Examples:
40 PRINT SUM
50 PRINT “SUM IS: “; SUM, “AVERAGE IS: “; AVERAGE
60 PRINT NAME$, REGNO$, LEVEL ‘displays on screen
70 LPRINT NAME$, REGNO$, LEVEL ‘prints on attached printer

Semicolon placed after a variable makes the next variable to be printed on the same line with that
variable. But comma after a variable, spaces the variable out. With colon, the variables to be
printed must appear on the same line. But if none is used, the next variable to be printed will
appear on the next line.
Control Structures
Control structure is a broad term used to describe logical control structures in a program. A
program may require logical test to be carried out at specific point within the program and actions
will be taken based on the result or outcome of the logical test (conditional execution) or that a set
of program statements be executed repeatedly until specific condition(s) has been satisfied
(looping). Or that looping will continue until some logical conditions have been satisfied
(conditional looping). And conditional execution where a group of statements is selected from
other groups based on the value of the expression (selection). Control structures can alter the
sequence of execution of program statements or instructions.

GOTO Statement
GOTO statement causes unconditional transfer of execution to a specified line number. the
format is:
48
GOTO Ln
Where:
Ln = line number to jump to and continue program execution form there.
Example:
10 REM *RECTANGLE (AREA) *
30 INPUT “ENTER LENGTH “; L
40 INPUT “ENTER WIDTH “; W
60 IF L = W THEN GOTO 80
70 PRINT “LENGTH NOT EQUAL TO WIDTH”
80 AREA = L * W
90 IF AREA <= 0 THEN GOTO 30
100 PRINT “AREA = “, AREA
110 END

Line 70 will be executed only if the value of the variable L is not equal to the value of the
variable W. and the program will print the value of AREA (line 100) and stop only when the
value of area is greater than 0.

FOR ..NEXT Statement


FOR …NEXT statement is used to carryout unconditional looping in a program. That is, it is
used to execute a statement or group of statements some predefined number of times.
FOR – initiates the loop, set up a counter to control or determine the number of times the loop is
repeated.
NEXT – indicates the return point of the loop and increment the counter each time the loop is
executed until the number of times specified by the FOR statement is completed. A FOR …
NEXT can be exited anytime (transfer out of a FOR … NEXT loop depending on a logical test)
using the EXIT FOR statement. The format of the FOR … NEXT statement is:
Ln FOR counter = value1 TO value2 STEP value3
...
...
...
Ln NEXT counter
Where:
Counter = is any numeric variable
Value1 = initial value of the variable (counter)
Value2 = last value of the variable (counter)
Value3 = incremental value of the variable (counter)

49
However, when the value of the variable (counter) increments by 1, then STEP statement is
omitted.

Example 1:
20 FOR I = 1 TO 5
30 PRINT “YOU ARE WELCOME”
40 PRINT “RELAX AND ENJOY YOURSELF”
50 NEXT I
60 PRINT “IT’S WELL”
Line 30 and 40 “YOU ARE WELCOME” and “RELAX AND ENJOY YOURSELF” will be
displayed 5 times each on the screen before displaying line 60 “IT’S WELL”

Example 2:
20 FOR I = 1 TO 5 STEP 3
30 PRINT “YOU ARE WELCOME”
40 PRINT “RELAX AND ENJOY YOURSELF”
50 NEXT I
60 PRINT “IT’S WELL”

The program segment will display line 30 and 40 three times before executing line 60.
Value1, value2 and value3 can be either positive or negative integer or contain fractions. If value3
is negative, then value1 must be greater than value2.
Example:
10 FOR CLASS = 3.5 TO -1 STEP -0.5
20 PRINT CLASS
30 NEXT CLASS

Conditional Looping (DO … LOOP, WHILE … WEND)


The DO … LOOP structures always start with a DO statement and end with a LOOP statement.
Four forms of the DO … LOOP structure exist:
1. DO
...
...
...
Statements
...
...
...
LOOP UNTIL logical expression
50
2. DO
...
...
...
Statements
...
...
...
LOOP WHILE logical expression

3. DO WHILE logical expression


...
...
...
Statements
...
...
...
LOOP

4. DO UNTIL logical expression


...
...
...
Statements
...
...
...
LOOP
The first and second DO … LOOP structures require the logical expression to be in the loop
statement (at the end of the block) while the third and fourth require logical expression to be in
the DO statement (at the beginning).
For the first form, it continues to loop as long as logical expression is not true. The second form
continues to loop as long as logical expression is true. The third form will start looping and
continues to loop as long as the logical expression is true. The fourth form continues to loop as
long as logical expression is false (not true).
Example 1:
30 LET CLASS = 1
40 DO
50 PRINT CLASS; “ “; ‘loop must execute once
60 CLASS = CLASS + 2 ‘and continue looping until
51
70 LOOP UNTIL CLASS > 100 ‘class is greater than 100
Example 2:
30 LET CLASS = 1
40 DO
50 PRINT CLASS; “ “; ‘loop must execute once
60 CLASS = CLASS + 2 ‘and continue looping until
70 LOOP WHILE CLASS <= 100 ‘class is greater than 100
Example 3:
30 LET CLASS = 1
40 DO WHILE CLASS <= 100 ‘continue looping until
50 PRINT CLASS; “ “; ‘class becomes greater
60 CLASS = CLASS + 2 ‘than 100
70 LOOP
Example 4:
30 LET CLASS = 1
40 DO UNTIL CLASS > 100 ‘continue looping until
50 PRINT CLASS; “ “; ‘class becomes greater
60 CLASS = CLASS + 2 ‘than 100
70 LOOP

The WHILE … WEND Statement


WHILE … WEND structure is allowed in some versions even though it is not included in the
1987 ANSI standard.
The format is:
WHILE logical expression
...
...
...
Statements
...
...
...
WEND
It is used in the same way like DO WHILE loop structure, by replacing DO WHILE with WHILE
and LOOP with WEND.
Example:
30 LET CLASS = 1
40 WHILE CLASS <= 100 ‘continue looping until
50 PRINT CLASS; “ “; ‘class becomes greater
60 CLASS = CLASS + 2 ‘than 100

52
70 WEND

IF … THEN Statement (conditional statement)


In IF … THEN statement, the execution of statements after the THEN is possible only if the
logical expression is true. Otherwise, execution continues on the statement following the IF …
THEN.
The format is:
Ln IF logical expression THEN executable statement
Example:
20 IF NUMBER = 0 THEN TERM = TERM ^ NUMBER
30 PRINT “THE TERM IS: “; TERM

Block IF … THEN Structure


When more than one statement is to be executed, the IF …THEN is implemented as a block of
statements with an END IF statement to mark the end of statements within the structure.
Example:
10 INPUT “ENTER LECTURER’S NAME “; NAME$
20 IF NAME$ = “IBAM” OR NAME$ = “OSUOLALE” THEN
30 PRINT “YOU ARE CORRECT”
40 PRINT “ CHECK COMPUTER SCIENCE DEPARTMENT”
50 PRINT “SCHOOL OF COMPUTING AND INFORMATICS FUTA”
60 END IF
70 PRINT “ *** END OF SESSION, SEE YOU! “
80 END
Line 30 to 50 will execute only when any of the conditions tested is true. If the condition is false,
that is, if neither of the names above was entered, the program will go straight to line 70 and print
*** END OF SESSION, SEE YOU! And stop. Other forms of the block IF… THEN statements
are:
1. IF logical expression THEN
...
...
...

Statements
...
...
...
ELSE
...
...
...

53
Statements ‘will be executed only
...
...
... ‘if logical expression is false
END IF

2. IF logical expression1 THEN


...
...
...

Statements
...
...
...
ELSE IF logical expression2 THEN
...
...
...

Statements
...
...
...
ELSE
...
...
...

Statements
...
...
...
END IF

Example:
20 INPUT “ENTER MARITAL STATUS “; STATUS$
30 IF STATUS$ = “M” THEN
40 PRINT “MARRIED, RESPONSIBLE”
50 TAX = TAX * 0.5
60 ELSE IF STATUS$ = “S” THEN
70 PRINT “SINGLE, CONTINUE SEARCHING”
80 TAX = TAX * 2
90 ELSE IF STATUS$ = “D” THEN
100 PRINT “DIVORCED, WHY?”
110 TAX = TAX * 2
120 ELSE
130 PRINT “INVALID MARITAL STATUS”
140 GOTO 20
150 END IF
When the input is entered, if it matches the first IF or any of the ELSE IF statements, the
statements under the matched condition will be executed and others including the ELSE statement
54
is ignored and execution continues from the statement immediately following the END IF. But if
none matches the input value, the IF and ELSE IF are ignored and only the statements in the
ELSE statement will be executed.

SELECT … CASE Statement


The SELECT … CASE structure allows one of many different groups of statements to be
executed depending on the value of an expression.
The format is:
SELECT CASE expression
CASE value1
Statements
CASE value2
Statements
………..
CASE valueN
Statements
CASE ELSE
Statements
END SELECT

Example 1:
10 INPUT “ENTER MARITAL STATUS “; STATUS$
20 SELECT CASE STATUS$
30 CASE “M”
40 PRINT “MARRIED, RESPONSIBLE”
50 TAX = TAX * 0.5
60 CASE “S”
70 PRINT “SINGLE, CONTINUE SEARCHING”
80 TAX = TAX * 2
90 CASE “D”
100 PRINT “DIVORCED, WHY?”
110 TAX = TAX * 2
120 CASE ELSE
130 PRINT “INVALID MARITAL STATUS”
140 GOTO 20
150 END SELECT
160 PRINT “TAX = “, TAX
170 END
Example2:
20 INPUT “ENTER STUDENT’S LEVEL “; LEVEL

55
30 SELECT CASE LEVEL
40 CASE 1, 2, 3, 4, 5
50 PRINT “UNDERGRADUATE PROGRAMME”
60 CASE 6, 7
70 PRINT “NON RESEARCH POST GRADUATE PROGRAMME”
80 CASE >= 8
90 PRINT “RESEARCH POST GRADUATE PROGRAMME?”
100 CASE ELSE
110 PRINT “INVALID PROGRAMME”
120 END SELECT
130 END

STOP and END Statements


STOP statement terminates the execution of program statements at any point in the program. And
the END statement indicates the physical end of the program.

Example:
10 INPUT K : PRINT K
20 IF K < 0 THEN 40
30 PRINT “END GRACEFULLY”
40 STOP
50 PRINT “BYE FOR NOW”
60 END

Logical Operators
In addition to arithmetic and relational operators, logical operators are used with control
structures to form expressions. Commonly used logical operators are: AND, OR, NOT. Microsoft
BASIC supports XOR operator.

Examples:
1. IF NAME$ = “JIMI” AND STATE$ = “OGUN” THEN PRINT “EKARO”

2. IF SCHOOL$ = “COMPUTING AND INFORMATICS” OR DEPTCODE = 15 THEN


PRINT “COMPUTER SCIENCE”

3. IF NOT(X = 5) THEN PRINT “YOU ARE CORRECT”

56
For example 1 above, the print statement will execute only if both conditions are true i.e. NAME$
is JIM and STATE$ is OGUN.
In example 2, the print statement will execute if any of the condition is true. That is either of the
conditions is true.
In example 3, the NOT negates the value of a logical expression. The print statement will execute
only if the value of X is not 5.
For the XOR operator, one expression must be true while the other is false or vice versa.

Functions and Subroutines in BASIC


Functions
Two types of functions exist in BASIC – Internal and External functions.
A function performs transformation on its argument(s) to return a single value (numeric or string).
A string function has a dollar sign ($) after its name and returns a string value. Numeric function
returns a numeric value. The arguments of a function are separated by commas and enclosed in
parenthesis after the function’s name.

Function definition (DEF statement)


The DEF statement is used in a program to define a single-line function. In some versions of
BASIC, the function name is prefixed with the letters FN. In others, the function name is like any
identifier (numeric or string).

Example:
10 DEF F(A) = 1/10 * (2*A + 3*A + 25)
20 DEF FNAME$(FIRST$, LAST$) = FIRST$ & LAST$

Accessing function in a program


Each time a function is accessed or ‘called up’ within a program, the function is evaluated using
the most recent value of its argument.

Example:
40 DEF F(A) = 1/10 * (2*A + 3*A + 25)
50 INPUT “ENTER BASIC SALARY ”; BSAL
60 LET RENTALLOW = F(BSAL)
70 PRINT “YOUR RENT ALLOWANCE IS: “; RENTALLOW
80 LET RENTALLOW = RENTALLOW * 0.5 * 12
90 LET ANRENT = F(RENTALLOW)

57
100 PRINT “ANNUAL RENT ALLOWANCE IS: “; ANRENT

The value of the function in line 60 is evaluated using the value of the variable BSAL entered.
Assuming in line 50, the value 1000 was entered in line 60
RENTALLOW = 1/10 * (2*1000 + 3*1000 + 25) = 502.5
Later in the program in line 90, the value of the variable ANRENT is computed by evaluating the
function using the current value of RENTALLOW. That is,
ANRENT = F(502.5) = 1/10 * (2*502.5 + 3*502.5 + 25)
However, if a function consists of more than one statement (multi-line), the function is defined
using this format:

DEF functionname(argument)
……
Statements
END DEF ‘ or END FUNCTION depending on the version

Example:
10 DEF FNET(B, A, T)
30 A = 1/10 * B+A
40 T = B – T
50 LET FNET = B – A – T
60 END DEF ‘ or END FUNCTION
70 REM *******
80 INPUT “ENTER BASIC SALARY “; SAL
90 INPUT “ENTER ALLOWANCE “; BONUS
100 INPUT “ENTER TAX “; TAX
110 LET MONPAY = FNET(SAL, BONUS, TAX)
120 PRINT “YOUR MONTHLY PAY IS: “; MONPAY
130 END

External Functions
An external function in BASIC is defined after the END statement. That is after the program
block instead of within the main program block as in the case of internal functions. Variables
declared within an external function are visible only within the function. Before an external
function is to be used or referenced in the main program block, it must be declared within the
main program block by preceding the function name with either of these statements EXTERNAL
FUNCTION or DECLARE FUNCTION or DECLARE DEF, depending on the version of
BASIC.

58
Example:
If the FNET function in the program above is to be implemented as an external function, it will be
like this;

10 REM ** MAIN PROGRAM BLOCK **


20 DECLARE FUNCTION FNET(B, A, T)
30 INPUT “ENTER BASIC SALARY “; SAL
40 ……………………………………..
50 ……………………………………..
60 …………………………………….. ‘ other statements
70 ……………………………………..
120 LET MONPAY = FNET(SAL, BONUS, TAX)
140 END
150 EXTERNAL FUNCTION FNET(B, A, T)
160 A = 1/10 * B – A
170 T = B – T
180 LET FNET = B + A – T
190 END FUNCTION

Subroutine in BASIC
Subroutines in BASIC are defined in a similar way like multi-line functions. Two types of
subroutines (Internal and external) exist in BASIC. There is another form of subroutine – ‘Old’
subroutine.
Some versions of BASIC support both internal and external subroutines while some (e.g. Quick
BASIC) also support ‘Old’ subroutine and external subroutines.
The format of subroutine can be given as:
‘Old’ Subroutine
GOSUB Ln
…………
…………
RETURN

Where Ln = line number to jump to and start executing from there until a RETURN statement is
encountered, it then jumps back to a statement number or line number immediately following the
statement containing the GOSUB and continues from there.

Internal and External subroutine

59
The format is:
SUB subroutine(arguments)
...
...
...

Statements or actions
...
...
...
END SUB
Internal subroutines are defined with the main program blocks (similar to internal function) while
external subroutines are defined after the END statement of the main program block. Defined
subroutines (internal and external) are accessed in a program using the CALL statement with the
format:
CALL subroutinename(arguments)
External subroutines must be declared in the main program using the DECLARE SUB statement
of the format:
DECLARE SUB subroutinename(argument if any)

Example 1:
(‘Old’ Subroutine)
10 INPUT “ENTER LECTURER’S NAME “ ; NAME$
20 IF NAME$ = “ONWUKA” THEN GOSUB 80
30 PRINT “END OF CLASS”
40 PRINT “ SHALL WE MEET AGAIN? BYE “
50 END
80 PRINT “YOU ARE RIGHT”
90 PRINT “THE COURSE IS NICE”
100 RETURN

Example 2: (Internal Subroutine)


10 REM ** PAYROLL **
30 SUB PAY (L, S)
40 IF L < 10000 THEN
50 S = L + 250
60 PRINT S; “ JUNIOR ACADEMIC”
70 ELSE
80 S = L + 500
90 PRINT S; “ SENIOR ACADEMIC”
100 END IF
120 END SUB
130 INPUT “ENTER SALARY “; L
140 CALL PAY(L, S)
60
150 PRINT ** GOOD BYE **
160 END

Example 3: (External Subroutine)


10 REM ** PAYROLL **
20 DECLARE PAY(L, S)
40 CALL PAY(L, S)
50 PRINT “GOOD BYE”
60 END
70 SUB PAY (L, S)
80 INPUT “ENTER SALARY “; L
90 IF L < 10000 THEN
100 S = L + 250 : PRINT S; “ JUNIOR ACADEMIC”
110 ELSE
120 S = L + 500 : PRINT S; “ SENIOR ACADEMIC”
130 END IF
140 END SUB
Arrays in BASIC
Arrays are collection of subscripted variables. An array can be one-dimensional (has one row or
one column) or two-dimensional or have more than two rows and columns. Before an array is
used in a program it must be defined using the DIM statement. The DIM statement (i.e.
dimension statement) specifies the type of array (numeric or string) as well as the number of
memory locations to be reserved by the computer for the array. Individual element in an array is
called subscripted variable. There are different ways of defining an array depending on the
version of BASIC used. Examples are:
DIM A(10)
DIM A(1 TO 10)
DIM A(1 : 10)
All the DIM statements define an array variable A, that has ten (10) distinct subscripted variables
in it. The value of the individual subscripted variable is accessed later in a program by using its
subscript or index. For DIM statements above, the subscripts take on integer values from 1 to 10.
Other examples are:
DIM S(-5 TO 0) ‘ has six distinct subscripted variables
DIM DEPT$(1 TO 15) or DIM DPET$(15)
For two dimensional arrays, the subscript for the rows and columns are separated by a comma.

Example:
DIM C(10, 10)
DIM C(1 TO 10, 1 TO 10)

61
DIM C(1 : 10, 1 :10)

All of the above is referring to a 10 X 10 distinct subscripted variables of the same data type
(numeric). The size of the array is 100.

MAT READ Statement


For input, BASIC uses MAT READ statement to read data for the subscripted variables whose
values are contained in data statement somewhere in the program.

Example:
10 DIM A(10, 10), B(10, 10)
20 MAT READ A
30 MAT READ B
40 …………………. ‘here for other statements
50 …………………
60 DATA 2,5,6,7
70 DATA 5, 8, 4, ……
90 END
MAT INPUT Statement
MAT INPUT statement is used to read in or input data values from the keyboard for the
subscripted variables in an array during program execution.

Example:
10 DIM A(10, 10), B(10, 10)
20 MAT INPUT A
30 MAT INPUT B
40 …………………. ‘here for other statements
50 …………………
60 END

Assignment of Data values in Array


The MAT statement is used to assign values (scalar or matrix or vector quantities) to arrays.

Example:
20 DIM DEPT$(15), REGNO(10,10)
30 MAT DEPT$ = “COMPUTER SCIENCE”

62
Assigns the string COMPUTER SCIENCE to each element of the array DEPT$. That is, in the
array DEPT$ all the fifteen elements will now have value as COMPUTER SCIENCE.
MAT REGNO 2006
Here, each of the 100 elements of the array REGNO will now have 2006 as their value. When two
arrays have the same dimension, for example
DIM A(10, 10), B(10, 10), C(5), D(5)
The elements of array B can be assigned to corresponding elements of array A and that of array D
to corresponding elements of array C as seen below.
10 MAT A = B
20 MAT C = D

MAT PRINT Statement


MAT PRINT statement is used to print out information in matrix form. Examples are:
20 MAT PRINT A
30 MAT PRINT A, B, C

Program 1:
Let us write a program here, that computes the product of a scalar K with a matrix B of any valid
dimension.
20 REM ***MATRIX MULTIPLICATION (SCALAR)***
30 INPUT “ENTER NO OF ROWS “; N1
40 INPUT “ENTER NO OF COLUMNS “; N2
50 DIM B(N1, N2), S(N1, N2)
60 INPUT “ENTER THE SCALAR VALUE “; K
70 MAT READ B
80 FOR I = 1 TO N1
90 FOR J = 1 TO N2
100 S(I, J) = K * B(I, j)
110 NEXT J
120 NEXT I
130 MAT PRINT S
140 DATA 5, 3, 8, 6, 4, 10 , 20, …..
150 DATA 2, 18, 15, 8, 5. …….
160 END

Program 2:
Program adds two matrices of equal dimension
10 REM ***MATRIX ADDITON***
20 INPUT “ENTER NO OF ROWS “; N1

63
30 INPUT “ENTER NO OF COLUMNS “; N2
40 DIM B(N1, N2), A(N1, N2), S(N1, N2)
50 MAT INPUT A
60 MAT INPUT B
70 FOR I = 1 TO N1
80 FOR J = 1 TO N2
90 S(I, J) = A(I, J) + B(I, j)
100 NEXT J
110 NEXT I
120 MAT PRINT S
130 END

Program 3:
Addition of two vectors of equal dimensions
10 REM ** VECTOR ADDITION **
20 INPUT “ENTER ARRAY SIZE “; N
30 DIM B1(N), B2(N), B3(N)
40 MAT INPUT B1
50 MAT INPUT B2
60 MAT B3 = B1 + B2
70 MAT PRINT B3
80 END

NOTE: There are some versions of BASIC that do not support MAT READ, MAT INPUT, MAT
and MAT PRINT statement for example, Quick BASIC. For such versions program 3 can be
written as:

10 REM ** VECTOR ADDITION **


20 INPUT “ENTER ARRAY SIZE “; N
30 DIM B1(N), B2(N), B3(N)
40 FOR I = 1 TO N
50 INPUT B1(I)
60 NEXT I
70 FOR J = 1 TO N
80 INPUT B2(J)
90 NEXT J
100 CLS
110 FOR K = 1 TO N
120 B3(K) = B1(K) + B2(K)
130 PRINT B3(K)
140 NEXT K

64
150 END

Introduction to File Operations in BASIC


A file can contain values (numeric or string) or program. Files that contain data values are called
data files. Data files can have two characteristics:
i. Sequential data file – which is organised such that access to a particular record can be
only from the beginning of the file by reading the records sequentially. That is, from the
first record, then second, third in that order.
ii. Random access data files – this is also known as direct data files. In direct data files, any
particular record can be reached directly by specifying the corresponding record number
or record location. The version of BASIC used here is Quick BASIC.

File Handling in BASIC


All programs or applications that involve the use of files perform the following three (3) basic
tasks:
i. Open the data file
ii. Process the records, as required by the application
iii. Close the file (Bryon, 1993)
Opening the data file – every data file to be opened is associated with a file number, the mode of
the file (sequential or random), the access type (read or write) and the status (new or old)

Processing the records – this involves reading, modifying and writing out modified records.

Closing of the file – involves closing it finally from the mode it was opened.

Open Statement (File Opening)


Quick BASIC uses the OPEN statement to create a file or open an already created sequential file.
If the file specified exists, it opens it. Otherwise, it creates a new one using the specified name.
The format is:
OPEN filename FOR access type AS filenumber

Filename – is the name of the file with its extension, all enclosed in double quotes.
Access type – (Input or Output)
Filenumber – (unique number assigned to each file opened)

65
Example:
OPEN “STUDREC.DAT” FOR INPUT AS #1
OPEN “STUDREC2.DAT” FOR OUTPUT AS #2

INPUT# and PRINT# Statement


INPUT# is used to read records from a file. PRINT# is used to write records into a file.

Example:
INPUT#1, REGNO, NAME$ ‘read data from file
PRINT#2, REGNO, NAME$ ‘write data into another file

CLOSE or CLOSE# Statement


This statement is used to close opened files. Quick BASIC uses CLOSE, True BASIC uses
CLOSE#. In Quick BASIC, one CLOSE statement can be used to close all opened files. But for
True BASIC separate CLOSE# with the correct file numbers are used to close opened files.

Example:
10 OPEN “STUDREC.DAT” FOR INPUT AS #1
20 OPEN “STUDREC2.DAT” FOR OUTPUT AS #2
30 INPUT “ENTER NO OF RECORDS TO RETRIEVE: “; N
40 FOR I = 1 TO N
50 INPUT #1, REGNO, NAME$
60 PRINT REGNO, NAME$,
70 PRINT
80 INPUT “ENTER SEX “; SEX$
90 PRINT #2, REGNO, NAME$, SEX$
100 NEXT I
120 CLOSE
130 END

KILL Statement
The KILL statement is used to delete an existing data file. The format is:
KILL filename
Example:
KILL “STUDREC.DAT”
The statement must come after the close statement.

NAME Statement

66
The NAME statement is used to rename a file. The format is:
NAME oldname AS newname
Example:
KILL “STUDREC.DAT”
NAME “STUDREC2.DAT” AS “STUDREC.DAT”

The above statements delete the file STUDREC.DAT and rename STUDREC2.DAT to
STUDREC.DAT

67
Computer Hardware and Troubleshooting Techniques

SECTION ONE

Computer Hardware Basics

Computer Basics introduces general computer use and terminology. It describes the basic
hardware components of a PC and introduces basic skills for using software programs in a
windows environment. This course will address hardware and peripheral components of the
computer and how to use them correctly.

A computer is an electronic device that has the ability to store, retrieve, and process data, and can
be programmed with instructions that it remembers. The physical parts that make up a computer
(the central processing unit, input, output, and memory) are called hardware. Programs that tell a
computer what to do are called software. A set of instructions that perform a particular task is
called a program, software program, or software. Peripherals are any hardware device connected
to a computer, any part of the computer outside the CPU and working memory. Some examples
of peripherals are keyboards, the mouse, monitors, printers, scanners, disk and tape drives,
microphones, speakers, joysticks, plotters, and cameras.

Power Supply:

The power supply converts the alternating current (AC) from your mains (110V input or 220V
input) to the direct current (DC) needed by the computer. In a PC, the power supply is the
metal box usually found in a corner of the case. The power supply is visible from the back of
many systems because it contains the power-cord receptacle and the cooling fan. Power supplies
- often referred to as switching power supplies, use switcher technology to convert the AC input
to lower DC voltages. The typical voltages produced are: 3.3, 5 and 12 volts

68
a b c

A Typical ATX 1.3 power supply

Figure a, from left to right, the connectors are 20-pin motherboard, 4-pin "P4 connector", fan
RPM monitor (note the lack of a power wire), SATA power connector (black), "Molex
connector", and floppy connector; figures b and c show the power supply with three small
transformers (yellow) in the center. To the left are two cylindrical capacitors. The large finned
pieces of aluminum are heat sinks. The left heat sink has transistors attached to it. These are the
transistors in charge of doing the switching - they provide high-frequency power to the
transformers. Attached to the right heat sink are diodes that rectify AC signals and turn them into
DC signals.

Figure: A power supply schematic showing the AC input, fan, EMI filter (yellow), transformers, cylindrical
capacitors, filters, aluminum heat sink, rectifying diodes, and 3 outgoing DC voltage lines.

The 3.3-volts and 5-volts are typically used by digital circuits, while the 12-volt is used to
power fans and motors in disk drives. The main specification of a power supply is in watts.
A watt is the product of the voltage in volts and the current in amperes or amps.
The form factor of the power supply refers to its general shape and dimensions. The form factor
of the power supply must match that of the case that it is supposed to go into, and the
motherboard it is to power.

Power Supply Wattage:


A 400-watt switching power supply will not necessarily use more power than a 250-watt
supply. A larger supply may be needed if you use every available slot on the motherboard or
every available drive bay in the personal computer case. It is not a good idea to have a 250-watt
69
supply if you have 250 watts total in devices, since the supply should not be loaded to 100
percent of its capacity.
According to PC Power & Cooling, Inc., some power consumption values (in watts) for
common items in a personal computer are:

Component Requirement
AGP Video Card 30W - 50W
PCI Express Video 100W - 250W If you use a PSU that does not supply
Average PCI Card 5W - 10W
enough power for the system, any of
the following symptoms might occur:
DVD/CD 20W - 30W
Hard Drive 15W - 30W i. System does not boot,
Case/CPU Fans 3W (ea.)
ii. System randomly shuts down,
iii. Add-in devices do not work
Motherboard (w/o CPU or RAM) 50W - 150W properly
RAM 15W per 1GB
Processor 80W - 140W

Heat Sinks/Fans
As processors, graphics cards, RAM and other components in computers have increased in speed
and power consumption, the amount of heat produced by these components as a side-effect of
normal operation has also increased. These components need to be kept within a specified
temperature range to prevent overheating, instability, malfunction and damage leading to a
shortened component lifespan. Other devices which need to be cooled include the power supply
unit, optoelectronic devices such as higher-power lasers and light emitting diodes (LEDs) and
hard disks.

A heat sink is a heat exchanger component attached to a device used for passive cooling. It
is designed to increase the surface area in contact with the cooling fluid surrounding it, such as
the air thus allowing it to remove more heat per unit time. Other factors which improve the
thermal performance of a heat sink are the approach air velocity, choice of material – usually an
aluminum alloy due to its high thermal conductivity values (229 W/mºK), fin (or other
protrusion) design and surface treatment.

70
b

Figure a above shows a fan-cooled heat sink on the processor of a PC. To the right of it is a smaller heat sink cooling
another integrated circuit of the motherboard. Figure b shows the 3 types of Heat-sink design: Pin, Straight (running
the entire length of the heat sink), Flared.

The approach air velocity depends on the attached or nearby fan. When there is no air flow
around the heat sink, energy cannot be transferred. A computer fan is any fan inside, or
attached to, a computer case used for active cooling, and may refer to fans that draw cooler air
into the case from the outside, expel warm air from inside, or move air across a heat sink to cool a
particular component.

Case

A computer case (also known as a computer chassis, cabinet, box, tower, enclosure, housing,
system unit or simply case) is the enclosure that contains most of the components of a computer
(usually excluding the display, keyboard and mouse). If you are building your own computer
selecting the case will be one of your first choices to make: the type of case, its size,
orientation, the number of bays you will need etc.

The figure above shows a stripped ATX desktop case. The motherboard will lie flat on the bottom, against the right panel, with
peripheral connectors protruding through the rear panel, drive bays at the top and front, and the power supply at the top and
rear.

Sizes

Cases can come in many different sizes (known as form factors). The size and shape of a
computer case is usually determined by the form factor of the motherboard, since it is the largest
component of most computers. Consequently, personal computer form factors typically specify
only the internal dimensions and layout of the case.

For example, a case designed for an ATX motherboard and power supply may take on several
external forms, such as a vertical tower (designed to sit on the floor, height > width) or a flat
desktop (height < width) or pizza box (height ≤ 2 inches, designed to sit on the desk under the
71
computer's monitor). Full-size tower cases are typically larger in volume than desktop cases, with
more room for drive bays and expansion slots. Desktop cases - and mini-tower cases designed for
the reduced microATX form factor - are popular in business environments where space is at a
premium.

Major Component Locations

1. The motherboard is usually screwed to the case along its largest face, which could
be the bottom or the side of the case depending on the form factor and orientation.

2. Form factors such as ATX provide a back panel with cut-out holes to expose I/O ports
provided by integrated peripherals, as well as expansion slots which may optionally expose
additional ports provided by expansion cards.
3. The power supply unit is often housed at the top rear of the case; it is usually attached with
four screws to support its weight.
4. Most cases include drive bays on the front of the case; a typical ATX case includes a 5.25"
bay (used mainly for optical drives) and 3.5" bays used for hard drives, floppy drives, and
card readers.
5. Buttons and LEDs are typically located on the front of the case; some cases include
additional I/O ports, temperature and/or processor speed monitors in the same area.
6. Vents are often found on the front, back, and sometimes on the side of the case to allow
cooling fans to be mounted via surrounding threaded screw holes.

Motherboard

The motherboard is the key circuit board holding the essential processing parts of a computer.
It allows all the parts of your computer to receive power and communicate with one another. It
is usually screwed to the case along its largest face, which could be the bottom or the side of
the case depending on the form factor and orientation. The form factor describes the shape and
layout of the motherboard. It affects where individual components go and the shape of the
computer's case. Attached directly to the motherboard are the CPU, RAM, expansion cards,
networking, video, and audio components.

An older motherboard Intel Z77 motherboard.

ATX (Advanced Technology eXtended) is a motherboard form factor specification developed by


Intel in 1995. A full-size ATX board is 12 × 9.6 in (305 × 244 mm). It was the first big change in

72
computer case, motherboard, and power supply design in many years, improving standardization
and interchangeability of parts. The specification defines the key mechanical dimensions,
mounting point, I/O panel, power and connector interfaces between a computer case, a
motherboard, and a power supply. The specification has been revised numerous times since
1995, the most recent being version 2.3, released in 2007.

Standards: ATX, standards for smaller boards: microATX, FlexATX and mini-ITX

73
Intel Z77 motherboard (Plan View). (Intel, 2014b)

1. 12V Processor Core Voltage 15. POST Code LED Display 29. High Definition (HD) Audio AC97
Front Panel Header
2.Connector (8 pin) status LEDs
Voltage Regulator 16. Front Panel Header 30. CMOS RAM Battery
3. Processor Socket (LGA1155) 17. USB 2.0 Dual-Port Header (black) 31. Rear Chassis Fan Header (4 pin)
4. Processor Fan Header (4 pin) 18. Chassis Intrusion Header 32. 5 port audio with S/PDIF
5. Memory Slots 19. BIOS Configuration Jumper 33. Intel Gigabit (10/100/1000Mb/s)
Ethernet LAN
6. Front Chassis Fan Header (4 pin) 20. Consumer IR (CIR) headers 34. IEEE 1394a port
7. Onboard Speaker 21. USB 3.0 Front Panel Connector 35. External Serial ATA (eSATA) port
(3 Gb/s)
8. Main Power Connector (2x12 pin) (blue)
22. S/PDIF out Header (4 pin) 36. USB ports:

4 USB 3.0 ports (blue)


9. Onboard Power Button 23. Diagnostic Status LEDs 37. Graphics ports
10. +5V Standby Power Indicator LED 24. Auxiliary chassis fan header 4 pin) 38. Back to BIOS button
11. SATA 3.0 Connector (black) 25. IEEE 1394a front panel header 39. PS/2 port
12. SATA Ports: 26. PCI Express 2.0 x1 connector 40. USB 2.0 ports (yellow)

(4 SATA 6.0 ports (blue & grey) 2 high current/ fast charging ports
13. Intel Z77 Express Chipset 27. Conventional PCI bus connector 41. Voltage Regulator modules with heat
sinks
14. Alternate Front Panel Power 28. PCI Express 3.0 x16 connector

LED Header

74
Intel Z77 Motherboard (North View).

Intel Z77 Motherboard (South View).

Intel Z77 Motherboard (West View).

Intel Z77 Motherboard (East View)

75
Expansion Cards:

Special expansion cards are one way to add new types of ports to an older computer or to
expand the number of ports on your computer. Like other expansion cards, these cards clip into an
open expansion slot on the motherboard.

An expansion card with 3 USB ports and 2 Firewire ports.

Video (Graphics) Card:

A dedicated video card (or video adapter) is an expansion card installed inside your system unit
to translate binary data received from the CPU or GPU into the images you view on your
monitor. It is an alternative to the integrated graphics chip. Modern video cards include ports
allowing you to connect to different video equipment; also they contain their own RAM, called
video memory. Video cards also come with their own processors or GPUs. Calls to the CPU for
graphics processing are redirected to the processor on the video card, significantly speeding up
graphics processing. Updating to a dedicated graphics card offloads work from the CPU and
system RAM, so not only will graphics processing be faster, but the system’s overall
performance will improve.

The video card also controls the number of colours your monitor can display. The number of bits
the video card uses to represent each pixel on the monitor (referred to as the bit depth)
determines the colour quality of the image displayed. The more bits available, the better the
colour detail of the image.

76
A Graphics card with output ports for both digital and analog video. The GPU sits under the fan (red) and heatsink.

A mid-range video card optimized for dual-GPU gaming (NVIDIA SLI)

Sound Card

a b

Figure a: An older sound card expansion card. Figure b: Sound card module as an integrated circuit on the Z77
motherboard. Indicator is showing the RealTek audio chip. In the bottom right you see the front panel audio
connector which would be plugged into the microphone jack and headphone jack on the front of the case.
77
i. Sound cards attached to the motherboard and enabled your computer to record and
reproduce sounds.
ii. Most computers ship with a basic sound card, most often a 3D sound card. 3D sound is
better than stereo sound at convincing the human ear that sound is omnidirectional, meaning
that you can’t tell what direction the sound is coming from. This tends to produce a fuller,
richer sound than stereo sound.
iii. To set up surround sound on your computer, you need two things: a set of surround-
sound speakers and a sound card that is Dolby Digital compatible. There are many formats
to choose from such as Dolby Digital EX, Dolby Digital Plus, and Dolby TrueHD. The
ports on the sound card allow you to connect additional audio devices such as amplified
speakers, headphones, microphones etc.

Network Card

a b

Figure a: An older Network card expansion card. F ig u re b : The Gigabit Ethernet Card as an integrated circuit
on the Z77 motherboard. The indicator is pointing to the Gigabit Ethernet chip, while just below it is a crystal.

An Ethernet network requires that you install or attach network adapters to each computer or
peripheral you want to connect to the network. Most computers come with Ethernet adapters
preinstalled as network interface cards (NICs).

If your computer doesn’t have a NIC, your options are: (i) buy one and install it, or (ii) use a
USB adapter, which you plug into any open USB port on the system unit.

RAM Memory
Random access memory (RAM) is a series of small cards or modules plugged into slots on
the motherboard. The CPU can request any data in RAM. It is then located, opened, and
delivered to the CPU for processing in a few billionths of a second. Since all the contents of

78
RAM are erased when you turn off the computer, RAM is the temporary or volatile storage
location for the computer.

A RAM Memory Module.

Operations
Similar to a microprocessor, a memory chip is an integrated circuit (IC) made of millions of
transistors and capacitors. In the most common form of computer memory, dynamic random
access memory (DRAM), a transistor and a capacitor are paired to create a memory cell, which
represents a single bit of data. The capacitor holds the bit of information - a 0 or a 1. The
transistor acts as a switch that lets the control circuitry on the memory chip read the capacitor or
change its state.

A capacitor is like a small bucket that is able to store electrons. To store a 1 in the memory cell,
the bucket is filled with electrons. To store a 0, it is emptied. The problem with the capacitor's
bucket is that it has a leak. In a matter of a few milliseconds a full bucket becomes empty.
Therefore, for dynamic memory to work, either the CPU or the memory controller has to come
along and recharge all of the capacitors holding a 1 before they discharge. The capacitors
must to be energized every 15ms or so (hundreds of times per second) to maintain their charge.
To do this, the memory controller reads the memory and then writes it right back. This is
refresh operation happens automatically and is how dynamic RAM got its name. Dynamic RAM
has to be dynamically refreshed all of the time or it forgets what it is holding. The downside of
all of this refreshing compared to SRAM is that it takes time and slows down the memory.

(a) Empty Memory Cells (a 0), (b) voltage applied to Column and Row lines (c) 4 cells charged

Memory cells are etched onto a silicon wafer in an array of columns (bitlines) and rows
(wordlines). The intersection of a bitline and a wordline constitutes the address of the memory
cell.

79
DRAM works by sending a charge (an electrical signal called a strobe) through the appropriate
column (CAS) to activate the transistor at each bit in the column. When writing, the row lines
contain the state the capacitor should take on. When reading, the sense-amplifier determines
the level of charge in the capacitor. If it is more than 50 percent, it reads it as a 1; otherwise it
reads it as a 0. The counter tracks the refresh sequence based on which rows have been accessed
in what order. The length of time necessary to do all this is so short that it is expressed in
nanoseconds (billionths of a second). A memory chip rating of 70ns means that it takes 70
nanoseconds to completely read and recharge each cell.

Memory cells alone would be worthless without some way to get information in and out of them.
So, the memory cells have a whole support infrastructure of other specialized circuits. These
circuits perform functions such as:

i. Identifying each row and column (row address select and column address select)
ii. Keeping track of the refresh sequence (counter)
iii. Reading and restoring the signal from a cell (sense amplifier)
iv. Telling a cell whether it should take a charge or not (write enable)

Other functions of the memory controller include a series of tasks that include identifying
the type, speed and amount of memory and checking for errors.
i. When you open an application such as Excel, it is loaded into RAM. To conserve RAM
usage, many applications load only the essential parts of the program initially and then
load other pieces as needed.
ii. After an application is loaded, any files that are opened for use in that application are
loaded into RAM.
iii. When you save a file and close the application, the file is written to the specified storage
device, and then it and the application are purged from RAM.
How Much RAM do you need?
The amount of RAM actually sitting on memory modules in your computer is your computer’s
physical memory. The memory that your operating system uses is referred to as kernel memory.
To determine how much RAM your computer needs, look at the memory requirements for each
program and add them up. You need RAM for the operating system, application software, and
data. If your system responds slowly or accesses the hard drive constantly, then you need to
add more RAM
Sample RAM requirements

Application Minimum RAM


Windows 7 1000 MB
Microsoft Office Professional 2007 256 MB
Internet Explorer 8 128 MB
iTunes 256 MB
Adobe Photoshop Elements 512 MB
Total RAM required to run all 2,152 MB or 2.15 GB
programs simultaneously

To save data more permanently, you need to save it to the hard drive or to another permanent
storage device such as a CD or flash drive. Read-only memory (ROM) holds all the instructions

80
the computer needs when it is powered on. The data does not get erased when the power is turned
off.

Metrics for RAM speed


System RAM speed is controlled by bus width and bus speed. Bus width refers to the number of
bits that can be sent to the CPU simultaneously, and bus speed refers to the number of times a
group of bits can be sent each second. A bus cycle occurs every time data travels from memory to
the CPU. For example, a 100-MHz 32-bit bus is theoretically capable of sending 4 bytes of data
to the CPU 100 million times per second, while a 66-MHz 16-bit bus can send 2 bytes of data 66
million times per second. If you do the sums, you’ll find that simply changing the bus width
from 16 bits to 32 bits and the speed from 66 MHz to 100 MHz in our example allows for
three times as much data (400 million bytes versus 132 million bytes) to pass through to the CPU
every second for processing.

Cache Memory
Even with a wide and fast bus, it still takes longer for data to get from the memory card to the
CPU than it takes for the CPU to actually process the data. Caches are designed to alleviate this
bottleneck by making the data that is used most often by the CPU instantly available. This is
accomplished by building a small amount of memory, known as primary or level 1 cache, right
into the CPU. Level 1 cache is very small, e.g. 384 KB L1 cache for the Intel i7 Hexa core.

The secondary or level 2 cache typically resides on a memory card located near the CPU with a
direct connection to the CPU. A dedicated integrated circuit on the motherboard, the L2
controller, regulates the use of the level 2 cache by the CPU. e.g. 1.5 MB L2 cache for the
Intel i7 Hexa core. In most systems, data needed by the CPU is accessed from the cache
approximately 95 percent of the time, greatly reducing the overhead needed when the CPU has to
wait for data from the main memory.

81
Some inexpensive systems dispense with the level 2 cache altogether. Many high performance
CPUs now have the level 2 cache actually built into the CPU chip itself as well as a level 3
cache. Therefore, the size of the level 2 cache and whether it is onboard (on the CPU) is a major
determining factor in the performance of a CPU.

e.g. 12 MB L3 cache for the Intel i7 Hexa core.

CPU Memory Access Hierarchy Chart. Level 3 cache is now common.

How Caching Operates

A particular type of RAM, static random access memory (SRAM), is used primarily for cache.
SRAM uses multiple transistors, typically four to six, for each memory cell. It has an external
gate array known as a bistable multivibrator that switches, or flip- flops, between two states. This
means that it does not have to be continually refreshed like DRAM. Each cell will maintain its
data as long as it has power. This means SRAM can operate extremely quickly, significantly
faster than dynamic RAM. However, the complexity of each cell means it takes up a lot more
space on a chip and makes it prohibitively expensive for use as standard RAM.

NOTE: Static RAM is fast and expensive, and dynamic RAM is less expensive and slower. Thus static
RAM is used to create the CPU's speed-sensitive cache, while dynamic RAM forms the larger
system RAM space.

Some principles of cache operation are as follows:

1. Cache technology is the use of a faster but smaller memory type to accelerate a slower
but larger memory type, such as RAM.
2. When using a cache, you must check the cache to see if an item is in there. If it is there,
it’s called a cache hit. If not, it is called a cache miss and the computer must wait for a
round trip from the larger, slower main memory area.
3. A cache has some maximum size that is much smaller than the larger main memory
storage area.
4. It is possible to have multiple cache layers. In a one-level cache, the Level 1 cache
is first checked, if there is a miss, the RAM is searched. In a two-level cache the Level 1
cache is first checked, if there is a miss, the Level 2 cache is checked, if there is a miss,
the RAM is searched.
5. Cache is populated using a concept called locality of reference. It means that in a fairly
large program, only small portions are ever used at any one time. Even if an executable is
10 MB in size, only a handful of bytes from that program are in use at any one time, and
their rate of repetition is very high.
Registers

The final step in memory hierarchy are the registers. These are memory cells built right into
the CPU that contain specific data needed by the CPU, particularly the arithmetic and logic unit
(ALU). An integral part of the CPU itself, they are controlled directly by the compiler that sends
information for the CPU to process.

BIOS

The basic input-output system (BIOS) is the first thing you see when you turn on your
computer. The BIOS is special software that interfaces the major hardware components of your
computer with the operating system. It is usually stored on a Flash memory chip on the
motherboard (which has its own battery), but sometimes the chip is another type of ROM.

The BIOS chip and the BIOS setup Utility program

The BIOS software has a number of different roles, but its most important role is to load the
operating system. When you turn on your computer and the microprocessor tries to execute its
first instruction, it has to get that instruction from somewhere. It cannot get it from the operating
system because the operating system is located on a hard disk, and the microprocessor cannot get
to it without some instructions that tell it how. The BIOS provides those instructions. Some of the
other common tasks that the BIOS performs includes:

i. A power-on self-test (POST) for all of the different hardware components in the system to
make sure everything is working properly.
ii. Activating other BIOS chips on different cards installed in the computer e.g. SCSI
and graphics cards often have their own BIOS chips.
iii. Providing a set of low-level routines that the operating system uses to interface to
different hardware devices - it is these routines that give the BIOS its name. They manage
things like the keyboard, the screen, and the serial and parallel ports, especially when the
computer is booting.
iv. Managing a collection of settings for the hard disks, clock, etc.

Boot-Up Process
A PC cannot do anything useful unless it is running its operating system - software that acts as
a supervisor for all its software applications. It sets the rules for using memory, drives, and other
hardware devices on the computer. Before a PC can run the operating system, it needs some way
to load it from disk into RAM. The way to do this is with the bootstrap - a small amount of
code that is executed on startup or system boot. The bootstrap is aptly named because it lets the
PC do something entirely on its own, without any outside operating system. The boot-up
sequence of events is as follows:

i. The computer loads the basic input/output system (BIOS) from ROM. The BIOS
provides the most basic information about storage devices, boot sequence, security, Plug
and Play (auto device recognition) capability and a few other items.
ii. The BIOS triggers a test called a power-on self-test (POST) to make sure all the major
components are functioning properly. You may hear your drives spin and see some LEDs
flash, but the screen, at first, remains black.
iii. The BIOS has the CPU send signals over the system bus to be sure all of the basic
components are functioning. The bus includes the electrical circuits printed on and into
the motherboard, connecting all the components with each other.
iv. The POST tests the memory contained on the display adapter and the video signals
that control the display. This is the first point you’ll see something appear on your PC’s
monitor.
v. During a cold boot the memory controller checks all of the memory addresses with a
quick read/write operation to ensure that there are no errors in the memory chips.
Read/write means that data is written to a bit and then read back from that bit. You should
see some output to your screen - on some PCs you may see a running account of the
amount of memory being checked.
vi. The computer loads the operating system (OS) from the hard drive into the system’s
RAM. That ends the POST and the BIOS transfers control to the operating system.
Generally, the critical parts of the operating system - the kernels - are maintained in RAM
as long as the computer is on. This allows the CPU to have immediate access to the
operating system, which enhances the performance and functionality of the overall
system.

Chipset

The PC has become so complex that even the most recent, powerful processors can’t do the
entire job of managing the flow of data by themselves. The CPU has been given help in the
form of the chip set, located nearby on the
motherboard. The chip set traditionally consisted of two
microchips, often referred to as the North Bridge and the
South Bridge, that acted as the administrators to the
CPU, or chief executive. The chip set bridged logical and
physical gaps between the CPU and other chips, all the time
watching and controlling the input and output of specific
components. The exact function of the chip set is
constantly changing.

In 2003 AMD introduced the AMD Athlon 64bit chip,


where the CPU reclaimed some of the memory
controller functions of the North Bridge. Intel later also
adopted this architecture with their core i-series of processors.

But in all cases, the bridges determine what kinds of memory, processors, and other components
can work with that particular motherboard. There is now a trend to replace the names North
Bridge and South Bridge with less elegant terms such as Graphics Memory Controller Hub
(GMCH) and the I/O Controller Hub (ICH), even though their basic purpose is the same.

Where a motherboard still has the older architecture you can distinguish the North Bridge
because it resides as close as possible to three other components that are connected to this chip:
the CPU, the memory, and the graphics port. Even though connections are at the speed of light,
their proximity on the motherboard does make a difference. When you’re counting in
nanoseconds (billionths of a second) ‘small differences’ are significant.

When the CPU needs data from RAM, it sends a request to the North Bridge memory controller.
The controller, in turn, sends the request along to memory and tells the CPU how long the
processor must wait to read the memory over a speedy connection called the front side bus
(FSB). The remaining connection of the North Bridge is to the South Bridge.

The South Bridge primarily handles the routing of traffic between the various input/output (I/O)
devices on the system for which speed is not vital to the total performance, such as the disk drives
(including RAID drive arrays), optical drives, PCI-Express devices, the older PCI bus, and the
USB, Ethernet, and audio ports. It is also responsible for less prominent input/output, such as the
real-time clock, interrupt controller, and power management. The remaining slowcoaches of the
computer - the keyboard, the serial ports, and the mouse - are handled by a separate device called
the SIO or super input/ output.

Motherboard with the North Bridge and South Bridge highlighted on an older motherboard
Z77 Motherboard – the i-series CPU has made the North Bridge chip obsolete.

Intel Z77 Express Chipset Block Diagram

PCI Bus
The Peripheral Component Interconnect (PCI) bus produced by Intel in 1992 provided direct
access to system memory for any connected hardware devices.

PCI slots on a motherboard.

This bus allowed multiple packets of information from different sources to travel down it
simultaneously. Previously it was used to connect to the graphics card and this setup meant
that information from the graphics card travelled through the bus along with any other
information coming from a device connected to the PCI. When all the information arrived at the
CPU, it had to wait in line to get time with the CPU. This system worked well for many years,
but eventually the PCI bus could not keep up. The Internet and most software were more and
more graphically oriented, and the demands of the graphics card needed priority over all other
PCI devices.

This is now a legacy technology and is used for functions that do not require great quantities or
speed in data transmissions. PCI slots were mainly used for network, graphics and sound cards.
PCI card showing the pins (4+2+24+10+8+2) and PCI bridge chip.

PCI cards use 47 pins to attach to a PCI slot. Pins are thin metal feet that allow computer chips
to be attached to a circuit board. AGP replaced the PCI as the standard way to connect a graphics
card to the motherboard.

AGP Bus

In 1996, Intel introduced AGP as a more efficient way to deliver streaming video and real-time-
rendered 3-D graphics that were becoming more prevalent in all aspects of computing to and
from the CPU. Previously, the standard method of delivery was the PCI bus.

an AGP based graphics card.

AGP is based on the design of the PCI bus; but unlike a bus, it provides a dedicated point-to-
point connection from the graphics card to the CPU. With a clear path to the CPU and system
memory, AGP provided a much faster, more efficient way for a computer to get the information
it needed to render complex graphics. An AGP, or accelerated graphics port, allowed the
operating system to designate RAM for use by the graphics card on the fly.

AGP started with a bandwidth of 266 MB/s; AGP 2x -> 533 MB/s; AGP 4x -> 1066 MB/s; AGP
8x -> 2133 MB/s. However, AGP then became overtaken by the newer PCI-Express slots, which
come in several denominations to make them the do-all, fit-all slot for every expansion board, not
just graphics.

PCI Express 1.0 Bus

PCI Express or PCIe began to appear in 2004 and eliminates the need for the AGP by accepting
more data and supplying more power to video cards. By early 2006, most motherboards featured
PCI x16 slots (4,000MB/s) in place of AGP 8x. The shorter ones (shown below) are xl PCIe slots
and are common to all PCI Express slots. PCI-Express slots will also accept older PCI cards.
To handle graphics and sound data faster, the PCIe slot can be expanded to x2, x4, x8, or, x16
slots, where the numbers represent multiples of the speed of an xl PCIe slot. Their ability to move
data is indicated by the multiplier factor in their designations.
New computer applications, such as streaming video and photo editing, put new demands on PCs
to move vast amounts of data ever quicker. Even the fastest of them, AGP 8x, which spewed out
2.133 GB/s, was not good enough for the demands of real-time-photorealistic animation that
needs values for the colours of millions of pixels pushed through the circuits 60 times or more
each second. The solution is a bus architecture that uses both parallel and serial transfers.

Operation

A PCI-Express bus breaks all data (payload) it handles into pieces and wraps the pieces in a
packet. The packet includes other binary codes that identify where the information has come
from, its destination, its sequence among all the other packets being sent, and the results of a
cyclic redundancy check (CRC). A CRC is a mathematical operation that detects transmission
errors in the data e.g. 8b/10b means 8 bits of data transferred for every 10 bits sent.

A Packet and its constituents: Frame Number, CRC, Data (Payload), Header, Footer.

After subtracting the overhead for packet packaging, the basic PCI-Express x1 slot has a top
bandwidth of 250 Megabytes a second (MB/s). But PCI-E is scalable. Devoting two or more
lanes to send data to and from a single component - called channel bonding - increases the
bandwidth for each lane added to the channel. PCI-E transfers data at 250 MB/s in each direction
per lane. A lane is composed of two differential signaling pairs: one pair for receiving data, the
other for transmitting. Thus, each lane is composed of four wires or signal traces.

With a maximum of 32 lanes, PCI-E 1.0 allows for a total combined transfer rate of 8 GB/s in
each direction. That gives a single channel nearly twice the bandwidth of the older PCI and an
eight lane slot a data rate comparable to the fastest version of AGP. You can identify the
expansion slots with the increased bandwidth by comparing the slots’ lengths. The basic PCIe
x1 slot is about 24.5mm long. Each 13.5mm added to other slots represents another 250MB
added to their bandwidth.
PCI express x1, x4, x8 and x16 connector slots. x4 and x8 appear mainly in servers.

1. The chipset sends packets serially over two lines. Another pair of lines is responsible for
packets going in the opposite directions. Taken together, the two pairs are called a lane.
One of the lines in each pair carries the original signal. The other line carries a negative
image of the signal; each 0 becomes a 1 and each 1 becomes a 0 (differential signaling).
The lines are laid out so that any electrical noise, or static, that affects one line should also
affect the other.
2. When packets reach their destination, the receiver restores the negative packet to its
positive version. That same operation reverses the values of any junk signals introduced by
electrical interference. The bus combines the two paired packets, and any interference in the
original packet is cancelled by its negative image in the matching packet.
3. It also performs the same CRC operation that was performed on the packet before its
journey and compares its result to the earlier one bundled into the packet. If CRCs differ,
the bus orders the packet be re-sent. Since the sequence of the data in each packet is
included in the packet, the bus doesn't have to wait for the corrected packet. It can continue
to accept other packets and then put them all back in the correct order when all the packets
have been received.

PCI Express Bandwidth * Bandwidth ǂ Encoding Year Released

1.0 250MB/s (2 GB/s) 8b/10b 2002


2.0 500MB/s (4 GB/s) 8b/10b 2007
3.0 1000MB/s (~ 8 GB/s) 128b/130b 2010
* Per lane, in each direction ǂ Per 8 lanes, in each direction

IDE - ATA Interface


Usually, these devices connect to the computer through an Integrated Drive Electronics (IDE)
interface. Essentially, an IDE interface is a standard way for a storage device to connect to a
computer. IDE is actually not the true technical name for the interface standard. The original
name, AT Attachment (ATA) or parallel ATA, signified that the interface was initially
developed for the IBM AT computer. We will learn about the evolution of IDE/ATA, what the
pinouts are and exactly what “slave” and “master” mean in IDE.
a b

Figure a: A close-up of the primary and secondary IDE interfaces on a motherboard; Figure b: The connector on an
IDE cable, the stripe denotes where to align with Pin 1.

IDE quoted upper transfer rates of 133MB/s. Above that, crosstalk, or electrical interference,
from their 40-wire parallel cables drowns out meaningful communication.

Serial ATA (SATA)


Serial ATA was designed to replace the older parallel ATA (PATA) standard (often called by
the old name IDE), offering several advantages over the older interface:
i. reduced cable size (7 conductors compared to 40 with the wider PATA ribbon cable) -
which facilitates a more efficient airflow inside a form factor and also allows for smaller
chassis designs as well as a reduced cost,
ii. native hot swapping,
iii. faster data transfer through higher signaling rates, and
iv. more efficient transfer through an (optional) I/O queuing protocol.

The SATA standard defines a data cable with seven conductors (3 grounds and 4 active data
lines in two pairs of conductors) and 8 mm wide wafer connectors on each end. The three
grounding wires dampen any crosstalk. A SATA cable can have a length up to 1 metre (3.3 ft),
and connects one motherboard socket to one hard drive.

SATA Bandwidth Bandwidth (Actual) Year


1.0 1.5 Gbit/s 1.2 Gbit/s (150MB/s) 200
2.0 3 Gbit/s 2.4 Gbit/s (300MB/s) 200
3.0 6 Gbit/s 4.8 Gbit/s (600MB/s) 200
* 8b/10b encoding
Figure a: The 7-Pin SATA data cable (angled end); Figure b: The SATA data cable (angled and straight
ends); Figure c: The SATA connectors on the motherboard (straight); Figure d: The SATA Data
Connector Pinout; Figure e: The SATA connector on a hard drive (7 pin data connector on the left and 15
pin power connector on the right). Pins

SECTION TWO

Troubleshooting Techniques
One of the first steps in troubleshooting a computer problem (or any other programmable system
problem) is to determine whether the problem is due to a hardware failure or to faulty software. In
most PCs, you can use a significant event that occurs during the startup process as a key to
separate hardware problems from software problems: the single beep that most PCs produce
between the end of the power-on self-test (POST) and the beginning of the startup process. Errors
that occur, or are displayed, before this beep indicate that a hardware problem of some type
exists. Up to this point in the operation of the system, only the BIOS and the basic system
hardware have been active. The operating system side of the system does not come into play until
after the beep occurs.

If the system produces an error message (such as “The system has detected unstable RAM at
location x”) or a beep code before the single beep occurs, the system has found a problem with
the hardware. In this case, a bad RAM memory device is indicated.

Typically, if the startup process reaches the point at which the system’s CMOS configuration
exist in the system’s basic components. After this point in the bootup process, the system begins
loading drivers for optional devices and additional memory. If the error occurs after the CMOS
screen displays and before the bootup tone, you must clean boot the system and single-step
through the remainder of the bootup sequence.

Errors that occur before the beep can be grouped into two distinct categories:

i. Configuration errors
ii. Hardware failures
A special category of problems tends to occur when a new hardware option is added to the
system, or when the system is used for the very first time. These problems are called
configuration problems, or setup problems. These problems result from mismatches between the
system’s programmed configurations held in the CMOS memory and the actual equipment
installed in the system.

It is usually necessary to access the system’s CMOS setup utility in the following three situations:

i. When the system is first constructed.


ii. When it becomes necessary to replace the CMOS backup battery on the system board.
iii. When a new or different option is added to the system (such as memory devices, hard
drives, floppy drives, or video display), it might be necessary to access the setup utility to
accept the changes that have been implemented.

In most systems, the BIOS and operating system use plug-and-play techniques to detect new
hardware that has been installed in the system. These components work together with the device
to allocate system resources for the device. In some situations, the PnP logic is not able to resolve
all the system’s resource needs and a configuration error occurs. In these cases, the user must
manually resolve the configuration problem.

When you are installing new hardware or software options, be aware of the possibility of
configuration errors occurring. If you encounter configuration (or setup) errors, refer to the
installation instructions found in the new component’s installation/user documentation.

If you cannot confirm a configuration problem, you most likely have a defective component. The
most widely used repair method involves substituting known-good components for suspected bad
components. Other alternatives for isolating and correcting a hardware failure that appears before
the boot-up depend on how much of the system is operable. Normally, symptoms can be divided
into three sections: configuration problems, bootup problems, and operational problems.

The system’s configuration settings are normally checked first. It is important to observe the
system’s symptoms to determine in which part of the system’s operation the fault occurs. The
error messages described in Table 3.1 are errors that occur and are reported before the single beep
tone is produced at the end of the POST routines.

Table 1.0: Common Configuration Error Codes

After the beep tone has been produced in the startup sequence, the system shifts over to the
process of booting up and begins looking for and loading the operating system. Errors that occur
between the beep and the presentation of the operating system’s user interface (command prompt
or GUI) generally have three possible sources. These sources are summarized in the following list
that includes the typical error messages associated with each source.

i. Hardware failure (physical problem with the boot drive)


ii. General Failure Error Reading Drive X
iii. Corrupted or missing boot files
iv. Bad or Missing Command Interpreter
v. Non-system Disk or Disk Error
vi. Bad File Allocation Table
vii. Corrupted or missing operating system files

Both configuration problems and bootup problems can be caused by a hard- ware or operational
failure. If the configuration settings are correct, but these symptoms are present, a hardware
problem is indicated as the cause of the problem. Conversely, bootup problems are typically
associated with the operating system.

Hardware Troubleshooting Tools

The level of troubleshooting most often performed on PC hardware is exchanging Field


Replaceable Units (FRUs). Due to the relative low cost of computer components, it is normally
not practical to troubleshoot failed components to the IC level. The cost of using a technician to
diagnose the problem further, and repair it, can quickly exceed the cost of the new replacement
unit.

However, a few hardware diagnostic tools can be very helpful in isolating defective hardware
components. These tools include

i. Software diagnostic disk


ii. Multimeter
iii. Cable tester
iv. POST card

Software Diagnostic Packages


Several commercially available disk-based diagnostic routines can check the system by running
predetermined tests on different areas of its hardware. The diagnostic package evaluates the
response from each test and attempts to produce a status report for all of the system’s major
components. Like the computer’s self-tests, these packages produce visual and beep-coded error
messages. Figure 1.0 depicts the Main menu of a typical self-booting soft- ware diagnostic
package.
Figure 1.0 A typical software diagnostic main menu.

This menu is the gateway to information about the system’s makeup and configuration, as well as
the entryway to the program’s Advanced Diagnostic Test functions. You can find utilities for
performing low-level formats on older hard drive types and for managing small computer system
interface (SCSI) devices through this menu. In addition, options to print or show test results are
available here, as is the exit point from the program. The most common software-troubleshooting
packages test the system’s memory, microprocessor, keyboard, display monitor, and the disk
drive’s speed. If at least the system’s CPU, disk drive, and clock circuits are working, you might
be able to use one of these special software-troubleshooting pack- ages to help localize system
failures. They can prove especially helpful when trying to track down non-heat-related
intermittent problems.

If a diagnostic program indicates that multiple items should be replaced, replace the units one at a
time until the unit starts up. Then replace any units removed prior to the one that caused the
system to start. This process ensures that there are not multiple bad parts. If you have replaced all
the parts, and the unit still does not function properly, the diagnostic software is suspect.

Using a Multimeter in a PC
A number of test instruments can help you isolate computer hardware problems. One of the most
basic pieces of electronic troubleshooting equipment is the multimeter. These test instruments are
available in both analog and digital readout form and can be used to directly measure electrical
values of voltage (V), current in milliamperes (mA) or amperes (A), and resistance in ohms.
Therefore, these devices are referred to as VOMs (volt-ohm- milliammeters) for analog types, or
DMMs (digital multimeters) for digital types.

Figure 2.0 depicts a digital multimeter. With a little finesse, you can use this device to check
diodes, transistors, capacitors, motor windings, relays, and coils. This particular DMM contains
facilities built in to the meter to test transistors and diodes. These facilities are in addition to its
standard functions of current, voltage, and resistance measurement; however, in computer repair
work, only the voltage and resistance functions are used extensively.
Figure 2.0 A Digital Multimeter.

The first step in using the multimeter to perform tests is to select the proper function. For the most
part, you never need to use the current function of the multimeter when working with computer
systems; however, the voltage and resistance functions can be very valuable tools.

In computer troubleshooting, most of the tests are DC voltage readings. These measurements
usually involve checking the DC side of the power- supply unit. You can make these readings
between ground and one of the expansion-slot pins, or at the system board power-supply
connector. It is also common to check the voltage level across a system board capacitor to verify
that the system is receiving power. The voltage across most of the capacitors on the system board
is 5V (DC). The DC voltages that can normally be expected in a PC-compatible system are +12V,
+5V, –5V, and –12V. The actual values for these readings might vary by 5% in either direction.

NOTE: It is normal practice to first set the meter to its highest voltage range to be certain that the voltage
level being measured does not damage the meter.

The DC voltage function is used to take measurements in live DC circuits. It should be connected
in parallel with the device being checked. This could mean connecting the reference lead (black
lead) to a ground point and the measuring lead (red lead) to a test point to take a measurement, as
illustrated in Figure 3.0.

Figure 3.0 DC voltage check.

Failure to turn off the power when making resistance checks can cause serious damage to the
meter and can pose a potential risk to the technician. Resistance checks require that you
electrically isolate the component being tested from the system. For most circuit components, this
means de-soldering at least one end from the board.

The resistance check is very useful in isolating some types of problems in the system. One of the
main uses of the resistance function is to test fuses. You must disconnect at least one end of the
fuse from the system. You should set the meter on the 1k ohm resistance setting. If the fuse is
good, the meter should read near 0 ohms. If it is bad, the meter reads infinite.

The resistance function also is useful in checking for cables and connectors. By removing the
cable from the system and connecting a meter lead to each end, you can check the cable’s
continuity conductor by conductor to verify its integrity.

You also use the resistance function to test the system’s speaker. To check the speaker, simply
disconnect the speaker from the system and connect a meter lead to each end. If the speaker is
good, the meter should read near 8 ohms (although a smaller speaker might be 4 ohms). If the
speaker is defective, the resistance reading should be 0 for shorts or infinite for opens.

Only a couple of situations involve using the AC voltage function for checking microcomputer
systems. The primary use of this function is to check the commercial power being applied to the
power-supply unit. As with any measurement, it is important to select the correct measurement
range; how- ever, the lethal voltage levels associated with the power supply call for additional
caution when making such measurements.

The second application for the AC voltage function is to measure ripple volt- age from the DC
output side of the power-supply unit. This particular operation is very rarely performed in field-
service situations.

Cable Testers
The most frequent hardware-related cause of network problems involves bad cabling and
connectors. Several specialized, handheld devices designed for testing the various types of data
communication cabling are available. These devices range from inexpensive continuity testers, to
moderately priced data cabling testers, to somewhat expensive time domain reflectometers
(TDR).

Although inexpensive continuity testers can be used to check for broken cables, data cabling
testers are designed to perform a number of different types of tests on twisted-pair and coaxial
cables. These wiring testers normally consist of two units - a master test unit and a separate load
unit, as illustrated in Figure 4.0.

The master unit is attached to one end of the cable and the load unit is attached to the other. The
master unit sends patterns of test signals through the cable and reads them back from the load
unit. Many of these testers feature both RJ-45 and BNC connectors for testing different types of
cabling. When testing twisted-pair cabling, these devices can normally detect such problems as
broken wires, crossed-over wiring, shorted connections, and improperly paired connections.
Figure 4.0 Cable tester.

TDRs are sophisticated testers that can be used to pinpoint the distance to a break in a cable.
These devices send signals along the cable and wait for them to be reflected. The time between
sending the signal and receiving it back is converted into a distance measurement. The TDR
function is normally packaged along with the other cable testing functions just described. TDRs
used to test fiber-optic cables are known as optical time domain reflectometers (OTDRs).

POST Cards
A POST card is a diagnostic device that plugs into the system’s expansion slot and tests the
operation of the system as it boots up. These cards can be as simple as interrupt and direct
memory access (DMA) channel monitors, or as complex as full-fledged ROM BIOS diagnostic
packages that carry out extensive tests on the system.

POST cards are normally used when the system appears to be dead, or when the system cannot
read from a floppy or hard drive. The firmware tests on the card replace the normal BIOS
functions and send the system into a set of tests. The value of the card lies in the fact that the tests
can be carried out without the system resorting to software diagnostics located on the hard disk or
in a floppy drive.

The POST routines located in most BIOS chips report two types of errors (fatal and nonfatal). If
the POST encounters a fatal error, it stops the system. The error code posted on the indicator
corresponds to the defective operation.

If the POST card encounters a nonfatal error, however, it notes the error and continues through
the initialization routine to activate as many additional system resources as possible. When these
types of errors are encountered, the POST card must be observed carefully because the error code
on its indicator must be coordinated with the timing of the error message or beep code produced
bythe BIOS routines.

Simple POST cards come with a set of light-emitting diodes (LEDs) on them that produce coded
error signals when a problem is encountered. Other cards produce beep codes and seven-segment
LED readouts of the error code. Figure 5.0 depicts a typical XT/AT-compatible POST card.
Figure 5.0 A typical POST card.

Troubleshooting Power-Supply Problems

Typical symptoms associated with power-supply failures include the following:

i. No indicator lights are visible, with no disk drive action and no display on the screen.
Nothing works, and the system is dead.
ii. The On/Off indicator lights are visible, but there is no disk drive action and no display on
the monitor screen. The system fan might or might not run.
iii. The system produces a continuous beep tone.

Checking Dead Systems

Special consideration must be taken when a system is inoperable. In a totally inoperable system,
there are no symptoms to give clues where to begin the isolation process. In addition, it is
impossible to use troubleshooting software or other system aids to help isolate the problem.

When the system exhibits no signs of life - including the absence of lights - the best place to start
looking for the problem is at the power supply. The operation of this unit affects virtually every
part of the system. Also, the absence of any lights working usually indicates that no power is
being sup- plied to the system by the power supply.

1. Check the external connections of the power supply. This is the first step in checking any
electrical equipment that shows no signs of life.
2. Confirm that the power supply cord is plugged into a functioning outlet.
3. Verify the position of the On/Off switch.
4. Examine the power cord for good connection at the rear of the unit.
5. Check the setting of the 110/220 switch setting on the outside of the power supply. The
normal setting for equipment used in the United States is 110.
6. Check the power at the commercial receptacle using a voltmeter, or by plugging in a lamp
(or other 110-volt device) into the outlet.

NOTE: Before changing any board or connection, always turn the system off first. In an ATX- style system, you
should also disconnect the power cable from the power supply. This is necessary because even with the
power switch off, some levels of voltages are still applied to the system board in these units.
Other Power-Supply Problems

The absence of the lights and the fan operation indicate that power is not reaching the system
and that at least some portion of the power supply is not functional. This type of symptom
results from the following two likely possibilities:

1. A portion of the power supply has failed, or is being overloaded. One or more of the
basic voltages supplied by the power supply is missing while the others are still present.
2. A key component on the system board has failed, preventing it from processing even
though the system has power. A defective capacitor across the power input of the
system board can completely prevent it from operating.
The DC voltages that can normally be expected in an ATX PC-compatible system are +3.3V,
+12V, +5V, –5V, and –12V. The actual values for these readings might vary by 5% in either
direction. The black wires in the power supply/system board connection are the ground
reference wires. Figure 6.0 illustrates the correct measurement of voltages at this connector.

Figure 6.0 Measuring system board voltages.

Troubleshooting the System Board


The microprocessor, RAM modules, ROM BIOS, and CMOS battery are typically replaceable
units on the system board. If enough of the system is running to perform tests on these units, you
can replace them.
Problems with key system board components produce symptoms similar to those described for a
bad power supply. Both the microprocessor and the ROM BIOS can be sources of such problems.
You should check both by substitution when dead system symptoms are encountered but the
power supply is good.

System Board Symptoms

Typical symptoms associated with system board hardware failures include the following:

i. The On/Off indicator lights are visible and the display is visible on the monitor screen,
but there is no disk drive action and no bootup occurs.
ii. The On/Off indicator lights are visible and the hard drive spins up, but the system
appears dead and there is no bootup.
iii. The system locks up during normal operation.
iv. The system produces a beep code with one, two, three, five, seven, or nine beeps (BIOS
dependent).
v. The system produces a beep code of one long and three short beeps (BIOS dependent).
vi. The system does not hold the current date and time.
vii. A DMA Error message displays, indicating a DMA controller failed page register test.
viii. A CMOS Battery Low message displays, indicating failure of the CMOS battery or the
CMOS checksum test.
ix. A CMOS Checksum Failure message displays, indicating that the CMOS battery is low
or a CMOS checksum test failure.
x. A 201 error code displays, indicating a RAM failure.
xi. A Parity Check error message displays, indicating a RAM error.

Typical symptoms associated with system board CMOS setup failures include the following:

i. A CMOS inoperational message displays, indicating failure of CMOS shutdown register.


ii. A CMOS Memory Size Mismatch message displays, indicating a system configuration
and setup failure.
iii. A CMOS Time & Date Not Set message displays, indicating a system configuration and
setup failure.

Typical symptoms associated with system board I/O failures include the following:

i. The speaker doesn’t work during operation. The rest of the system works, but no sounds
are produced through the speaker.
ii. The keyboard does not function after being replaced with a known-good unit.

Configuration Problems
Configuration problems typically occur when the system is being set up for the first time, or when
a new option has been installed. The values stored in CMOS must accurately reflect the
configuration of the system; otherwise, an error occurs. Incorrectly set CMOS parameters cause
the corresponding hardware to fail. Therefore, check the enabling functions of the advanced
CMOS settings as a part of every hardware configuration troubleshooting procedure.
The many configuration options available in a modern BIOS require the user to have a good deal
of knowledge about the particular function being con- figured. In cases in which you have serious
configuration circumstances, don’t forget that you normally have the option to select default
configuration options through the CMOS setup utility.

Typically, if the bootup process reaches the point at which the system’s CMOS configuration
information is displayed onscreen, you can safely assume that no hardware configuration conflicts
exist between the system’s basic components. After this point in the bootup process, the system
begins loading drivers for optional devices and additional memory.

If errors occur after the CMOS screen has been displayed and before the bootup tone, you must
clean boot the system and single-step through the remainder of the bootup sequence to locate the
cause of the failure.

Microprocessors
In the event of a microprocessor failure, the system might issue a slow single beep from the
speaker along with no display or other I/O operation. This indicates that an internal error has
disabled a portion of the processor’s internal circuitry (usually the internal cache). Internal
problems can also allow the microprocessor to begin processing, but then fail as it attempts
additional operations. Such a problem results in the system continuously counting RAM during
the bootup process. It might also lock up while counting RAM. In either case, the only way to
remedy the problem is to replace the micro- processor.

If the system consistently locks up after being on for a few minutes, this is a good indication that
the microprocessor’s fan is not running or that some other heat buildup problem is occurring. You
also should check the micro- processor if its fan has not been running, but the power is on. This
situation might indicate that the microprocessor has been without adequate ventilation and has
overheated. When this happens, you must replace the fan unit and the microprocessor. Verify that
the new fan works correctly; otherwise, a second microprocessor will be damaged.

Microprocessor Cooling Systems


Microprocessor-based equipment is designed to provide certain performance levels under
specified environmental conditions such as operating temperature. Using Pentium class
microprocessors, PC systems are designed to maintain the operating temperature of the device in
the range of 30 to 40 degrees C.
The ideal operating temperature setting varies between microprocessor types and manufacturers.
Also, the location of the CMOS configuration set- ting varies between different BIOS makers and
versions. Some CMOS setup utilities provide a separate Hardware Health configuration screen,
whereas others integrate it into the Power Management screen. Many systems include an
additional fan control circuit for use with an optional chassis (case) fan. In these cases, the system
board features additional BERG connectors for the chassis temperature sensor and fan control
cable.

If temperature-related problems like those described in the preceding section occur, you should
access the CMOS Hardware Health configuration screen, similar to the one depicted in Figure 7.0
and check the fan speed and processor temperature readings.

If these readings are outside of the designated range, you can enter a different value for the
temperature set point. If no fan speed measurement is being shown, check to see if the fan is
actually turning. If not, you should turn the system off as soon as possible, check the operation of
the fan, and replace it before the microprocessor is damaged.

Figure 7.0 The CMOS Hardware Health configuration screen.


Other alternatives when dealing with thermal problems in a PC include installing an additional
chassis fan to help move cooler air through the system unit, changing the microprocessor fan for
one that runs faster over a given range of temperatures, and flashing the BIOS to provide different
fan control parameters.

Check for missing slot covers that can disrupt airflow in the case and route internal signal cables
so that they do not block the flow of air through the case. Likewise, check the case’s front cover
alignment as well as any upper or side access panels to ensure they are well fitted. If the airflow
openings in the front cover are blocked, the system fans cannot properly circulate air though the
case.

If the front panel or any of the access doors or covers are not in proper position, they could create
alternate airflow paths that disrupt the designed cooling capabilities of the system. In addition to
disrupting the designed airflow capabilities of the case, missing or misaligned case panels can
permit radio frequency interference (RFI) signals to escape from the case and disrupt the
operation of other electronic devices, such as radio receivers and televisions.

RAM
The system board RAM is a serviceable part of the system board. RAM failures basically fall into
two major categories and create two different types of failures:
i. Soft-memory errors - Errors caused by infrequent and random glitches in the operation of
applications and the system. You can clear these events just by restarting the system.
ii. Hard-memory errors - Permanent physical failures that generate NMI errors in the system
and require that the memory units be checked by substitution.

Observe the bootup RAM count on the display to verify that it is correct for the amount of
physical RAM actually installed in the system. If not, swap RAM devices around to see whether
the count changes. Use logical rotation of the RAM devices to locate the defective part. The burn-
in tests in most diagnostic packages can prove helpful in locating borderline RAM modules.

You can also swap out RAM modules one at a time to isolate defective modules. When swapping
RAM into a system for troubleshooting purposes, take care to ensure that the new RAM is of the
correct type for the system and that it meets its bus speed rating. Also, ensure that the replacement
RAM is consistent with the installed RAM. Mixing RAM types and speeds can cause the system
to lock up and produce hard-memory errors.

ROM
A bad or damaged ROM BIOS typically stops the system completely. When you encounter a
dead system board, examine the BIOS chip for physical damage. If these devices overheat, it is
typical for them to crack or blow a large piece out of the top of the IC package. Another symptom
pointing toward a damaged BIOS involves the bootup sequence automatically moving into the
CMOS configuration display, but never returning to the bootup sequence. In any case, you must
replace the defective BIOS with a version that matches the chipset used by the system.

In situations in which new devices (for example, microprocessors, RAM devices, hard drives)
have been added to the system, there is always a chance that the original BIOS cannot support
them. In these situations, the system might or might not function based on which device has been
installed and how its presence affects the system. To compensate for these possible problems,
always check the websites of the device and the system board manufacturers to obtain the latest
BIOS upgrade and support information.

CMOS Batteries

The second condition that causes a configuration problem involves the system board’s CMOS
backup battery. If a system refuses to maintain time and date information, the CMOS back- up
battery or its recharging circuitry is normally faulty. After the backup battery has been replaced,
check the contacts of the battery holder for corrosion.

If the battery fails, or if it has been changed, the contents of the CMOS con- figuration are lost.
After replacing the battery, it is always necessary to access the CMOS setup utility to reconfigure
the system.

Troubleshooting Keyboard Problems


Most of the circuitry associated with the computer’s keyboard is located on the keyboard itself.
However, the keyboard interface circuitry is located on the system board. Therefore, the steps
required to isolate keyboard problems are usually confined to the keyboard, its connecting cable,
and the system board.

Keyboard Symptoms

Typical symptoms associated with keyboard failures include the following:

i. No characters appear onscreen when entered from the keyboard.


ii. Some keys work, whereas others do not work.
iii. A Keyboard Error - Keyboard Test Failure error appears.
iv. A KB/Interface Error - Keyboard Test Failure error appears.
v. An error code of six short beeps is produced during bootup (BIOS dependent).
vi. The wrong characters are displayed.
vii. An IBM-compatible 301 error code appears.
viii. An Unplugged Keyboard error appears.
ix. A key is stuck.

Basic Keyboard Checks

The keys of the keyboard can wear out over time. This might result in keys that don’t make good
contact (no character is produced when the key is pressed) or that remain in contact (stick) even
when pressure is removed. The stuck key produces an error message when the system detects it;
how- ever, it has no way of detecting an open key.

An unplugged keyboard, or one with a bad signal cable, also produces a key- board error message
during startup. Ironically, this condition might produce a configuration error message that says
“Press F1 to continue.” If the keyboard produces odd characters on the display, check the
Windows keyboard settings in Device Manager. Device Manager is located under the System
icon (found in Control Panel) in Windows 9x and Windows Me. In Windows 2000, the path is
similar - Control Panel, System, Hardware tab. However, in both Windows 2000 and Windows
XP, Device Manager is usually accessed through the Computer Management console. If the
keyboard is not installed or is incorrect, install the correct keyboard type. Also, be certain that you
have the correct language setting specified in the Keyboard Properties dialog box (found by
double-clicking the Keyboard icon in Control Panel).
Keyboard Hardware Checks

If you suspect a keyboard hardware problem, isolate the keyboard as the definite source of the
problem (a fairly easy task). Because the keyboard is external to the system unit, detachable, and
inexpensive, simply exchange it with a known-good keyboard.

If the new keyboard works correctly, remove the back cover from the faulty keyboard and check
for the presence of a fuse in the +5V DC supply and check it for continuity. Neither the older
five-pin DIN nor the six-pin PS/2 mini-DIN keyboards can be hot-swapped. Disconnecting or
plugging in a keyboard that has this type of fuse while power is on can cause the keyboard to fail.
If the fuse is present, simply replace it with a fuse of the same type and rating.

If replacing the keyboard does not correct the problem, and no configuration or software reason is
apparent, the next step is to troubleshoot the keyboard receiver section of the system board. On
most system boards, this ultimately involves replacing the system board.

Troubleshooting Mouse Problems

Most problems with mice are related either to its port connection, the mouse driver, the trackball
in a trackball mouse or a trackball unit, and the operation of the mouse buttons.

In newer systems, the mouse is typically connected to the USB port or the dedicated PS/2 mouse
port on the back of the unit. In ATX systems, the keyboard and mouse have been given the same
six-pin mini-DIN connector and, unfortunately, they do not work interchangeably. Although
plugging the mouse into the keyboard connector should not cause any physical damage, it does
cause problems with getting the system to work. These connections tend to be colour-coded so
you can check to ensure the mouse is connected to the green connector.

For PnP-compatible mice, installation and configuration has become a fairly routine process.
Connect the mouse to the PS/2 mouse port and let the system autodetect it and install the basic
Windows mouse drivers.

However, specialty mice - including USB-connected mice, wireless mice, and infrared mice -
along with other pointing devices might require special drivers that are supplied by the
manufacturer and loaded from the disk or disc that accompanies the device. Older serial mice
used one of the PC’s serial ports as their interface. These ports had to be properly configured for
the serial mouse to work properly.

When a trackball mouse is moved across the table, the trackball picks up dirt or lint, which can
hinder the movement of the trackball, typically evident by the cursor periodically freezing and
jumping onscreen. On most mice, you can remove the trackball from the mouse by a latching
mechanism on its bot- tom. Twisting the latch counter clockwise enables you to remove the track-
ball. Then, you can clean dirt out of the mouse.

The other mechanical part of the mouse is its buttons. These items can wear out under normal use.
When they do, the mouse should simply be replaced. However, before doing so, check the
Properties of the mouse in the operating system to ensure that the button functions have not been
altered. It would be a shame to throw away a perfectly good mouse because it had been set up for
left-hand use in the operating system.
Mouse Hardware Checks
The hardware check for the mouse involves isolating it from its host port. Simply replace the
mouse to test its electronics. If the replacement mouse works, the original mouse is probably
defective. If its electronics are not working properly, few options are available for actually
servicing a mouse. It might need a cleaning, or a new trackball. However, the low cost of a
typical mouse generally makes it a throwaway item if simple cleaning does not fix it.

If the new mouse does not work either, chances are good that the mouse’s electronics are working
properly. In this case, the mouse driver or the port hardware must be the cause of the problem. If
the driver is correct for the mouse, the port hardware and CMOS configuration must be checked.

The system board typically contains all of the port hardware electronics and support so it must be
replaced to restore the port/mouse operation at that port. However, if the system board mouse port
is defective, another option is to install a mouse that uses a different type of port (for example,
use a USB mouse to replace the PS/2 mouse).

Mouse Configuration Checks


When a mouse does not work in a Windows system, restart it and move into safe mode by
pressing the F5 function key while the “Starting Windows” message is displayed. This starts the
operating system with the most basic mouse driver available. If the mouse does not operate in
safe mode, you must check the mouse hardware and the port to which the mouse is connected.

If the mouse works in safe mode, the problem exists with the driver you are trying to use with it.
It might be corrupt or it could be having a conflict with some other driver. To check the driver,
consult Device Manager. If Device Manager shows a conflict with the mouse, remove the driver
and allow the system’s PnP process to reinstall it.

If the correct driver for the installed mouse is not available, you must install one from the
manufacturer. This typically involves placing the manufacturer’s driver disk or disc in the
appropriate drive and loading the driver using the Update Driver (requires disk from original
equipment manufacturer [OEM]) option on the Device Manager Mouse Properties page. If the
OEM driver fails to operate the mouse in Windows, you should contact the mouse manufacturer
for an updated Windows driver.

Troubleshooting Video
Figure 8.0 depicts the components associated with the video display. As the figure indicates, in
the case of hardware problems, the components involved include the video adapter card, the
monitor, and, to a lesser degree, the system board.
Figure 8.0 Video-related components

Common symptoms associated with display problems include the following:

i. There is no display.
ii. The wrong characters are displayed onscreen.
iii. Diagonal lines appear onscreen (no horizontal control).
iv. The display scrolls (no vertical control).
v. An error code of one long and six short beeps is produced by the system (BIOS
dependent).
vi. A CMOS Display Mismatch - Failure to Verify Display Type error displays.
vii. An error code of one long and two short beeps indicates a display adapter problem
(BIOS dependent).
viii. Characters are fuzzy.

Video Hardware Checks


The video monitor should come on fairly soon after power has been applied to it. With newer
monitors, the monitor is normally only asleep and is awakened through the video adapter card
when power is applied to the system. When the system is shut down, the monitor’s circuitry
senses that no signal is present from the video adapter card and slips into a monitoring mode
as long as its power switch is left in the On position.

If the monitor does not wake up early in the system’s startup process and present a display,
you should assume there is some type of hardware problem - the bootup action and operating
system have not been introduced to the system before the single beep tone is produced.
However, video problems that occur after the single beep are more likely to be related to
operating system configuration settings.

Check the monitor’s On/Off switch to see that it is in the On position. Also, check its power
cord to see that it is either plugged into the power supply’s monitor outlet, or into an active
120V (AC) commercial outlet. In addition, check the monitor’s intensity and contrast controls
to ensure that they are not turned down.
Determine which of the video-related components is involved. On some monitors, you can do
this by just removing the video signal cable from the adapter card. If a raster appears onscreen
with the signal cable removed, the problem is probably a system problem, and the monitor is
good. If the monitor is an EPA-certified Energy Star-compliant monitor, this test might not
work. Monitors that possess this power-saving feature revert to a low-power mode when they
do not receive a signal change for a given period of time.

Exchange the monitor for a known-good one of the same type (that is, VGA for VGA). If there
is still a video problem, exchange the video controller card with a known-good one of the
same type.

Other symptoms that point to the video adapter card include a shaky video display and a high-
pitched squeal from the monitor or system unit. If the system still does not perform properly, the source
of the problem might be in the system board.

If you can read the contents of the display through the startup process, but then cannot see it
after the system boots up, you have an operating system-related video problem. If the Windows
video problem prevents you from working with the display, restart the system, press the F8
function key when the “Starting Windows” message appears, and select the Safe Mode option.
This should load Windows with the standard 640 × 480 × 16– colour VGA driver (the most
fundamental driver available for VGA monitors), and should furnish a starting point for
installing the correct driver for the monitor being used.

After you have gained access to a usable display, check the installed video drivers. You can
access the Windows video information through Device Manager. From this utility, select the
Display Adapters entry from the list and double-click the monitor icon that appears as a
branch.

The adapter’s Properties dialog box should open. The Driver tab reveals the driver file in use.
If the video driver listed is not correct, reload the correct driver. Selecting the Resources tab
displays the video adapter’s register address ranges and the video memory address range, as
shown in Figure 9.0. You can manipulate these settings manually by clearing the Use
Automatic Settings check box and then clicking the activated Change Settings button. You
also can obtain information about the monitor through the System icon.

Figure 9.0 Video adapters resources.


You can also gain access to the Windows video information by double- clicking the Display
icon found in Control Panel. Of particular interest is the Settings tab. In Windows 95, the
Change Display Type button on this tab provides access to both the adapter type and monitor
type settings. In Windows 98 and Windows Me, the Advanced button on the Settings tab
provides access to both the adapter type and monitor type settings through the Adapter and
Monitor tabs.

In Windows 95, the Adapter Type window provides information about the adapter’s
manufacturer, version number, and current driver files. Clicking the Change button beside this
window brings a listing of available drivers from which to select. You also can use the Have
Disk button with an OEM disk to install video drivers not included in the list. You also can
alter the manner in which the list displays by enabling the Show Compatible Devices or the
Show All Devices options.

In Windows 98 and Windows Me, the information about the video adapter card is located on
the Adapter Tab. Clicking the Change button on this tab produces a wizard that guides the
process for changing the drivers for the card. The first option provided by the wizard is to
allow Windows to search for the correct driver, or for the user to specify a driver from a list
of available drivers. You can also use the Have Disk button to install video drivers from an
OEM disk.

If the video problem disappears when lower settings are selected, but reap- pears when a
higher resolution setting is used, refer to the colour Palette box on the Display Properties,
Settings tab, and try the minimum colour settings. If the problem goes away, contact the
Microsoft Download Library (MSDL) service or the adapter card maker for a compatible
video driver. If the video problem persists, reinstall Windows. If the video is distorted or
rolling, try an alternative video driver from the list.

Some display problems might be caused by incorrectly set front panel display settings. The
monitor’s front panel controls (either analog or digital) establish parameters for brightness,
contrast, screen size and position, and focus. Typical problems associated with these controls
include fuzzy characters, poor or missing colours, and incomplete displays.

Actually, there can be several causes of fuzzy characters on the display. The first step in
checking out this problem is to reset the display resolution to standard VGA values. If the
fuzzy characters remain, check the intensity and contrast controls to see if they are out of
adjustment.

Finally, you might need to remove built-up electromagnetic fields from the screen through a
process called degaussing. This can be done using a commercial degaussing coil. However,
newer monitors have built-in degaussing circuits that can be engaged through their front
panel controls. These monitors normally perform a degauss operation each time they are turned
on; however, sometimes the user might need to perform this operation.

The front panel controls can also be used to adjust the Red/Green/Blue colour mixture for the
display. If the monitor is showing poor colours, or only one colour, examine the colour settings
using the front panel controls. If these settings are responsive to change, the problem exists in
either the video adapter or the signal cable (broken or bad pin or conductor) or the monitor’s
colour circuitry is deteriorating.

NOTE: You should never remove the outer shell from a CRT video monitor unless you are trained to work
inside the case and it is part of your job. There are very lethal voltage levels (in excess of 25,000
volts) inside the monitor that can remain stored there for some time. Even if the monitor has been
unplugged for some time, it can still kill or severely injure you

Troubleshooting Floppy Disk Drives


Typical symptoms associated with floppy disk drive (FDD) failures during bootup include the
following:

i. FDD error messages are encountered during the bootup process.


ii. An IBM-compatible 6xx (such as, 601) error code is displayed.
iii. An FDD Controller error message displays, indicating a failure to verify the FDD setup by
the system configuration file.
iv. The FDD activity light stays on constantly, indicating that the FDD signal cable is
reversed.

Additional FDD error messages commonly encountered during normal system operation include
the following:

i. Disk Drive Read/Write/Seek error messages appear.


ii. The No Boot Record Found message appears, indicating that the system files in the disk’s
boot sector are missing or have become corrupt.
iii. The system stops working while reading a disk, indicating that the con- tents of the disk
have become contaminated.
iv. The drive displays the same directory listing for every disk inserted in the drive, indicating
that the FDD’s disk-change detector or signal line is not functional.

A number of things can cause improper floppy disk drive operation or failure. These items
include the use of unformatted disks, incorrectly inserted disks, damaged disks, erased disks,
loose cables, drive failure, adapter failure, system board failure, or a bad or loose power
connector.

Basic FDD Checks


If there is a problem booting the system, insert the bootable floppy disk in the new A drive and
turn on the system. If the system does not boot up to the floppy, examine the advanced CMOS
setup to check the system’s boot order. It might be set so that the FDD is never examined during
the bootup sequence.

If the system still does not boot from the floppy, check the disk drive cables for proper connection
at both ends. In many systems, the pin-1 designation is difficult to see. Reversing the signal cable
causes the FDD activity light to stay on continuously. The reversed signal cable also erases the
Master Boot Record (MBR) from the disk, making it non-bootable. Because this is a real
possibility, you should always use an expendable backup copy of the boot disk for
troubleshooting FDD problems.
If the system has a second floppy disk drive, turn it off and exchange the drive’s connection to the
signal cable so that it becomes the A drive. Try to reboot the system using this other floppy disk
drive as the A drive.

If there is a problem reading or writing to a particular disk, try the floppy disk in a different
computer to determine whether it works in that machine. If not, there is most likely a problem
with the format of the disk or the files on the disk. In the case of writing to the disk, you could be
dealing with a write-protected disk, but the system normally informs you of this when you
attempt to write to it. However, if the other computer can read and write to the disk, you must
troubleshoot the floppy drive hardware.

Hardware troubleshooting for floppy disk drives primarily involves exchanging the FDD unit for
another one that is working. If necessary, exchange the signal cable with a known-good one. The
only other option with most PC- compatible systems is to exchange the system board with a
known-good one.

Troubleshooting Hard Disk Drives

Typical symptoms associated with hard disk drive failures include the following:

i. The front panel indicator lights are visible, and the display is present on the monitor
screen, but there is no disk drive action and no bootup.
ii. The computer boots up to a system disk in the A drive, but not to the hard drive, indicating
that the system files on the hard disk drive (HDD) are missing or have become corrupt.
iii. The computer does not boot up when turned on.
iv. An IBM-compatible 17xx error code is produced on the display.
v. No motor sounds are produced by the HDD while the computer is running. (In desktop
units, the HDD should generally always run when power is applied to the system,
however, this does not apply to all desk- tops or portables when advanced power-saving
features are used.)
vi. A HDD Controller Failure message appears, indicating a failure to verify hard disk setup
by system configuration file error.
vii. A C: or D: Fixed Disk Drive error message appears, indicating a hard disk CMOS setup
failure.
viii. An Invalid Media Type message appears, indicating the controller can- not find a
recognizable track/sector pattern on the drive.
ix. A No Boot Record Found, a Non-system Disk or Disk Error, or an Invalid System Disk
message appears, indicating that the system boot files are not located in the root directory
of the drive.
x. The video display is active, but the HDD’s activity light remains on and no bootup occurs,
indicating that the HDD’s CMOS configuration information is incorrect.
xi. An Out of Disk Space message appears, indicating that the amount of space on the disk is
insufficient to carry out the desired operation.
xii. A Missing Operating System or a Hard Drive Boot Failure message appears, indicating
that the disk’s MBR is missing or has become corrupt.
xiii. A Current Drive No Longer Valid message appears, indicating that the HDD’s CMOS
configuration information is incorrect or has become corrupt.
HDD Configuration Checks
While booting up the system, observe the BIOS’s HDD type information displayed on the
monitor. Note the type of HDD that the BIOS recognizes as being installed in the system.
Possible error messages associated with HDD configuration problems include the Drive
Mismatch Error message and the Invalid Media Type message.

Check the drive to ensure that it is properly terminated. Every drive type requires a termination
block somewhere in the interface. For Integrated Drive Electronics (IDE) drives, check the
Master/Slave jumper setting to ensure it is set properly for the drive’s logical position in the
system. Remember that there can only be one master drive selection on each IDE channel. If both
drives share an interface and are set to the same selection, neither drive should work.

If you have more than one device attached to a single interface cable, be certain that they are of
the same type (for example, all are Enhanced Integrated Drive Electronics [EIDE] devices or all
are ATA100 devices). Mixing IDE device types creates a situation in which the system cannot
provide the different types of control information each device needs. The drives are incompatible
and you might not be able to access either device.

If the drive is a SCSI drive, check to see that its ID has been set correctly and that the SCSI chain
has been terminated correctly. Either of these errors results in the system not being able to see the
drive. Check the CMOS setup utility to ensure that SCSI support has been enabled along with
large SCSI drive support.

Basic HDD Checks


The first task is to determine how extensive the HDD problem is. Place a clean boot disk or an
emergency start disk in the A drive and try to boot the system. Then execute a DIR command to
access the C drive. If the system can see the contents of the drive, the boot files have been lost or
corrupted, but the architecture of the disk is intact.

Modify the DIR command with an /AH or /AS switch (that is, DIR C: /AH or DIR C: /AS) to
look in the root directory for the system files and the COMMAND.COM file. It is common to
receive a Disk Boot Failure message onscreen if this type of situation occurs.

In Windows 9x and Windows Me systems, if the clean boot disk has a copy of the FDISK
program on it, attempt to restore the drive’s MBR (including its partition information) by typing
the following:
A>FDISK /MBR

Providing that the hard disk can be accessed with the DIR command, type and enter the following
command at the DOS prompt (with the clean boot disk still in the A drive):
SYS C:

This command copies the IO.SYS, MSDOS.SYS, and COMMAND.COM system files from the
boot disk to the hard disk drive. Turn off the system, remove the boot disk from the A drive, and
try to reboot the system from the hard drive.
If the system cannot see the drive after booting from the floppy disk, an Invalid Drive message or
an Invalid Drive Specification message should be returned in response to any attempt to access
the drive. In Windows 9x systems, use the FDISK utility to partition the drive. Next use the
FORMAT /S command to make the disk bootable. Any data that was on the drive is lost in the
formatting process, but it was already gone because the system could not see the drive.

The process for checking the hard drive on a Windows NT, Windows 2000, or Windows XP
computer is similar to the one for checking a Windows 9x- based system. In Windows NT and
Windows 2000, the partitioning process is performed through the Disk Administrator and Disk
Management utilities, respectively. These utilities perform all of the basic functions that the
FDISK utility does. For instance, both utilities can be used to partition drives and both show you
the basic layout of the system’s disks.

These disk utilities can also provide advanced functions associated with enterprise (large-scale,
business-oriented) computing systems. The Disk Administrator and Disk Management utilities
can be used to create both traditional primary and extended partitions for MS-DOS/Windows 9x
systems or for Windows NT and Windows 2000 systems. They can also be used to create
volumes (partitions that involve space on multiple physical drives).

The Windows 2000 and Windows XP Disk Management snap-in, depicted in Figure 3.10, is
located under the Computer Management console. To access the Disk Management snap-in, click
Start, Settings, Control Panel, Administrative Tools. Double-click the Computer Management
icon, and then click the Disk Management entry. Because working with volumes is a major
administrative task, you must be logged on as an administrator or as a member of a Windows
2000 Administrators group to carry out this procedure.

HDD Hardware Checks


If you cannot access the hard disk drive, and its configuration settings are correct, you must
troubleshoot the hardware components associated with the hard disk drive. These components
include the drive, its signal cable, and the Hard Disk Controller (HDC) on the system board.

Check the HDD signal cable for proper connection at both ends. Exchange the signal cable for a
known-good one. Check the Master/Slave jumper set- tings to ensure they are set correctly.
Determine whether the system is using the Cable Select option. This setting enables the system to
dynamically assign the master/slave arrangements for multiple IDE drives. Likewise, check the
ID configuration settings and terminator installations for SCSI drives.

Although it might seem logical to replace the hard drive unit at this point, it is quite possible that
the hard drive might not have any real damage. It might have simply lost track of where it was,
and now it cannot find its starting point. In this case, the most attractive option is to reformat the
hard disk. This action gives the hard drive a new starting point from which to work.
Unfortunately, it also destroys anything that you had stored on the disk.

If the reformatting procedure is not successful, or the system still doesn’t boot from the hard
drive, replace the hard disk drive unit with a working one.
Troubleshooting CD-ROM Drives
The troubleshooting steps for CD-ROM and DVD drives are nearly identical to those of an HDD
system. The connections and data paths are very similar. Basically, three levels of troubleshooting
apply to CD-ROM problems. These are the configuration level, the operating system level, and
the hardware level.

Basic Checks
In most systems, the CD-ROM and DVD drives share a controller or host adapter with the hard
disk drive. Therefore, verify their Master/Slave jumper settings to ensure they are set correctly.
Normally, the CD-ROM or DVD drive should be set up as the master on the secondary IDE
channel. In this manner, each drive has its own communications channel and does not need to
share. If three or four IDE devices are installed in the system, you must determine which devices
can share the channels most effectively.

Windows Checks
In the Windows operating systems, you can access the contents of the CD- ROM or DVD through
the CD icon in the My Computer applet. The CD-ROM drive’s information is contained in the
System Properties dialog box, found by double-clicking the System icon in Control Panel. The
Properties of the installed CD-ROM drive are located on the Settings tab. Figure 10.0 shows a
typical set of CD-ROM specifications in Windows 9x.

Figure 10.0 CD-ROM specifications in Device Manager.

If the correct drivers are not installed, load them or contact the CD-ROM manufacturer for the
correct Windows driver. Check the system for old AUTOEXEC.BAT and CONFIG.SYS files
that could contain commands concerning older CD-ROM drives. These commands overrule the
Windows CD-ROM configurations and can create problems. Make a copy of the file for backup
purposes and remove the MSCDEX lines from the original file.
CD-ROM/DVD Hardware Checks
In many systems, the CD-ROM and DVD drives share a controller or host adapter with the hard
disk drive. Therefore, if the hard drive is working and the CD-ROM drive is not, the likelihood
that the problem is in the CD- ROM or DVD drive unit is very high.

Before entering the system unit, check for simple user problems:

i. Is there a CD or DVD in the drive?


ii. Is the label side of the disk facing upward?
iii. Is the disk a CD-ROM or some other type of CD?

If the drive is inoperable and a CD or DVD is locked inside, you should insert a straightened
paper clip into the tray-release access hole that’s usually located beside the ejection button. This
releases the spring-loaded tray and pops out the disc. If no simple reasons for the problem are
apparent, exchange the CD-ROM drive with a known-good one of the same type. If the new drive
does not work, check the drive’s signal cable for proper connection at both ends. Exchange the
signal cable for a known-good one.

Writable Drive Problems


An additional set of problems comes into play when a write or rewrite function is added to the
CD-ROM or DVD drive. These problems are concentrated in three basic areas:
i. The quality of the drive’s controller circuitry
ii. The makeup and version of the drive’s read/write application interface software
iii. Compatibility with the operating system’s multimedia support systems

The quality of the drive is based on the type of controller IC it has. In less expensive drives, the
BIOS extension on the drive might not support all of the R/W functions required to coordinate
with the application package or the operating system’s drivers. Although all newer CD-ROM and
DVD drives are ATAPI compatible, they might not have an effective method of controlling
Buffer Underrun errors. These errors occur when the system transfers data to the drive faster than
the drive can buffer and write it to the disc. The ATAPI compatibility of the chipset ensures that
the CD-ROM and DVD read functions work fine, but the nonstandard writing part of the drive
might not produce satisfactory results.

Techniques that can be used to minimize buffer underruns include placing the CD-ROM or DVD
writer on an IDE channel of its own. This keeps the drive from competing with other drives for
the channel’s available bandwidth. Also, conducting the write operation on the same drive as the
read operation and using reduced write speed options in the R/W software can minimize data flow
problems.

In addition, the R/W software for the drive might not be compatible with the operating system
version in use, or with the controller chip on the drive. Likewise, the operating system’s
multimedia enhancement drivers (DirectX in Windows operating systems) might not be
compatible with the controller or the R/W application.
Always consult the operating system’s hardware and software compatibility lists before buying
and installing a CD-RW or DVD-RW drive in a system. This typically means using a more
expensive drive, but for now, you do seem to get what you pay for when it comes to rewritable
drives.

If the drive has already been purchased, check its documentation for suggestions and check the
manufacturer’s website for newer R/W applications and driver versions. You might also be able
to locate a flash program for the drive’s BIOS to upgrade it so that it provides better support for
the write function.

Some CD-ROM and DVD R/W applications are simply incompatible with different drive BIOS
extension versions or DirectX versions. Check all of the parties involved to find a collection of
components that are all compatible with each other.

Troubleshooting Tape Drives


The basic components associated with the tape drive include the tape drive, the signal cable, the
power connection, the controller, and the tape drive’s operating software. The tape itself can be a
source of several problems. Common points to check with the tape include the following:

i. Is the tape formatted correctly for use with the drive-in question?
ii. Is the tape inserted securely in the drive?
iii. Is the tape write-protected?
iv. Is the tape broken or off the reel in the cartridge?

If any jumpers or switches are present on the controller, verify that they are set correctly for the
installation. Also, run a diagnostic program to check for resource conflicts that might be
preventing the drive from operating (such as interrupt request [IRQ] and base memory
addressing).

The software provided with most tape drives includes some error-messaging capabilities. Observe
the system and note any tape-related error messages it produces. Consult the user manual for
error-message definitions and corrective suggestions. Check for error logs that the software might
keep. You can view these logs to determine what errors have been occurring in the system.

Because many tape drives are used in networked and multiuser environments, another problem
occurs when you are not properly logged on, or enabled to work with files being backed up or
restored. In these situations, the operating system might not allow the tape drive to access secured
files, or any files, because the correct clearances have not been met. Consult the network
administrator for proper password and security clearances.

Troubleshooting Other Removable Storage Systems


Troubleshooting non-typical removable storage systems is very similar to troubleshooting an
external hard drive or tape drive. The system typically consists of an external unit with a plug-in
power adapter (anything with a motor in it typically requires an additional power source). These
units typically connect to the system through one of its standard I/O port connections. This
requires a signal cable that runs between the system and the device. Depending on the exact type
of storage device being used, it might have a removable media cartridge or container.
A device driver must be installed for the device to work with the system. This is typically a
function of the system’s PnP process. The system should detect the external storage and load the
driver for it automatically. If the system cannot locate the proper driver, it prompts you to supply
the location where the driver can be found. For the most part, external storage systems do not
need a support application to be installed. However, you should refer to the device’s
documentation and follow its installation procedures to determine whether the device can be
installed with just a driver.

Check the power supply at the external unit to ensure power is being applied. Most external
media devices have power lights to indicate that power is present. Next check the removable
media if present, by exchanging it with another cartridge or tape. Next, you should open Device
Manager to ensure the device has been recognized there, as well as to check for conflicting device
driver information.

If Device Manager cannot see the device after the proper driver has been loaded, and the storage
device has power, the final step in checking the system is to check the signal cable by
substitution. The only other step typically available is to test the entire storage system on another
machine (in most cases, there isn’t a second storage system available to use a source of known-
good parts).

Troubleshooting Port Problems


Failures of the serial, parallel, and game ports tend to end with poor or no operation of the
peripheral. Generally, there are only four possible causes for a problem with a device connected
to an I/O port:

i. The port is defective.


ii. The software is not configured properly for the port (that is, the resource allocation, speed,
or protocol settings do not match).
iii. The connecting signal cable is bad.
iv. The attached device is not functional.

Port Problem Symptoms

Typical symptoms associated with serial, parallel, or game port failures include the following:

i. A 199, 432, or 90x IBM-compatible error code displays on the monitor (printer port).
ii. The printer’s Online light is on but no characters are printed when print jobs are sent to
the printer.
iii. An 110x IBM-compatible error code displays on the monitor (serial port error).
iv. A Device Not Found error message displays, or you have an unreliable connection.
v. The input device does not work on the game port.

Basic Port Checks


With newer Pentium systems, you must check the advanced CMOS setup to determine whether
the port in question has been enabled and, if so, whether it has been configured correctly. Check
the PC board that contains the I/O port circuitry (and its user guide) for configuration information.
This normally involves LPT, COM, and IRQ settings. Occasionally, you must set up hexadecimal
addressing for the port addresses; however, this is becoming rare as PnP systems improve. For
example, a modern parallel port must be enabled and set to the proper protocol type to operate
advanced peripherals.
For typical printer operations, the setting can normally be set to Standard Parallel Port (SPP)
mode. However, devices that use the port in a bidirectional manner need to be set to Enhanced
Parallel Port (EPP) or Enhanced Capabilities Port (ECP) mode for proper operation. In both cases,
the protocol must be set properly for the port and the device to carry out communications.

If serial or parallel port problems are occurring, the CMOS configuration window displayed
during the startup sequence is the first place to look. Read the port assignments in the bootup
window. If the system has not detected the presence of the port hardware at this stage, none of the
more advanced levels will find it either. If values for any of the physical ports installed in the
system do not appear in this window, check for improper port configuration.

Because the system has not loaded an operating system at the time the configuration window
appears, the operating system cannot be a source of port problems at this time. If all configuration
settings for the ports appear correct, assume that a hardware problem exists.

Basic Parallel Ports


Run a software diagnostic package to narrow the possible problem causes. This is not normally a
problem because port failures generally do not affect the main components of the system.
Software diagnostic packages normally require you to place a loopback plug in the parallel port
connector to run tests on the port. The loopback plug simulates a printer device by redirecting
output signals from the port into port input pins. You can use a live printer with the port for
testing purposes; however, this action elevates the possibility that the printer might inject a
problem into the troubleshooting process. If there is a printer switch box between the computer
and the printer, remove the print-sharing equipment, connect the computer directly to the printer,
and try to print directly to the device.

Basic Serial Ports


As with parallel ports, diagnostic packages typically ask you to place a serial loopback test plug
in the serial port connector to run tests on the port. Use the diagnostic program to determine
whether any IRQ or addressing conflicts exist between the serial port and other installed options.
The serial loopback plug is physically wired differently from a parallel loopback plug so that it
can simulate the operation of a serial device. You can also attach a live serial device to the port
for testing purposes but, like the printer, this elevates the possibility that the port might inject
other problems into the troubleshooting process.

USB Port Checks


Because nearly any type of peripheral device can be added to the PC through a USB port, the
range of symptoms associated with a USB device can include all the symptoms listed for
peripheral devices in this section. Therefore, problems associated with USB ports can be
addressed in three general areas:
i. The USB hardware device
ii. The USB controller
iii. The USB drivers

As with other port types, begin troubleshooting USB port problems by checking the CMOS setup
screens to ensure that the USB function is enabled there. If it is enabled in CMOS, check in
Device Manager to verify that the USB controller appears there. In Windows 2000, the USB
controller should be listed under the Universal Serial Bus Controllers entry, or in the Human
Interface Devices entry (using the default Devices by Type setting).

If the USB controller does not appear in Device Manager, or a yellow warning icon appears next
to the controller, the system’s BIOS might be outdated. Contact the BIOS manufacturer for an
updated copy of the BIOS. If the controller is present in Device Manager, right-click the USB
controller entry and click Properties. If any problems exist, a message appears in the device status
window, shown in Figure 3.12, describing any problems and suggesting what action to take.

Figure 11.0 The USB Controller Properties dialog box.

If the BIOS and controller settings appear to be correct, the next items to check are the USB port
drivers. These ports have a separate entry in Device Manager that you can access by clicking the
Universal Serial Bus Controllers option, right-clicking the USB Root Hub entry, and then clicking
Properties. If a USB device does not install itself automatically, you might have conflicting
drivers loaded for that device and might need to remove them.

To remove potentially conflicting USB drivers, complete the following steps:

i. Disconnect any USB devices connected to the system and start the system in safe mode.
ii. Under Windows 2000, you are asked about which operating system to use. Use the up-
and down-arrow keys to highlight Windows 2000 Professional or Windows 2000 Server,
and then press Enter. If alert messages appear, read each alert and then click the OK
button to close it.
iii. Open Device Manager, click the desired USB device, and then click the Remove button.
Your particular USB device might be listed under Universal Serial Bus Controller, Other
Devices, Unknown Devices, or a particular device category (such as the Modem entry if
the device is a USB modem).
iv. Click the Start menu, select the Shut Down option, select the Restart entry, and then click
the OK button.
v. Connect the USB device directly to the USB port on your computer. If the system does
not autodetect the device, you must install the drivers manually. You might need drivers
from the device manufacturer to per- form this installation.

Troubleshooting Sound Cards

Most sound cards perform two separate functions. The first is to play sound files; the second is to
record them. You might need to troubleshoot problems for either function.

Sound Card Configuration Checks

In the past, sound cards have been notorious for interrupt conflict problems with other devices.
Because these conflicts typically exist between peripheral devices, they might not appear during
bootup. If the sound card operates correctly except when a printing operation is in progress, for
example, an IRQ conflict probably exists between the sound card and the printer port. Similar
symptoms would be produced for tape backup operations if the tape drive and the sound card
were configured to use the same IRQ channel. Use a software diagnostic program to check the
system for interrupt conflicts.

Checking the system for resource conflicts in Windows is relatively easy. Access Control Panel
and double-click the System icon. From this point, click Device Manager and select the Sound,
Video, and Game Controller option. If the system detects any conflicts, it places an exclamation
point within a circle on the selected option.

From Device Manager, choose the proper sound card driver from the list and move into its
Resource window. The page’s main window displays all the resources the driver is using for the
card. The Conflicting Device List window provides information about any conflicting resource
that the system has detected in conjunction with the sound card.

If the Windows PnP function is operating properly, you should be able to remove the driver from
the system, reboot the computer, and allow the operating system to redetect the sound card and
assign new resources to it.

Check to verify that the Multimedia icon is installed in Control Panel and available through the
Start, Programs, Accessories path (Start, All Programs, Accessories, Entertainment in Windows
XP). Also, check Device Manager to see that the correct audio driver is installed and that its
settings match those called for by the sound card manufacturer. If the drivers are missing, or
wrong, add them to the system through the Add/Remove Hardware Wizard found in Control
Panel.

If the driver is not installed, or is incorrect, add the correct driver from the Available Drivers list.
If the correct driver is not available, reinstall it from the card’s OEM disk or obtain it from the
card’s manufacturer.
Sound Card Hardware Checks
These checks include determining that the speakers are plugged into the speaker port. It is not
uncommon for the speakers to be mistakenly plugged into the card’s MIC (microphone) port.
Likewise, if the sound card does not record sound, verify that the microphone is installed in the
proper jack (not the speaker jack) and that it is turned on. Check the amount of disk space on the
drive to ensure that there is enough to hold the file being produced.

In the case of stereo speaker systems, it is possible to place the speakers on the wrong sides. This
produces a problem when you try to adjust the balance between them. Increasing the volume on
the right speaker increases the out- put of the left speaker. The obvious cure for this problem is to
physically switch the positions of the speakers.

Troubleshooting Network Cards


Cabling is one of the biggest problems encountered in a network installation. Is it connected? Are
all the connections good? Is the cable type correct? Has there been any termination, and if so, has
it been done correctly? The most efficient way to test network cable is to use a line tester to check
its functionality.

With unshielded twisted pair (UTP) cabling, simply unplug the cable from the adapter card and
plug it into the tester. If coaxial cable is used, you must unplug both ends of the cable from the
network, install a terminating resistor at one end of the cable, and plug the other end into the
tester. The tester performs the tests required to analyse the cable and connection.

Most network adapter cards come from the manufacturer with an OEM disk or CD-ROM of
drivers and diagnostic utilities for that particular card. You can run these diagnostic utilities to
verify that the LAN hardware is functioning properly.

However, it might be easier to run the Windows PING utility from the command prompt and
attempt to connect to the network. In a LAN environment, you need to know the IP address or the
name of a remote computer in the network to which you can direct the PING. Both PING and
TRACERT can be used to identify the IP address of a known network address.

Check the activity of the light on the back plate of the LAN card (if avail- able) to determine
whether the network is recognizing the network adapter card. If the lights are active, the
connection is alive. If not, check the adapter in another node. Check the LAN cabling to ensure it
is the correct type and that the connector is properly attached. A LAN cable tester is an excellent
device to have in this situation.

Working with Portable Systems


One of the biggest problems for portable computers is heat buildup inside the case. Because
conventional power supplies (and their fans) are not included in portable units, separate fans must
be designed in portables to carry the heat out of the unit. The closeness of the portable’s
components and the small amount of free air space inside their cases also adds to heat- related
design problems.
The internal PC boards of the portable computer are designed to fit around the nuances of the
portable case and its components, rather than to match a standard design with standard spacing
and connections. Therefore, inter- changeability of parts with other machines or makers goes by
the wayside. The only source of most portable computer parts, with the exception of PC Cards
and disk drive units, is the original manufacturer. Even the battery case might be proprietary. If
the battery dies, you must hope that the original maker has a supply of that particular model.

Although adding RAM and options to desktop and tower units is a relatively easy and
straightforward process, the same tasks in notebook computers can be difficult. In some
notebooks, you must disassemble the two halves of the case and remove the keyboard to add
RAM modules to the system. In other portables, the hinged display unit must be removed to
disassemble the unit. Inside the notebook, you might find several of the components are hid- den
behind other units. Figure 3.14 demonstrates a relatively simple disassembly process for a
notebook unit.

Troubleshooting PCMCIA Problems

One of the mainstays of portable computer products is the credit card-like PCMCIA cards, also
known as PC Cards. The process for troubleshooting PC Cards is nearly identical to
troubleshooting other I/O adapter cards.

PCMCIA cards can be plugged into the system at any time and the system should recognize them.
In most cases, Windows 9x, Windows Me, Windows 2000, and Windows XP have a copy of the
necessary driver software for the PCMCIA adapter being installed and will install it automatically
when it detects the adapter. Most Windows operating system versions display messages telling
you that they are installing the drivers required. However, Windows 2000 and Windows XP just
install the drivers without a notice.

In cases in which the operating system does not have the necessary driver software, it prompts
you for a path to the location where the driver can be loaded, when it detects the adapter.
PCMCIA manufacturers typically supply drivers for various operating systems on a floppy disk
or a CD that comes with the adapter.

To verify that the PC Card device is working, access Device Manager. If there is a problem with
the PC Card device, it appears in Device Manager. If the PCMCIA adapter’s icon shows an
exclamation mark on a yellow background, the card is not functioning properly. Turn the system
off and reinsert the device in a different PCMCIA slot. If the same problem appears, three
possible sources of problems exist - the card might be faulty, the PC Card controller in the PC
might be faulty, or the operating system might not support the device in question.

If the Windows Device Manager displays the PCMCIA socket but no name for the card, the card
insertion has been recognized but the socket could not read the device’s configuration information
from the card. This indicates a problem with the PCMCIA socket installation. To correct this
problem, remove the PCMCIA socket listing from Device Manager, reboot the computer, and
allow the Windows PnP process to detect the socket and install the appropriate driver for it. If the
names of the PCMCIA cards do not appear after the restart, the reinstallation process was not
successful.
Therefore, the PCMCIA socket you are using is not supported by the operating system version. If
the names of other PCMCIA cards do appear in the Device Manager, but the card in question
does not, it is likely that the card has been damaged. To test the PC Card device, insert a different
PC Card device of any type in the slot. If the other card works, it is very likely that the card in
question has been damaged.

Troubleshooting Portable Unique Storage


As with other PCMCIA devices, PC Card hard drives are self-contained. Plug them into the
PCMCIA slot and the system should detect them (they are hot-swappable). If the system does not
detect the card/hard drive, use the troubleshooting steps described for other PCMCIA devices.

Troubleshooting Batteries
If you turn your portable computer on and nothing happens, the first things to check out include
the power supply and the battery. If the power supply is plugged in, the computer should start up
when the On/Off switch is engaged. However, if the computer is running on battery power and
the system does not start up, the battery could be bad or need to be charged.

Verify that the battery doesn’t need a recharge by trying to start the system with the AC power
adapter plugged in. Check the power indicator in the system display panel. If it is on, power is
being supplied to the portable. If the indicator is not on, verify that the power cord is securely
connected to a live power source. Check all the power connections to ensure that the AC adapter
jack is securely connected to the AC adapter port.

If the portable still doesn’t start up, you must troubleshoot the system board. If the system runs
from the AC adapter, the battery needs to be recharged or replaced.

Although a dead system is a classic battery/power-supply problem, you might encounter several
other battery-related problems with portable computers. These include problems that present the
following types of symptoms:

i. You receive warning messages about the battery not charging.


ii. The computer experiences intermittent system shut downs when operating with only the
battery.
iii. The computer does not recognize its network connection when operating with only the
battery.
iv. The computer and input devices are slow when operating with only the battery.
v. The computer loses the time and date information when operating on battery power.

A loose or improperly installed battery can cause these problems. They can also appear when the
battery is toward the end of its charge/recharge cycle. Check the installation and attempt to
recharge the battery using the portable computer’s AC adapter.

The actual life of a laptop computer battery varies from just under one hour to over two hours in
each sitting. If you are experiencing battery life cycles that are significantly shorter than this (for
example, 10 to 15 minutes), you might have a problem referred to as battery memory.

Battery memory is a condition that occurs with some types of batteries in which the battery
becomes internally conditioned to run for less time than its designed capacity (for example, if you
routinely operate the computer using the battery for an hour and then plug it back in to an AC
source, the battery can become conditioned to only run for that amount of time).

To correct battery memory problems, you must fully discharge the battery and then recharge it.
To accomplish this, complete the following steps:

i. Turn the portable’s Power Management feature off by accessing the Power Management
icon in the Windows Control Panel.
ii. Restart the computer and access the CMOS setup utility during bootup.
iii. Disable the power management functions in the CMOS settings.
iv. Start the portable computer using only the battery and allow it to run until it completely
discharges the battery and quits.
v. Recharge the battery for at least 12 hours.
vi. Repeat this process several times watching for consistently increasing operating times.

Troubleshooting Docking Stations/Port Replicators


Most docking stations offer an internal power supply that can operate the portable and its
peripheral attachments: an external parallel port for printers, a serial port for serial devices (mice
and modems), USB ports, external VGA/DVI video and full size keyboard connections, and audio
connections for external speakers.
In addition, the docking station can host several types of external storage devices, including full-
sized FDD/HDD/CD-ROM/DVD drives. Docking stations might also include one or two PCI
slots that allow full-sized desktop adapter cards (SCSI or specialized video or LAN card) to be
added to the sys- tem when it is docked. They might also provide multiple PCMCIA slots that add
to the existing PC Card capabilities of the portable it is supporting.

For the most part, these connections are simply physical extensions of the ports provided by the
portable. Therefore, if the port works on the portable and doesn’t work when connection is made
through the docking station, generally something is wrong with the docking station/port
replicator. However, many portable computers employ special keystroke combinations (Fn +
some other key) to activate external devices, such as a video display monitors or full-size
keyboards.

For example, some portables detect that the external video display has been attached. Others use
an Fn key combination to switch the display to the external monitor only, and then use another Fn
key combination to send the display to both the LCD panel and the external display (that is,
internal, external, or both).

If a peripheral device is not working, one of the first steps to take is to refer to the portable’s
documentation to ensure that the external device has been activated.

For audio problems, verify that the speakers are connected to the correct RCA mini jacks (not the
Line IN or Microphone jacks). Check the documentation to ensure the sound output has not been
muted using an Fn key combination.
DATABASE DESIGN

A database is a computerized record-keeping system. It is a tool for organizing, managing, and


retrieving information. Its overall purpose is to maintain information and to make that information
available on demand. The information can be anything that is of significance to an individual or
organization. A database can be compared to a filing cabinet. A filing cabinet contains files of
information stored in a certain sequence. Files in a filing cabinet are called records in a database.
Specific information in a record is called a field. A group of fields make up a record and a group
of records make up a database. A row of entries is recognized as a record. The individual cells by
column are fields. Each column may contain only one specific type of information for all the
records. Consistency with data entry is important. Information such as dates, abbreviations, etc.
should be consistent.

At a minimum, a database is a cell range consisting of one or more columns and at least two rows.
The first row of the database contains field names and the following rows contain records.
Usually a record consists of the name of some item (student, employee, equipment, etc.) and
additional data pertaining to the item. A database is made up of several parts. It is important to
understand the terms describing these parts:

Term Definition

Field Name A field name is a name that identifies the data stored in a field. The top row
of a database must contain the field names.

Field Each column in a database is a separate field, and each of the cells within a
column is a field. A different field is used for each item that needs to be
accessed separately.

Record A record is a single row in a database. Each record contains the same
categories of data as every other record in the database.

Computed Field A field containing formulas or functions

Database or Table A rectangular group of worksheet cells defined as the table or database

Pivot Table A Pivot table report is an interactive table that can be used to summarise,
analyse and present large amounts of data by categories and subcategories.
You can rotate its rows and columns to see different summaries of the
source data.

In its most basic form, a database is the electronic equivalent of an organized list of information.
Typically, this information has a common subject or purpose, such as the list of employees shown
here:

ID Last name First name Title Hire date


1 Anderson Nancy Sales Rep May 1, 2003
2 Carpenter Chase Sales Manager Aug 14, 2001
3 Emanuel Michael Sales Rep Apr 1, 1999
4 Furse Karen Buyer May 3, 2004
This list is arranged in a table of columns and rows. Each column represents a field - a
specific type of information about an employee: last name, first name, hire date, and so
on. Each row represents a record - all the information about a specific employee.

Keys

i. Primary key: Is a value unique for each record in a table. This value cannot be used twice.
ii. Foreign keys: Used to create relationships between tables. No uniqueness constraint for
foreign keys

Microsoft Access: Microsoft Access stores data in its own format based on the Access Jet
Database Engine. It can also import or link directly to data stored in other applications and
databases.

Some of the operations in Microsoft Access are:

To open an existing database follow the steps below:


i. On the Start menu, point to All Programs, click Microsoft Office, and then click Microsoft
Office Access 2007.
ii. In the Open Recent Database list, click more, navigate to the folder in which the database
is stored, and then double-click the database.

To close a database
i. Click the Microsoft Office Button,
ii. and then click Close Database.

Figure 1: Closing a Database

To view records in a table subdatasheet


i. Click the Expand button at the left end of the record.
To hide records in a subdatasheet
i. Click the Collapse button at the left end of the record.
To close a document window
i. Click the Close Window button at the right end of the document tab.
To move through a table one record at a time
i. On the record navigation bar,
ii. click the Next Record button.
To move to a specific record on a datasheet
i. On the record navigation bar,
ii. select the current record number,
iii. type the number of the record you want, and then press F.
To switch from Datasheet View to Design View
i. On the View toolbar,
ii. click the Design View button.
To view the properties of a query
i. In the Navigation Pane, right-click the query,
ii. and then click Object Properties.
To process (or run) a query
i. In the Navigation Pane, right-click the query name,
ii. and then click Open.
To move through records in a form
i. On the record navigation bar,
ii. click the Next Record to move forward and the Previous Record button to move
backward.
To view a form in Design view when you are currently in Form view
i. On the Home tab, in the Views group,
ii. click the View button.
To preview a report
i. In the Navigation Pane, right-click the report,
ii. and then click Print Preview.
iii. Click the report to display a larger view.
To view a table in Print Preview
i. Click the Microsoft Office Button, point to Print,
ii. and then click Print Preview.
To change the page orientation of a table before printing
i. On the Print Preview tab, in the Page Layout group,
ii. click the Portrait button or the Landscape button.
To close Print Preview
i. On the Print Preview tab, click the Close Print Preview button.

Creating a Database
To open a template and save it as a new database
i. On the Getting Started with Microsoft Office Access page (figure 1), in the Template
Categories list, click a category.
Figure 2: Getting Started with Microsoft Office Access

i. Click the template icon for the template you want to open.

Figure 3: Selecting a Blank Database

ii. In the File Name box, type a new name for the database, and note the default path.
iii. Click the Create button.

To open a new blank database


i. Start Access. On the Getting Start page, click Blank Database.
ii. In the File Name box, type the name for the database.
iii. Click the Browse for a location button, browse to the folder where you want to save the
database, click OK, and then click Create.
Figure 4: Creating a New Database

To enter information in a database


i. Click in an empty cell, type your text,
ii. and then press D to move to the next cell.
To change a field name
i. Double-click the field name, and then type the new name.
To change the data type of a field
i. In Design view, click in the data type cell you want to change,
ii. click the arrow that is displayed, and then click the data type you want to use.
To change the size of a field
i. In Design view, click the field name.
ii. In the Field Properties area, select the current field size,
iii. and then enter the new field size.
To close and save a table or other database object
i. Click the Close button to close the table,
ii. and then click Yes to save changes.
To rename a table or other database object
i. Close the table. In the Navigation Pane, right-click the table,
ii. and then click Rename.
iii. Type a new name for the table, and then press Enter.
To delete a table or other database object
i. Close the table. In the Navigation Pane, right-click the table,
i. and then click Delete.
ii. In the confirmation dialog box that appears, click Yes.

To delete a table row while in Design view


i. Right-click in the row you want to delete,
ii. and then click Delete Rows.

Microsoft Excel (MS Excel): is a program that allows users to organize, format and compute data
with formulas using a spreadsheet system. There are various versions of MS Excel ranging from
MS Excel 97 to 2013.
To launch the Microsoft excel application, follow the steps below:

i. Click on start,
ii. Click on all programs
iii. from the menu displayed locate Microsoft office folder
iv. Click on the folder
v. Select and click on Microsoft excel
vi. Figure 1 will be displayed

Figure 5: MS Excel worksheet

MS Excel, the primary document where you store and work with data is referred to as a
worksheet or spreadsheet. A worksheet is made up of various horizontal rows and vertical
columns, each row and column contain many cells.
Figure 6: A Cell

Each white box within the spreadsheet is a cell. The row and column in which a particular cell is
located is referred to as the cell address. The highlighted portion in figure X represents cell A1
meaning column A, row 1).

Formatting Data

MS Excel provides a simple way to change the appearance and layout, or format of the
spreadsheet and the data within it.

To format cells in MS Excel, do the following:

i. Select the cells you would like to format


ii. Right-click, and select format cells from the drop-down menu
iii. Selecting format cell brings the figure shown in Y
Figure 7: The format cells Menu

MS Excel as a Database

Access is a great database application but can be sometimes complicated. There are a lot of times
when it would be nice to have some of the capabilities of a database without going through stress.
This is where Excel really comes into play. If you design your Excel workbook correctly, you can
use Excel to look at your data in many of the same ways you would use a database application –
you can sort data in many different ways, filter it so you see only data that matches specific
criteria, and you can reorganize your data in any way you want. To use an Excel workbook as a
database, your data needs to be structured in the list format. An Excel list consists of columns and
rows of data structured in the following ways:

i. Each column contains the same category of data in every row in the column (similar to a
field in a database)
ii. Each row in the list contains all of the fields of data for one entity (a person, organization,
object, etc.) similar to a record in a database, but called sets of data in Excel’s terminology
iii. The first row of the list must contain a unique name at the top of each column. This first
row does not need to be the first row of the worksheet
iv. The row containing the column headings must be formatted differently from the rest of the
list (i.e. bold, larger font, italicized, etc.)
v. There can be no blank rows in the list (there can be blank cells in a column, but the entire
row cannot be empty)
vi. Data in a column must be in the same format for every row in the column (i.e. numbers
cannot be spelled out in one row and entered as digits in the rest of the rows in that
column)
vii. Other data in the worksheet can be located outside the boundaries of the list

Example: Create a database of students in CSC307 class, with the following fields: Matric
Number, Age, State of Origin, and Gender.
To create the table, type in the data as it is given, creating the headings as appropriate. Figure Z
shows a sample of the raw data.

Figure 8: Raw database

Formatting the data

To give our database a unique look, we do the following:

i. Select the heading and click on B on the menu bar, this will make the text to be bold.
ii. Select the data in the database, and click on Borders,
iii. from the drop down menu, select, All Border
Figure 9: All Border Menu

Clicking on All Border will give Figure 10

Figure 10: All Border


Database Manipulation.

In manipulating the database, we will consider the following:

Sort Data: Sorting of data is one of the useful feature available in MS Excel. It allows one to
arrange the database into a particular order, such as in ascending or descending. Using our
example, let us learn how to sort.

To sort your data in any order, do the following:


i. Select all the entries, on the menu bar, click on Data
ii. From the submenu, click on sort, a dialogue box will appear
iii. Chose your criteria properly, then click ok, note the transformations that occur.

Figure 11: Data Menu Items


Figure 12: Sorted Data

The items in the database were sorted using “Age”, “Values” and “Smallest to Largest” as
attributes.

Counting a particular entry: To know the number of Males or Females in our database, the
COUNTIF function is used. For Example: to count the number of females in our database, do the
following:

i. Locate a point in the worksheet where you want your value to appear
ii. At that point, enter the formula: =COUNTIF(D2:D25,”F”),
iii. Press the enter key (note that there is no space in the formula),
iv. The value “11” will be displayed (meaning the number of Females in the entries 2
to 25 is 11).

Sum: It adds the values of each cell within a given range. To sum all the ages of students in the
database, do any of the following:

i. Highlight the age entries and click on the summation symbol Σ, the sum of the
ages will be displayed at the bottom of the entries.
ii. At any point of interest, enter the formula: =sum(B2:B25), then press the enter
key, and the result will be displayed, in our example “433”.
Average: The function Average takes the arithmetic mean of the cells within the specified range.
To calculate the Average, use the formula: =Average(B2:B25), the result “18.04167” will be
displayed.

Filtering Data: One of the more powerful features of a database manager is its ability to quickly
locate information. With just a few keystrokes, Excel can find all records based on certain
conditions. These conditions are referred to as Criteria. The first step when trying to find specific
records is to specify the data you want to search for. The following operators may be used in
setting criteria: =, >, <, >=, <=, <>.

Example: Filter our sample database using the criteria State of Origin = Lagos.
To do this, follow the steps below:
i. Click on the Data Menu,
ii. from the submenu, click on filter, each item headings will have a drop down button
iii. Click on the drop down button on the “State of Origin” Column.
iv. From the menu options displayed, click on “Text Filters”
v. Then click on “Custom Filter”

Figure 13: Filter Menu

vi. On clicking the “Custom Filter”, a dialog box appears


Figure 14: Filter Menu Criteria

vii. In the “equal” portion set the criteria to “Lagos”, press the enter key
viii. All the students that have Lagos as the state of origin will be filtered out.

Figure 15: Filtered Records.


Exercises
1. Create a database of 20 different Computer Science textbooks from your local Library
using Microsoft Access and Microsoft Excel. The database comprises of the following
fields, Author, price of textbook, year of publishing, etc.
2. Sort the database using year of publishing.
3. Filter the database using price <= #24,000

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy