Chapter 1 Computer Programming
Chapter 1 Computer Programming
[ECEg-1052]
Chapter One:
Computer Systems Overview
Outline
Introduction
Functional Components of a computer system and organization
Hardware and Software
Numbering systems and codes
1.1 Introduction
What is a Computer?
An electronic device operating under the control of instructions stored in its
own memory unit.
An electronic device that stores and process data, in doing so:
Receive data (input)
Processes data arithmetically and logically
Produce information (output) from the processing
Store information (output) for future use
The four operations are referred to as the information processing cycle: Input,
process, output, and storage.
Computers transform raw data into information.
3
Cont’d...
Types of Computer
Based on their task or purpose.
General purpose computers:- may be applied to any solvable problem
Example: Personal Computer(PC)
Special purpose computers: designed for a particular purpose or task.
Example: Calculator
Based on their size and performance.
Microcomputers Mainframe computers
Minicomputers Supercomputers
4
1.2 Functional Components of a computer
system and organization
5
Cont’d...
Input Unit
Accept data from external source and convert it to signals sent to the
CPU.
Is the conduit through which data and instructions enter a computer.
Examples of input devices:
Keyboard
Mouse Mouse
Scanner
Touch Screen Input Scanner
Keyboard
Figure 1.1 6
Cont’d...
Central Processing Unit (CPU)
Is the “brain” of the computer.
It retrieves instructions from memory and executes them.
The CPU has two main parts, these are:
The Control Unit
The Arithmetic Logic Unit (ALU)
Figure 1.2 7
Cont’d...
The Control Unit
The control unit controls and coordinates the actions of the other
components.
It controls the fetching of instructions from the main memory and the
execution of the instructions.
It also controls input and output devices and passes data to the second
component, the ALU.
8
Cont’d...
9
Cont’d...
Output Unit
Accept signals from the CPU and output the data to the end user.
Make the information resulting from processing available for use
Examples of Output Devices: Monitor
Printers
Computer Screens (Display Unit) (Monitor)
Speakers
Plotter
11
Cont’d...
Random Access Memory or RAM
Stores:
Instructions waiting to be executed
Data needed by those instructions
Results of processed data
RAM requires continuous power to maintain its information, therefore if
the computer loses power, any unsaved information in RAM will be lost.
RAM is temporary.
12
Cont’d...
ROM - Read Only Memory
Contains permanent programs
Power up test programs and bootstrap loader which loads the operating system
of the disk.
Since the main memory is temporary, secondary memory space is needed to
store data and information permanently for later use.
13
Cont’d...
Memory
Memory
Disk
Disk Disk
Disk
Figure 1.5 15
1.3 Hardware and Software
A computer system consists of hardware and software for its proper function.
Hardware
The term hardware refers to all of the physical devices, or components, that a
computer is made of.
A computer is not one single device, but a system of devices that all work
together.
Software
Software are programs written to perform specific tasks.
For example, word processors are programs that you use to write letters,
papers, and even books.
There are two general categories of software: System and Standalone software
(application software). 16
Cont’d...
System software
Control the computer.
The system program that loads first when you turn on your PC is called the
operating system.
Without an operating system, the computer is useless.
The operating system monitors the overall activity of the computer and
provides services.
Some of these services include memory management, input/output
activities, and storage management.
17
Cont’d...
Spreadsheets, and
Games
18
1.4 Number Systems and Codes
Number Systems
Digital Codes
Storing Data in Computers
19
1.4.1 Number Systems
The study of number systems is important from the viewpoint of
understanding how data are represented before they can be processed by
any digital system including a digital computer.
It is one of the most basic topics in digital electronics.
Commonly used number systems are:
Decimal,
Binary,
Octal and
Hexadecimal number systems.
20
Cont’d...
Decimal Numbers
In the decimal number system each of the ten digits, 0 through 9,
represents a certain quantity.
The decimal number system has a base of 10.
The value of a digit is determined by its position in the number.
21
Cont’d...
Binary Numbers
The binary number system is another way to represent quantities.
It is less complicated than the decimal system because the binary system has
only two digits.
The binary system with its two digits is a base-two system.
The two binary digits (bits) are:
1
0
22
Cont’d...
Table 1-1
23
Cont’d...
Hexadecimal Numbers
The hexadecimal number system has sixteen characters;
Long binary numbers are difficult to read and write because it is easy to drop
or transpose a bit.
It is much more efficient to use hexadecimal or octal;
Hexadecimal is widely used in computer and microprocessor applications.
The hexadecimal number system has a base of sixteen; that is, it is composed
of 16 numeric and alphabetic characters.
Most digital systems process binary data in groups that are multiples of four
bits, making the hexadecimal number very convenient because each
hexadecimal digit represents a 4-bit binary number.
24
Cont’d...
Table 1-2 Ten numeric digits and six
alphabetic characters make up the
hexadecimal number system.
25
Cont’d...
Octal Numbers
Like the hexadecimal number system, the octal number system provides a
convenient way to express binary numbers and codes.
It is used less frequently than hexadecimal in conjunction with computers
and microprocessors to express binary quantities for input and output
purposes.
The octal number system is composed of eight digits, which are
0, 1, 2, 3, 4, 5, 6, 7
26
1.4.2 Digital Codes
Many specialized codes are used in digital systems.
Some codes are strictly numeric, and others are alphanumeric;
Codes are used to represent numbers, letters, symbols, and
instructions.
The codes introduced in this section are the BCD, the Gray code, the
ASCII code, and the Unicode.
27
Cont’d...
Binary Coded Decimal (BCD)
Binary coded decimal (BCD) is a way to express each of the decimal
digits with a binary code.
There are only ten code groups in the BCD system, so it is very easy to
convert between decimal and BCD.
Because we like to read and write in decimal, the BCD code provides an
excellent interface to binary systems.
Examples of such interfaces are keypad inputs and digital readouts.
28
Cont’d...
The 8421 BCD Code
The 8421 code is a type of BCD (binary coded decimal) code.
Binary coded decimal means that each decimal digit, 0 through 9, is
represented by a binary code of four bits.
The designation 8421 indicates the binary weights of the four bits (23, 22,
21, 20).
The ease of conversion between 8421 code numbers and the familiar
decimal numbers is the main advantage of this code.
29
Cont’d...
All you have to remember are the ten binary combinations that represent
the ten decimal digits as shown in Table 1-3.
The 8421 code is the predominant BCD code, and when we refer to BCD,
we always mean the 8421 code unless otherwise stated.
Table 1-3
30
Cont’d...
The Gray Code
The Gray code is unweighted and is not an arithmetic code; that is, there
are no specific weights assigned to the bit positions.
The important feature of the Gray code is that it exhibits only a single bit
change from one code word to the next in sequence.
This property is important in many applications, such as shaft position
encoders, where error susceptibility increases with the number of bit
changes between adjacent numbers in a sequence.
31
Cont’d...
Table 1-4
32
Cont’d...
Alphanumeric Codes
Binary 0’s and 1’s have been used to represent various numbers to this
point.
Bits can also be coded to represent letters of the alphabet, numbers, and
punctuation marks.
Codes that can represent both letters and numbers are called
alphanumeric codes.
33
Cont’d...
One such 7-bit code is the American Standard Code for Information
Interchange (ASCII, pronounced “ask-ee”).
Note that:
The letter A is represented by 1000001, where as
The letter B is represented by 1000010
34
Table 1-5
Note that the EBCDIC code is an 8-bit code and therefore can have more
variations and characters than the ASCII code can have.
36
Cont’d...
The alphanumeric ASCII code is the modern code for getting information
into and out of microcomputers.
ASCII is used when interfacing computer keyboards, printers, and video
displays.
ASCII has become the standard input/output code for microcomputers.
Other alphanumeric codes that you may encounter are:
7-bit BCDIC (Binary-Coded Decimal Interchange Code).
8-bit EBCDIC (Extended Binary-Coded Decimal Interchange Code). Used on
some IBM equipment.
7-bit Selectric. Used to control the spinning ball on IBM Selectric typewriters.
12-bit Hollerith. Used on punched paper cards.
37
1.4.3 Storing Data in Computers
When you press A on your keyboard, the computer displays A on the
screen.
But what is actually stored inside the computer’s main memory?
What is the language of the computer?
How does it store whatever you type on the keyboard?
38
Cont’d...
Electrical signals are used inside the computer to process information.
There are two types of electrical signals: analog and digital.
Analog signals
are continuous wave forms used to represent such things as sound.
Audio tapes, for example, store data in analog signals.
Digital signals
Represent information with a sequence of 0 s & 1 s.
A 0 represents a low voltage, and a 1 represents a high voltage.
39
Cont’d...
Computers use digital signals.
The language of a computer, called machine language, is a sequence of 0
s and 1 s.
Every letter, number, or special symbol (such as * or { ) on your keyboard
is encoded as a sequence of bits, each having a unique representation.
The most commonly used encoding scheme on personal computers is the
seven-bit American Standard Code for Information Interchange (ASCII).
40
Cont’d...
That is, in the ASCII data set, the position of the first character is 0, the position
of the second character is 1, and so on.
In fact, A is the 66th character in the ASCII character code, but its position is 65
because the position of the first character is 0.
Inside the computer, every character is represented as a sequence of eight bits,
that is, as a byte.
Now the eight-bit binary representation of 65 is 01000001.
41
Cont’d...
Unicode - consists of 65,536 characters.
To store a character belonging to Unicode, you need two bytes.
42
Thank You !
43