You are on page 1of 36

Section 1: Fundamentals of Hardware and Software

3
What is a computer?
A computer is an electronic device, operating processed into meaningful form and that is
under the control of instructions stored in its own valuable to the user
memory that can accept data (input), process the
data according to specified rules, produce Supermarket receipt
information (output), and store the information for
future use.

 Data: Data is a collection of unprocessed


items, which can include text, numbers,
images, audio, and video.

Supermarket items
2 Medium Sodas $1.49 each
1 Small Turkey Sub $3.49 each
1 Caesar Salad $4.49 each
1 Bag of Chips $0.99 each There are two main component of a computer:
3 Cookies $0.39 each
1. Hardware
Amount Received $20
2. Software.

 Processing: Processing is the stage where


the input data is manipulated in order to
produce meaningful information.

Supermarket POS
1. Calculation: Computes each item’s total price by
multiplying the quantity ordered by the unit price.

2. Organisation: Organises the data.

3. Calculation: Sums all item total prices to determine the


total order. Requests for the payment from the
customer.

4. Calculation: Calculates the change due to the customer


by subtracting total from the amount received.

5. Receipt: Prepares and issues receipts.

 Information: Information conveys meaning


and is useful to people. Data that has been

4
The computer system Advantages and
overview disadvantages of using a
computer
There are numerous advantages and disadvantages
of using a computer.

Advantages
1. Speed
Many computers process billions or trillions
of operations in a single second.

2. Reliability
Computers are everywhere: at work, at school,
The electronic components in modern
and at home. While some computers sit on top of
computers are dependable and reliable
a desk or on the floor, mobile computers and
because they rarely break or fail.
mobile devices are small enough to carry. Mobile
devices, such as many cell phones, often are
classified as computers. 3. Consistency
Given the same input and processes, a
People use all types and sizes of computers for a
computer will produce the same results —
variety of reasons and in a range of places:
consistently. A computing phrase — known
as garbage in, garbage out — points out that
 Consumers use computers to correspond with
the accuracy of a computer’s output depends
businesses, employees with other employees
on the accuracy of the input.
and customers, students with classmates and
teachers, and family members and military
personnel with friends and other family 4. Storage
members.
Many computers store enormous amounts of
 Local and national news, weather reports, data and make this data available for
sports scores, airline schedules, telephone processing anytime it is needed.
directories, maps and directions, job listings,
credit reports, and countless forms of 5. Communications
educational material always are accessible.
Most computers today can communicate
 Banks place ATMs (automated teller with other computers, often wirelessly, to
machines) all over the world, so that share computer resources
customers can deposit

5
Disadvantages generated when using a computer. Strategies
that support green computing include
1. Health Risks recycling, regulating manufacturing
processes, extending the life of computers,
Prolonged or improper computer use can
and immediately donating or properly
lead to injuries or disorders of the hands,
disposing of replaced computers.
wrists, elbows, eyes, neck, and back.

2. Violation of Privacy
Nearly every life event is stored in a
computer. In many instances, where
personal and confidential records were not
protected properly, individuals have found
their privacy violated and identities stolen.

3. Public Safety
Innocent computer users have fallen victim
to crimes committed by dangerous strangers.

4. Impact on Labor Force


Although computers have improved
productivity in many ways and created an
entire industry with hundreds of thousands
of new jobs, the skills of millions of
employees have been replaced by
computers.

5. Impact on environment
Computer manufacturing processes and
computer waste are depleting natural
resources and polluting the environment
with toxic materials and potentially
dangerous levels of lead, mercury, and flame
retardants.

6. Green computing
This involves reducing the electricity
consumed and environmental waste

6
7
Fundamentals of Hardware
On completion of this unit, students should appreciate the fundamental hardware and terminologies and concepts; develop
expertise in the operation and use of microcomputer-based systems.

What is computer
hardware?
Computers contain many electric, electronic, and
mechanical components known as hardware.
Hardware is the physical component of the
computer system.

8
Major hardware components and their functions

Processing
Processing is the manipulation of data according
to specified rules.

Processing device
The only processing device is the processor. The
processor is installed on the motherboard.

processor motherboard

Components of the processing device


1. Control Unit (CU)

2. Arithmetic & Logic Unit (ALU)

It interprets each instruction issued by a


program or an application and then
CU
initiates the appropriate action to carry out
The motherboard is located inside the system unit. the instruction.

9
ALU
It performs arithmetic, comparison, and Input
other operations
The CU executes instructions by performing the Input is whatever goes into the computer. Input
following steps: can take a variety of forms, from commands you
enter from the keyboard to data from another
Step (1) - fetching the instructions from memory computer or device.
Step (2) - decoding the instructions
Input devices
Step (3) - fetching the data required by the
instructions from memory An input device is any peripheral device that
allows entering data and instructions into a
Step (4) - sending the data and instructions to the computer.
ALU for processing.

Step (5) - sending the data to the memory unit after a. Keyboard devices
processing. – Keyboard.

Types of internal components that the control unit b. Pointing devices


directs include the arithmetic logic unit, registers,
– Mouse
and buses.
– Trackball

 Register: A register is a high-speed storage – Touchpad


location that temporarily holds data and – Pointing Stick
instructions – Joystick etc.

 Bus: A bus is an electrical channel that c. Automated input devices /


transfers electronic bits internally within the
Source data input devices
circuitry of a computer, allowing the devices
both inside and attached to the system unit
– Optical Mark Recognition / Optical
to communicate with each other.
Mark Reader (OMR).

Function of the processing device – Optical Character Recognition / Optical


Character Reader (OCR).
The processor (CPU  central processing unit) is
brain of the computer. It interprets and carries out – Magnetic Ink Character Reader (MICR).
the basic instructions that operate the computer
– Bar Code Readers.
– Document Scanner
– Light-Pen.
– Touch Terminals
– Voice Response Unit
– Pad and Tablets
10
– Point of Sale (POS)
– Digital Camera 8. VRUs are units produce computer-generated
voice output. They provide pre-recorded
– Biometric system
information for users either with or without
– Sensors request.
– Remote Controls
9. Pads and Tablets are stationary input devices
– Sound Capture
that provide a small, flat surface that the user
– Webcam slides or taps the pad’s surface as an
alternative to pressing tap keys.
Function of the input devices
10. Point of sale systems use personal computers
1. OMR is useful for applications in which or specialized terminals that are combined
large numbers of hand-filled forms need to be with cash registers, bar code readers, optical
processed quickly and with great accuracy scanners and magnetic stripe readers for
like multiple-choice questions, surveys, reply accurately and instantly capturing the
cards, questionnaires and ballots. transaction.
2. OCR system also includes an optical scanner 11. Biometric devices grant users access to
for reading data in the computer. programs, systems, or rooms by analyzing
some biometric identifier. A biometric
3. MICR allows computers to read information
identifier is a physiological (related to
like an account number off the documents.
physical or chemical activities in the body) or
MICR is used in places like the banks.
behavioral characteristic. Examples include
fingerprints, hand geometry, facial features,
4. A bar code reader uses laser beams to read
bar codes on products such as food and voice, signatures, and eye patterns.
boarding passes. Barcode readers are used in
12. A sensor (also called detector) is
supermarkets.
a converter that measures a physical
quantity and converts it into a signal which
5. An optical scanner, usually called a scanner,
is a light-sensing input device that reads can be read by an observer or by an (today
mostly electronic) instrument. Applications
printed text and graphics and then translates
the results into a form the computer can include cars, machines, aerospace, medicine,
manufacturing and robotics.
process.

6. A light-sensitive input device which, when it 13. A sound capture is an input device that
allows a user to capture sound into the
touches the screen, detects the presence or
absence of light. It is used to select an entry computer for processing.
or indicate a position.
Peripheral: A peripheral (or peripheral device) is
7. Users can interact with touch screens by any hardware you connect to a computer or
mobile device to expand its capabilities. Examples
touching areas of the screen.

11
include a keyboard, mouse, microphone, monitor, Output
printer, scanner, webcam, and speakers.
Output is any peripheral that conveys information
from a computer to one or more people

Output devices
An output device is any hardware component that
conveys information from a computer to one or
more people.

a. Visual Display Unit


– Monitor and Laptop display
– Handheld game display
– Smartphone display
– Navigation system display

Display technologies
o Cathode Ray Tube (CRT)
o Liquid Crystal Display (LCD)
o Plasma
o High Definition TV (HDTV)

Sizes of display units


o 17 inches (17/)
o 19 inches (19/)
o 21 inches (21/) etc

Colour of display units


The number of colour display can be from 16
 256 up to 64,000  6.7 million. The more
colours the smoother the graphics appear.

Resolution of display units


Resolution is the number of horizontal and
vertical pixels in a display. The quality of
display depends largely on its resolution.

12
 Pixel: A pixel (short for picture element) is c. Audio output
the smallest element in an electronic image. – speakers

Some resolution types are: – Headphones and Earbuds

o VGA (640  480 pixels)


d. Data projectors
o SVGA (600  800)
o SXGA (1280  1024 pixels) Function of the output devices
o XVGA (1024  768 pixels)
1. A display device, or simply display, visually
o 1280  800 conveys text, graphics, and video
o 1440  900 information.

2. A printer produces text and graphics on a


b. Printers physical medium such as paper. Printed
Nonimpact Printers content sometimes is referred to as a hard
These form characters and graphics on a piece copy or printout.
of paper without actually contacting the paper.
3. Audio output
– Ink-Jet printers
– Photo printers 4. Data projectors take the text and images
– Laser printers displaying on a computer or mobile device
screen and project the images on a larger
– All-in-One printers screen so that an audience can see the image
– Thermal printers clearly.
– Label printers
– Mobile printers Comparison between impact printers
and nonimpact printers
– Plotters and Large-Format printers
1. Most impact printers are faster than non-
Impact Printers impact printers
These form characters and graphics on a piece
of paper by striking a mechanism against an 2. Impact printer can produce duplicate copies
inked ribbon that physically contacts the but non-impact printers cannot.
papers.
3. Non-impact printers can produce graphics
– Dot matrix printers but impact printers cannot.
– Daisy-wheel printers
4. Impact printer are noisy but non-impact
printers are quiet

13
5. Impact printers are used mostly in business Storage
to produce large volumes of print quickly.
Terms associated with output Storage is the act of keeping data/information for
access by a computer processor.
1. Hard copy: Printed information that exists
physically and is a more permanent form of
Storage devices
output than that presented on a display
device (soft copy). A storage device records (writes) and/or retrieves
(reads) items to and from storage media. Storage
2. Soft copy: Temporary output presented on a devices often also function as a source of input
display device. and output because they transfer items from
storage to memory and vice versa.
3. Human-readable: output devices that
produced hard or soft copies of information 1. Primary storage
or data that can be read and interpreted by
humans. 2. Secondary storage

4. Machine-readable: Machine readable Storage devices and media


devices are those that output in a form only a
computer can process. a. Primary storage
– Bistable Device
– Random Access Memory (RAM)
– Read Only Memory (ROM)
– Buffer
– Cache memory
– Virtual memory

b. Secondary storage
– Hard Disk Drive (HDD)
– Optical drives
– Floppy Disk Drive (FDD)

c. Flash Memory Storage


– Memory Cards
– USB Flash Drives

d. Solid State Drive Storage


– Optical drives
Floppy Disk Drive (FDD)
14
– Magnetic Stripe Cards Types of hard drive
– Smart Cards
ATA Advanced Technology Attachment
– Microfilm and Microfiche Ultra ATA Ultra Advanced Technology Attachment
SATA Serial Advanced Technology Attachment

Function of the storage devices IDE Integrated Drive Electronics


EIDE Enhances Integrated Drive Electronic
1. Bistable Any device that has only two states Ultra Direct Memory Access
e.g. light switch (on or off) Ultra DMA
SCSI Small Computer System Interface
2. RAM holds temporary operating
instructions for the computer, its program
and data. The CPU gets the instructions to Comparison between HDD and SSD
do its job from memory.
SSDs have several advantages over traditional
RAM stores: (magnetic) hard disks, including the following:

 the operating system and other system – Higher storage capacities


software that control or maintain the
computer and its devices – Faster access times (can be more than 80 times

 application programs that carry out a faster)


specific task such as word processing
– Faster transfer rates
 the processing data and resulting – Quieter operation
information.
– More durable
3. ROM chips store basic start up information – Lighter weight
for a computer. – Less power consumption (leads to longer
battery life)
Variation of ROM
– PROM (Programmable Read Only memory) – Less heat generation
– Longer life (more than 10 times longer)
– EPROM (Erasable Programmable Read Only
Memory) Comparison between CD and DVD
DVD quality far surpasses that of CDs because
– EEPROM (Electronically Erasable items are stored in a slightly different manner,
which enables DVDs to have greater storage
Programmable Read Only)
capacities and higher resolutions than CDs. The
first storage technique involves making the disc
denser by packing the pits closer together. The
second involves using two layers of pits. This
technique doubles the capacity of the disc because
15
the lower layer of pits is semitransparent, which successive rewrite. A popular use of CD-RW
allows the laser to read through it to the upper and CD-R discs is to create audio CDs. For
layer. Finally, some DVDs are double-sided. A example, you can record your own music and
more expensive DVD format is Blu-ray, which save it on a CD, purchase and download songs
has a higher capacity and better quality than from the web, or rearrange tracks on a
standard DVDs, especially for high-definition purchased music CD.
audio and video.
Variations of DVDs
Variations of CDs
– A DVD-ROM (DVD-read-only memory) is a
– A CD-ROM (CD-read-only memory) is a type
high-capacity optical disc that users can read
of optical disc that users can read but not write
but not write on or erase. Manufacturers write
on (record) or erase — hence, the name read-
the contents of DVD-ROMs and distribute
only.
them to consumers. DVD-ROMs store movies,
Manufacturers write the contents of standard music, music videos, huge databases, and
CD-ROMs and distribute them to consumers. complex software.
A standard CD-ROM is called a single-session
disc because manufacturers write all items on – DVD-R and DVD+R are competing DVD-
the disc at one time. Software manufacturers recordable WORM formats, on which users
sometimes distribute their programs using CD- can write once but not erase their own items,
ROMs. The term, photo CD, sometimes is including video, audio, photos, graphics, and
used to refer to CDs that contain only photos. text.

– A CD-R (CD-recordable) is an optical disc on – DVD-RW, DVD+RW, and DVD+RAM are


which users can write once, but not erase, their competing DVD-rewritable formats that users
own items, such as text, graphics, and audio. can write on multiple times.
Because a CD-R can be written on only one
time, the format of these discs sometimes is Comparison of secondary storage media
called WORM (write once, read many). Some with respect to speed and cost
CD-Rs are multisession, which means you can
write on part of the disc at one time and More
faster
another part at a later time — if the disc has expensive
free space. Hard disk

– A CD-RW (CD-rewritable) is an erasable Circuit chips


Speed

multisession disc users can write on multiple


cost

optical disc
times. CD-RW overcomes the major
disadvantage of CD-R because it allows users Floppy disk
to write and rewrite data, instructions, and
information on the CD-RW disc multiple Tape disk
times — instead of just once. Reliability of the
slower less expensive
disc tends to drop, however, with each

16
Comparison of secondary storage retrieve information directly without having
to scan a series of records.
Devices are chosen for a particular use based on
their:
8. Device interfaces:
1. storage capacity
 IDE: An acronym for Integrated Drive
2. access speed Electronics
3. size
 SCSI: An acronym for Small
4. portability Computer System Interface
5. cost.
 SATA: An acronym for Serial
Advanced Technology Attachment.
Terms associated with storage

1. Read/write head: This is the mechanism Units of Storage


that reads items and writes items in the drive
as it barely touches the disk’s recording 1. Bit  1 or 0
surface.
2. Byte  8 bits
2. Sectors: Sectors are the pie shape.
3. Kilobyte  1024 bytes (210 )
3. Tracks: Tracks form circles on the surface
4. Megabyte  1024 kilobytes (220 )
of the disk.
5. Gigabytes  1024 megabytes (230)
4. Cylinders: A cylinder is the vertical section
of a track that passes through all platters. 6. Terabyte  1024 gigabytes (240)

7. Word: The largest amount of data that


5. Access Time: This is the time delay or
the computer can process at any
latency between a request to an electronic
one time (in one process)
system, and the access being completed or
the requested data returned.
8. Word size: The number of bits a computer can
work with at a time.
6. Sequential Access: The device must read or
move through all information up to the point 9. Address: The identifier of a specific
it is attempting to read or write to. A tape location in memory where a data
drive is an example of a sequential access item or instruction is stored.
drive, where the drive must move the tape
forward or backward until it reaches its 10. Address Content: The data or instruction that
destination. is stored in a given address.

7. Direct Access: Bits of data are stored at


precise locations, enabling the computer to

17
Communications 6. Hub

Digital communications describes a process in Functions of communications devices


which two or more computers or devices transfer
data, instructions, and information NIC is a communications device that enables a
computer or device that does not have built-in
networking capability to access a network
Communications devices
A communications device is any type of hardware A modem, also called a digital modem, is a
capable of transmitting data, instructions, and communications device that sends and receives
information between a sending device and a data and information to and from a digital line.
receiving device.
A router is a communications device that connects
multiple computers or other routers together and
Communications devices transmits data to its correct destination on a
1. Network Interface Card (NIC) network.
2. MODEM
A hub or switch is a device that provides a central
3. Router point for cables in a network
4. Switch
An access point is a transceiver (station that
5. Access point transmits and receives data).

18
19
Fundamentals of Software
This section differentiates between system programs and application programs.

What is Software? Types of Application Software


a. General Purpose: These are what you call off
Software is a collection of programs, procedures
and routines which direct the operations of the the shelf products ready to be installed.
computer.
b. Custom Written: These are programs that are
written specifically for an individual or
Types of software organization. Sometimes a company cannot
1. System software: This consists of the find packaged software that meets its unique
programs that control or maintain the requirements; in this case the company uses
operations of the computer and its devices. programmers to develop these applications.

2. Application software: This consists of c. Customization of General Purpose:


programs designed to make users more Customization of General Purpose software is
productive and/or assist them with personal the process of tailoring General purpose
tasks. software and integrating it directly with other
applications that the organization has in use.
3. Utility software. A utility program is a type
This also gives the user the ability to
of system software that allows a user to
customize the interface of the applications,
perform maintenance-type tasks, usually
and also automate the application to speed up
related to managing a computer, its devices,
processing.
or its programs. Most operating systems
include several built-in utility programs.
d. Specialized Software Packages: Specialized
Software; are packages are software written
Types of System Software for a specific discipline, such as Inventory
a. Operating system (OS): An operating system Management, Asset Management,
(OS), also known as operating software, is a Calendar/To Do List etc. They are mainly
set of programs containing instructions that designed for experts within a field such as;
work together to coordinate all the activities Banking, Medicine, Government etc.
among computer hardware resources.
Types of Utility software
b. Translators: A piece of software that a. Disk defragmenters. Examples include a
converts one form of code to another form Disk defragmenter which can detect computer
more understandable by the computer. files whose contents have been stored on the
hard disk in disjointed fragments, and move
the fragments together to increase efficiency; a

20
Disk checker can scan the contents of a hard Functions of System Software
disk to find files or areas that are corrupted in
some way, or were not correctly saved, and Operating systems
eliminate them for a more efficiently operating Most operating systems perform similar functions
hard drive; a Disk cleaner can find files that that include:
unnecessary to computer operation, or take up
– Startup and shut down a computer
considerable amounts of space. Disk cleaner
helps the user to decide what to delete when – Provide a user interface
his hard disk is full.
– manage:

b. System Profilers. A System profiler can  programs


provide detailed information about the  memory
software installed and hardware attached to  files
the computer. Backup software can make a
copy of all information stored on a computer,  network
and restore either the entire system (e.g. in an
– coordinate tasks
event of disk failure) or selected files (e.g. in
an event of accidental deletion). Disk – configure devices
compression software can transparently – establish network and Internet connection
compress the contents of the hard disk, in
– monitor performance
order to fit more information to the drive.
– automatically update itself and certain utility
programs.
c. Virus scanners. Virus Scanners scan for
computer viruses among files and folders.
Translators
d. Binary/Hex/Text Editor Utility directly – Converts one form of code to another form
modifies the text or data of a file without the more understandable by the computer.
WYSIWYG (what you see is what you get)
view in editor suites. These files could be data
or an actual program.

e. Compression utilities output a shorter stream


or a smaller file when provided with a stream
or file.

f. Encryption utilities use a specific algorithm


to produce an encrypted stream or encrypted
file when provided with a key and a plaintext.

21
General Purpose Application Software: a. Acrobat Reader
the big five b. Nitro
c. FoxIt
a. Word Processing
d. PDF-XChange Viewer
b. Spreadsheet
e. Sumatra
c. Database Management
d. Graphics Presentation 5. Flash players
e. Communication
Application Software Examples
Other software General purpose
(written for any specific – word
1. Burning Software:
business or organization – Excel
a. Nero burning software but can be used or – Access
b. Alcohol 120 adopted to suit a specific – PowerPoint
need)
c. Power ISO
Integrated Software – Microsoft Office
(set of related programs 2013, 2010, 2007
2. Media Players: combined in a unified – Microsoft works
a. Power DVD package that allows data
to be transferred – AppleWorks
b. Windows Media Player between the programs) – Lotus SmartSuite
c. VLC Media Player
– Air Traffic Control
d. Apple QuickTime Software,
e. Nero MediaHome Specialize Software – Accounting
(written for a specific
f. RealPlayer Software
field rather than a broad
application area) – Airline
g. Winamp
Reservation
h. KMPlayer Software
i. DivX

3. Web surfing software Customized software


(modification of general-purpose software to meet
a. Internet Explorer
the needs of an individual or organization better)
b. Goole Chrome Custom Written
c. Mozilla fire fox (Software written to meet the specific needs of a
company)
d. Torch Web application
(Web site that allows users to access and interact
with software from any computer or device that is
4. PDF file readers connected to the Internet)
Open source software

22
(software has no restrictions from the copyright User Interface management
holder regarding modification of the software’s
internal instructions and its redistribution)
Shareware
(Copyrighted software that is distributed at no Command Interface
cost for a trial period. To use a shareware
program beyond that period, you send payment to
the program developer)
Freeware
(Copyrighted software provided at no cost by an
individual or a company that retains all rights to
the software)
Public-domain software
(Copyrighted software provided at no cost by an The Command requires the user to type in
individual or a company that retains all rights to commands to communicate with the user. An
the software) example of an OS that provides a command
driven interface is MS-DOS (Microsoft disk
operating system)

Menu Interface
Menu is a list of options from which you can
choose. The keyboard or mouse is used to select
choices in a menu drive interface.

Graphical User Interface


The ability of a computer to execute two or more
programs at the same time using one CPU
(processor).

23
Data manipulation
This subsection describes how data are stored and manipulated within the computer system

Data /information is manipulated in binary


system. Example

– Numbers Expand 1492 in decimal system.


– Letters of the alphabet and punctuation marks
Solution
– Microprocessor instruction
– Graphics/Video 2  10º = 21 = 2
– Sound
9  10¹ = 9  10 = 90
4  10² = 4  100 = 400
Number systems 1  10³ = 1  1000 = 1000

– Binary (Base 2)
 1492 = 2 + 90 + 400 + 1000
– Octal (Base 8) (expanded in base 10)

– Hexadecimal (Base 16)

The Decimal Number System


Each place value in a decimal number is a power
of 10.

Base Valid digits


10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

24
The Binary Number System
Base Valid digits 6  8º = 61 = 6

2 0, 1 5  8¹ = 58 = 40
4  8² = 4  64 = 256
 Each place value is a power of 2.

 Binary to decimal:  The octal number 456 = 6 + 40 + 256


= 302 (base 10)
digit0  2º + digit1  2¹ +..

The Hexadecimal Number


Example
System
What is the binary number 1001 in base 10?
Base Valid digits
16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
Solution
A, B, C, D, E, F

1  2º = 11 = 1 – Each place value is a power of 16.


0  2¹ = 02 = 0
– hexadecimal to decimal:
0  2² = 04 = 0
digit0  16º + digit1  16¹ +..
1  2³ = 18 = 8
Example
 The binary number 1001 = 1 + 0 + 0 + 8
= 9 (base 10) What is the hexadecimal representation 1FA in
base 10?
The Octal Number System

Base Valid digits Solution

8 0, 1, 2, 3, 4, 5, 6, 7 A  16º = 10  1 = 10
15  16¹ = 15  16 = 240
– Each place value is a power of 8.
1  16² = 1  256 = 256
– Octal to decimal:
 The hexadecimal number 1FA = 10 + 240 + 256
digit0  8º + digit1  8¹ +..
= 506 (base 10)

Example

What is the octal number 456 in base 10?

Solution

25
Conversions Convert the decimal number 57 to binary using 8-
bit representation.
Decimal-to-Binary conversion

Example Solution

Convert the decimal numbers 14 to binary. Method 2: Using binary table

Solution (Method 1: Repeated division by 2) 27 26 25 24 23 22 21 20


128 64 32 16 8 4 2 1
Step (1): Keep dividing the decimal number by 2 while
recording the remainder
0 0 1 1 1 0 0 1

Step (2): Write the remainders, from bottom to top, as the  5710 = 001110012 (8 bits) ans.
binary number.

Example

Convert the binary number 11001012 to decimal


Dividing Decimal number Binary
remainder
by 14 number
Solution
2 7 0
2 3 1 26 25 24 23 22 21 20
2 1 1 64 32 16 8 4 2 1
2 0 1
1 1 0 0 1 0 1
 1410 = 11102 ans.
 11001012 = 10110 ans.
Solution (Method 2: Using binary table)

Step 1: Write the position value for each binary digit, as


shown below.

Step 2: Then sum the position values which correspond to


binary ‘ones’

Positional 23 22 21 20
values 8 4 2 1
binary digits 1 1 1 0

 1410 = 11102 ans.

Example

26
Decimal-to-Octal conversion Octal-to-Decimal conversion

Example – Octal to decimal:

Convert the decimal number 46510 to its octal digit0  8º + digit1  8¹ + ...
equivalent:
Example
Solution
Find the decimal equivalent of the octal number
Method 1: Repeated division (by 8) 1378

Dividing Decimal number Octal Solution


remainder
by 465 number
8 58 1 7  8º = 71 = 7
8 7 2 3  8¹ = 38 = 24
8 0 7
1  8² = 1  64 = 64
 46510 = 7218 ans.
 1378 = 7 + 24 + 64 = 9510

Example
Example
Convert the decimal number 254810 to its octal
equivalent. What is the decimal equivalent of the octal
number 16018?
Solution
Solution
Method 1: Repeated division (by 8)
1  8º = 11 = 1
Dividing Decimal number Octal
remainder
number
0  8¹ = 08 = 0
by 2548
8 318 4 6  8² = 6  64 = 384
8 39 6 1  8³ = 1  512 = 512
8 4 7
8 0 4  16018 = 1 + 0 + 384 + 512 = 89710

 254810 = 47648 ans.

27
Decimal-to-Hexadecimal conversion Hexadecimal-to-Decimal conversion
Example – hexadecimal to decimal:
Convert the decimal number 580 10 to its digit0  16º + digit1  16¹ + ...
hexadecimal equivalent.
Example
Solution
Convert the hexadecimal number 20B316 to its
decimal equivalent.
Dividing Decimal number Octal
remainder Solution
by 580 number
16 36 4
3  16º = 31 = 3
16 2 4
16 0 2 B  16¹ = 11  16 = 176
0  16² = 0  256 = 0
 58010 = 24416
2  16³ = 2  4096 = 8192

Example  20B316 = 3 + 176 + 0 + 8192

Convert the decimal number 274110 to its = 837110 ans.


hexadecimal equivalent.
Example
Solution
Convert the hexadecimal number 12AE516 to its
Repeated division (by 16)
decimal equivalent.

Dividing Decimal number Octal


remainder
by 2741 number
Solution
16 171 5
16 10 11(B) 5  16º = 51 = 5
16 0 10 (A)
E  16¹ = 14  16 = 224
 274110 = AB516 ans. A  16² = 10  256 = 2560
2  16³ = 2  4096 = 8192
1  164 = 1  65536 = 65536

 20B316 = 5 + 224 + 2560 + 8192 + 65536


= 7651710 ans.

28
Binary-to-Octal / Hexadecimal  10110000112 = 2C416 ans.

conversion
Octal/Hexadecimal-to-Binary
Binary numbers require three digits to be able to
represent one digit in octal. When converting conversion
binary to octal, group the binary number into To convert from octal to binary, simply write
groups of three digits starting from the right, and down the three bit binary pattern for each octal
convert each group of three digits to one octal digit.
digit.
Example
Example
Convert the octal number 2638 to binary.
Convert the binary number 01110112 to octal.
Solution
Solution
263 = 010 110 011
0111011 = 010 111 011
 2638 = 101100112 ans.
= 2 7 3
To convert from hexadecimal to binary, simply
 01110112 = 2738 ans. write down the four bit binary pattern for each
hexadecimal digit.
Similarly, binary numbers require four digits to be
able to represent one digit in hexadecimal. When
converting from binary to hexadecimal, group the Example
binary number into groups of four digits starting
Convert the hexadecimal number 2A4E16 to
from the right, and convert each group of four
binary.
digits to one hexadecimal digit.

Solution
Example
2A4E16 = 0010 1010 0100 1110
Convert the binary number 10110000112 to
hexadecimal.  2A4E16 = 101010010011102 ans.

Solution

0111011 = 010 111 011


= 2 7 3

 01110112 = 2738

10110000112 = 0010 1100 0011


= 2 C 4

29
Binary arithmetic  01012 + 10012 = 11102 ans.

Addition of binary numbers


(b) 0110112 + 011002
Rule # 1 0
+ 0 1 1

0
0 1 1 0 1 1
Rule # 2 1 + 0 1 1 0 0
+ 0 1 0 0 1 1 1
1
 0110112 + 011002 = 1001112 ans.
Rule # 3 0
+ 1
1 (c) 10010112 + 01011002

Rule # 4 1
1
+ 1
1 0 1 0 0 1 0 1 1
+ 0 1 0 1 1 0 0
Rule # 5 1
1 1 1 1 0 1 1 1
+ 1
1 1  10010112 + 01011002 = 1001001012 ans.

Example
Example
Perform the following binary addition
Using 8-bits, perform the following calculations

(a) 01012 + 10012


(a) 10011002 + 11001012

(b) 0110112 + 011002


(b) 111111102 + 111111012

(c) 10010112 + 01011002


(c) 111111112 + 111111112

Solution:
Solution:
(a) 10011002 + 11001012
(a) 01012 + 10012
1 1 1

1
0 1 0 0 1 1 0 0
0 1 0 1
+ 0 1 1 0 0 1 0 1
+ 1 0 0 1
1 0 1 1 0 0 0 1
1 1 1 0

30
 10011002 + 11001012 = 101100012 ans. Subtraction of binary numbers

(b) 111111102 + 111111012 Rule # 1 0


1 1 1 1 1 ‒ 0
0
1 1 1 1 1 1 1 0
1 1 1 1 1 1 0 1 Rule # 2 1
+
‒ 0
1 1 1 1 1 1 0 1 1 1

 111111102 + 111111012 = 111110112 ans. Rule # 3 0


‒ 1
1
(c) 111111112 + 111111112
Rule # 4 1
1 1 1 1 1 1 1
‒ 1
1 1 1 1 1 1 1 1 0

+ 1 1 1 1 1 1 1 1
0
1 1 1 1 1 1 1 1 0 10
Rule # 5 1 0
 111111112 + 111111112 = 111111112 ans. ‒ 1
1

Example

Perform the following calculations

(a) 10102 ‒ 1102

(b) 101102 ‒ 11002

(c) 100012 ‒ 1002


Solution:

(a) 10102 ‒ 1102


0 10

1 0 1 0
‒ 1 1 0
0 1 0 0

 10102 ‒ 1102 = 01002 ans.

31
(b) 101102 ‒ 11002 Integers (positive and negative
0 10
numbers)
1 0 1 1 0
‒ 1 1 0 0 Positive numbers are represented as usual in
0 1 0 1 0 regular binary. However, negative numbers are
represented differently. There are many schemes
 101102 ‒ 11002 = 010102 ans. for representing negative integers with patterns of
bits. Some examples are:
(c) 100012 ‒ 1002
– Signed and Magnitude
1

0 10 10
– One's Complement

1 0 0 0 1 – Two's Complement
‒ 1 0 0
0 1 1 0 1 Sign and Magnitude representation
In signed magnitude, the left-most bit is not
 100012 ‒ 1002 = 011012 ans. actually part of the number, but is just the
equivalent of a +/- sign. "0" indicates that the
number is positive, "1" indicates negative.

Example

Using 8 bits, convert + 4710 to sign and magnitude


representation.

Solution:

Step 1: convert into 47 = 1011112


binary

Step 2: add zeros to = 0 01011112 (8 bits)


the left of the binary ↓
number to complete
the 8 bits.
+ 47

 47 = 00101111 (8 bits sign and magnitude)

Example

Using 8 bits, convert ‒ 9710 to sign and magnitude


representation.

Solution:

32
One’s complement representation
Step 1: convert into 97 = 11000012
binary In one’s complement, the binary digits are
flipped.
Step 2: add zeros to = 1 11000012 (8 bits)
the left of the binary ↓
number to complete
the 8 bits.
‒ 97 Example

 ‒ 97 = 11100001 (8 bits sign and magnitude) Give the one’s complement representation of
100001112

Solution:
Range of values Change all zeros to ones and all ones to zeros.
‒ (2(n ‒ 1) ‒ 1) to + (2(n ‒ 1) ‒ 1).
100001112 = 011110002
Advantages
 100001112 = 011110002 (one’s complement) ans.
 Useful for applications that require the
magnitude to be distinct from the sign.
Example
Disadvantages
Using 8 bits, give the one’s complement
 There are two ways of representing the value representation of ‒ 5410.
zero: all bits set to zero, and all bits except the
sign bit set to zero. This makes the math a bit
Solution:
confusing.
Step 1: Convert the
 More importantly it is difficult to perform decimal number into 54 = 110110
binary.
arithmetic operations; we need to treat
negative operands as special cases. Step 2: Add zeros to
the left of the binary 00110110
number to complete
the number of bits.

Step 3: Then change


all zeros to ones and 11001001
all ones to zeros.

 ‒ 5410= 110010012 (one’s complement of ‒ 5410)

33
Two’s complement representation
Step 3: Then change 011000102
Most widely used method of representation. all zeros to ones and
all ones to zeros. = 100111012
To get a negative number, do the one’s
complement of the binary number. Then add 1 to
Step 4: Add 1 to the binary number.
this. 1

1 0 0 1 1 1 0 1
Example 1
+
Using 8 bits, give the one’s complement 1 0 1 1 1 1 1 0
representation of NEGATIVE 67.
 ‒ 98 = 101111102
Solution: (Two’s complement of ‒ 9810) ans

Step 1: Convert the


decimal number into 67 = 10000112
binary.

Step 2: Add zeros to Range of values


the left of the binary 010000112
number to complete ‒ (2(n ‒ 1)) to + (2(n ‒ 1) ‒ 1).
the number of bits.

Step 3: Then change Advantages:


all zeros to ones and 101111002
all ones to zeros.  Two's complement can be used in
Step 4: Add 1 to the one’s complement.
additions and subtraction with no need to
use a bit for the sign of the value

1 0 1 1 1 1 0 0 Disadvantages:
+ 1
1 0 1 1 1 1 0 1  Requires one extra bit of storage

 NEGATIVE 67 = 101111012 ans.  Easy to perform arithmetic with regular


adders
Example

Using 8 bits, give the one’s complement


representation of ‒ 98.

Solution:

Step 1: Convert the 98 = 11000102


decimal number into
binary.

Step 2: Add zeros to 011000102


the left of the binary
number to complete
the number of bits.

34
Binary Coded Decimal (BCD)
1. They use more memory since each decimal digit requires
Another way to represent decimals in binary form four binary digits
is binary coded decimals (BCD's). BCD's are 2. Arithmetic operations are difficult to program and
binary numbers that code each decimal digit significantly slower.
separately as a four digit binary number.

Positive and negative signs are coded with 4 bits:

– Positive sign (1010)

– Negative sign (1011)

Example

Convert the decimal number 136 to BCD.

Solution:

Step 1: Simply write down the four bit binary pattern for
each decimal digit

136 = 0001 0011 0110

1 3 6

 13610 = 000100110110
(BCD representation of 13610) ans.

Example

Give the BCD representation of POSITIVE 875


and NEGATIVE 942.

Solution:

Step 1: Simply write down the four bit binary pattern for
each decimal digit

+ 875 = 10101000111101

‒ 942 = 1011100101000010

The advantage to using BCD's is the size of the number is


unlimited with perfect accuracy.

BCD's have several disadvantages.

35
Representation of characters The EBCDIC code

PCs use a standard binary code to represents EBCDIC (Extended Binary Code Decimal
letters of the alphabet, numerals, punctuation Interchange Code) is a similar coding system used
marks and other special characters. mainly on mainframe systems.

There are two coding systems which provide each


character with its own unique binary character
code.

– ASCII

– EBCDIC

The ASCII code


The code is called ASCII (pronounced “askey”)
which stands for “American Standard Code for
Information Interchange.”

There are 256 code combinations (8 bits).

36
The parity method for Example

detecting errors – 1 0 0 1 0 0 1 1 has four 1s so the parity bit


would be a 0
A special circuit counts the number of ‘1’ bits in a
– 1 1 0 0 1 1 1 0 has five 1s so the parity would be
byte and adds a special ninth bit called the “parity a 1
bit.”

When the stored byte is later read out, the parity


checking circuit re-counts the number of ‘1’ bits
and check for the correct number.

Parity Bits
There are two methods for checking parity:
– Odd

– Even

Both methods are equally effective but the method


must be consistent within an operation. If odd
parity was used to store the byte, odd parity must
be used to read it.

Odd Parity
The parity checking circuit counts the number of
“1” bits and adds the parity bit to make the total
number of “1” bits an ODD number.

Even Parity
The parity checking circuit counts the number of
‘1’ bits and adds the parity bit to make the total
number of 1 bits an EVEN number.

Example

– 1 0 0 1 0 0 1 1 has four 1s so the parity bit


would be a 1

– 1 1 0 0 1 1 1 0 has five 1s so the parity bit would


be a 0

37
38

You might also like