Download as pdf or txt
Download as pdf or txt
You are on page 1of 57

INTRODUCTION TO

COMPUTER ARCHITECTURE AND


NETWORKING
(CT006-3-0-ICAN)

Chapter 2

Data Representation

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 1


Topic and structure of lesson

• General Considerations
• Binary numbers in computer processing
• Number systems and Inter-conversion
• Data Types

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 2


Learning Outcomes
At the end of this session, you should be able to:
▪ Understand how data is represented, stored, and
manipulated inside a computer.
▪ Understand the similarities and differences in the way
computers represent numerical, character, and image
data.
▪ Represent numeric data in different numbering systems

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 3


Key terms you must be able to use

You should be able to use the following terms


correctly in your assignments and exams:
▪ ADC ▪ ASCII
▪ DAC ▪ Unicode
▪ Decimal ▪ Pixel
▪ Binary ▪ Resolution
▪ Octal
▪ Hexadecimal

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 4


RECAP: Data VS Information

Comparison Description Example


Data Data is a collection of • Name
unprocessed items (raw facts), • D.O.B
which can include text, number, • Phone Number
image, audio and video.

Information Data is then organized and Name, D.O.B and Phone


presented as meaningful Number are managed
information to the people. and presented as
Customer Details.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 5


Data Processing Cycle

– Once data is collected, it is processed to convert it into


useful information. This is called data processing cycle.
– The data processing is very important activity and
involves very careful planning. Usually, data processing
activity involves three basic activities:

1. Input
2. Processing
3. Output

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 6


Human Data

• Human communication
▪ Includes text, sound, image, video.
• Computers process and store all forms of data in binary
format.
• Human data has to be represented (converted) to binary
format before being processed by a computer.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 7


Discussion

1. Why computers are made to understand and process digital signal not
analog signals?

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 8


Discussion

1. Why computers are made to understand and process digital signal not
analog signals?

Q1: Computers are unable to process analog signals because they are
digital devices. For digital devices such as computers, to work with analog
devices, conversion is required.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 9


Discussion

1. Why computers are made to understand and process digital signal not
analog signals?
2. Why is Binary representation important for computers?

Q1: Computers are unable to process analog signals because they are
digital devices. For digital devices such as computers, to work with analog
devices, conversion is required.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 10


Discussion

1. Why computers are made to understand and process digital signal not
analog signals?
2. Why is Binary representation important for computers?

Q1: Computers are unable to process analog signals because they are
digital devices. For digital devices such as computers, to work with analog
devices, conversion is required.

Q2: Computers (and most other modern electronic devices such as


cameras, mobile phones, etc.) are ‘digital’ devices because they process
data in the form of numbers (digits).

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 11


Discussion

• Why computer system use binary representation?

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 12


Discussion (Rationale)

• Why computer system use binary representation?

▪ Because the devices that store and manage the digital


data are far less expensive and complex for binary
representation.

▪ They are also far more reliable when they have to


represent one out of two possible values.

▪ Because the electronic signals are easier to maintain if


they carry only binary data.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 13


Introduction to Binary

• Computers only recognize off and on, like a


light switch.
• These switches are represented as binary digits or… bits.
• Computer data are composed only of a series of bits.
• Human count in Base 10 (Decimal).
• Computers count in Base 2 (Binary).

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 14


Binary Representation

• One bit can be either 0 or 1. Therefore, one bit can


represent only two outputs.
• To represent more than two outputs, we need multiple bits.
Two bits can represent four outputs (combinations of 0 and
1) which are: 00, 01, 10,11.
• In general, n bits can represent 2n outputs (combinations of
0 and 1).
• Note that every time we increase the number of bits by 1,
we double the number of outputs (combinations).

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 15


Numbering Systems

• Main Numbering Systems:


▪ Binary ▪ Decimal
▪ Octal ▪ Hexadecimal

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 16


Conversion Between
Numbering System
Next, we will cover the following conversion between the
numbering system:
• Binary ↔ Decimal
• Octal ↔ Decimal
• Hexadecimal ↔ Decimal

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 17


Decimal → Binary
Change the decimal number 3410 to binary number.
So,

3410 = 1000102

Let’s Practise!
1. 2510 110012
2. 14510 100100012

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 18


Binary → Decimal
Change the binary number 1010 11002 to decimal number.
So,

101011002 = 17210

Let’s Practise!
1. 11012 1310
2. 111111112 25510

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 19


Decimal → Octal
Change the decimal number 56910 to octal number.
So,

56910 = 10718

Let’s Practise!
1. 2510 318
2. 14510 2218

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 20


Octal → Decimal
Change the octal number 1438 to decimal number.
So,

1438 = 9910

Let’s Practise!
1. 148 1210
2. 2358 15710

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 21


Decimal → Hexadecimal
Change the decimal number 200410 to hexadecimal number.

So,

200410 = 7D416

Let’s Practise!
1. 2510 1916
2. 14510 9116

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 22


Hexadecimal → Decimal

Change the octal number 1A16 to decimal number.


So,
161 160

1A16 = 2610
1 A

1x161 10x160 Let’s Practise!


16 10
1. 3F216 101010
2. 4D1E16 1974210
26

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 23


Analog Signal & Digital Data

• An analog signal is one which has a value that varies


smoothly.
• The sound waves that your mouth produces when you
speak are analog – the waves vary in a smooth way.
• These waves can be converted into an electrical signal by a
microphone. This electrical signal is also analog.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 24


Analog to Digital Converter (ADC)
• A good example of a computer peripheral that requires
an ADC is a microphone.
• When you plug a microphone into a computer, you are
actually plugging it into an ADC which converts the analog
signals from the microphone into digital data that the
computer can then process.
• Try Voice Changer (Voice Changer - Online & Free)

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 25


Digital to Analogue Converter
(DAC)
• A good example of a computer peripheral that requires
a DAC is a loudspeaker or headphones.
• When you plug a loudspeaker into a computer, you are
actually plugging it into a DAC, which takes digital data
from the computer and converts it into analogue signals
which the loudspeaker then converts into sound.
• Listen to this…

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 26


Computer Data Formats

• Data formats
▪ Specifications for converting data into computer-
usable form.
▪ Define the different ways human data may be
represented, stored and processed by a computer.
• The computing systems store, present, and help us modify:
▪ Text
▪ Sound
▪ Image
▪ Video

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 28


Data Formats -
How To Interpret Data
–Human data have to be digitised using appropriate
standards.
• Text: need coding using standard codes
• Sound: need sampling with appropriate sampling rate.
• Image: need detailed description of the data, how
colour is represented at each data point
• Video: need continuous representation of consecutive
frames (images) and proper compression technique.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 29


Data Formats - Standards

Type of Data Standards


Alphanumeric data
ASCII, Unicode
(Text)
Sound WAV, MP3, AIFF, RA, WMA, AAC, etc..
Image JPEG, GIF, PCX, TIFF, BMP, PNG, etc..
Video MPEG-2, Quick Time, MPEG-4, AVI, etc..

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 30


Type of Data (1) –
Alphanumeric Data (Text)
• Three standards for representing letters (alpha) and numbers
(numeric).

• American Standard Code for


ASCII
Information Interchange

Unicode • Universal Code

• Extended Binary-Coded Decimal Interchange Code


EBCDIC • Not used anymore. (Used to be used in IBM mainframes)

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 31


ASCII Features

• Originally: 7-bit code. (27 = 128 codes)


• Two general types of codes:
• EXTENDED ASCII: 8-BIT CODE

No. of codes Type of code Description

95 Graphic code Displayable on a console

33 Control code Control features of the console


or communication channel

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 32


ASCII Table

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 33


Extended ASCII Features

• Extended ASCII: 8-bit code. (28 = 256 codes)


• The first 128 codes are exactly the same as the original
ASCII codes.
• Can represent more special characters and Western
European characters such as: ė , á, Å, £, ¥, µ, ¼, ±.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 34


Extended ASCII Table

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 35


“Hello, world” Example

Binary Hexadecimal Decimal


H = 01001000 = 48 = 72
e = 01100101 = 65 = 101
l = 01101100 = 6C = 108
l = 01101100 = 6C = 108
o = 01101111 = 6F = 111
, = 00101100 = 2C = 44
= 00100000 = 20 = 32
w = 01110111 = 77 = 119
o = 01100111 = 67 = 103
r = 01110010 = 72 = 114
l = 01101100 = 6C = 108
d = 01100100 = 64 = 100
Note: Each character requires 8 bits (1 byte)

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 36


Unicode

• Extended ASCII is not enough for international use.


• The Unicode is a 16-bit code. (216 = 65,536 codes)
• Unicode was designed to be a superset of ASCII. That is,
the first 256 characters in the Unicode character set
correspond exactly to the extended ASCII character set.
• Click this link to learn more about Unicode.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 37


Type of Data (2) – Sound

• Sound is perceived when a series of air compressions


vibrate a membrane in our ear, which sends signals to our
brain.
• A stereo system sends an electrical signal to a speaker to
produce sound.
• This signal is an analog representation of the sound wave.
The voltage in the signal varies in direct proportion to the
sound wave.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 38


Digitizing Sound

• To digitise the signal we periodically measure the voltage of


the signal and record the appropriate numeric value. The
process is called sampling.
• In general, a sampling rate of around 40,000 times per second
is enough to create a high quality sound reproduction.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 39


Digitizing Sound (Cont…)

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 40


Type of Data (3) – Image

• Colour is our perception of the various frequencies of light


that reach the retinas of our eyes.
• Our retinas have three types of colour photoreceptor cone
cells that respond to different sets of frequencies
correspond to the colours of red, green, and blue.
• Colour is often expressed in a computer as an RGB (Red-
Green-Blue) value, which is actually three numbers that
indicate the relative contribution of each of these three
primary colours.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 41


Digitizing Image – Pixel

• Digitising an image is the act of representing it as a


collection of individual dots called pixel.
• The word pixel was derived from the words, "picture
element".
• The number of pixels used to represent an image is called
the resolution.
• Each pixel is converted to a binary code that represents the
colour of the pixel.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 42


Digitizing Image – Pixel

Note: Resolution is expressed in term of N x M (width x height)

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 43


Digitizing Image – Pixel

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 44


Digitizing Image – Pixel

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 45


Digitizing Image – Color Depth

The amount of data that is used to represent a colour is


called the colour depth.
Name Description

Monochrome uses 1-bit to represent 2 colours only (black and


white).

Greyscale uses 8-bits to represent black, white and


different levels of grey colours

True Colour / RGB Each component in RGB is represented using 8-


bits.

CMYK mainly for printing. Uses 32-bits to represent


Cyan, Magenta, Yellow and Black components.
CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 46
Digitizing Image – Color Depth

Monochrome
1 = white; 0 = black Greyscale

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 47


Digitizing Image – Color Depth

True Colour / RGB CMYK

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 48


Digitizing Image –
Pixel & Color Depth

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 49


Digitizing Image – Color Depth

24-bit RGB Value Colour


Red Green Blue
0 0 0 black
255 255 255 white
255 255 0 yellow
255 130 255 Pink
146 81 0 brown
133 40 210 purple
140 0 0 maroon

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 50


Type of Data (4) – Video

• A sequence of consecutive images (frames) of objects


photographed in motion by a camera in such rapid
succession as to give the illusion of natural movement.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 52


Type of Data (4) – Video

• Requires massive amounts of data


• Video camera producing full screen 640 x 480 pixel true
colour image at 30 frames/sec ➔ 27.65 MB of data/sec
• A video codec (Coder/Decoder) refers to the methods used
to compress the size of a movie to allow it to be played on
a computer or over a network.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 53


Video Resolution

• Refers to the number of distinct pixels that could be


displayed in each dimension. It is usually quoted as width ×
height; for an example: “1280 × 720″, which it is called
720p.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 55


Video Resolution

UHD

UHD
QHD
FHD
HD
SD
CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 56
Video Resolution

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 57


Summary of Main Teaching Points

• Data must be converted from its native format into form understood by
processing device in order to be processed by the CPU.
• All data represented within a modern computer system as strings of binary
digits, or bits.
• Each type of computer data has a specific data format & coding method.
• Character is converted to numbers via coding table.
• Image is represented in pixels, resolution and colour depth.
• Sound is sampled and each sample is represented in binary.
• Video is a sequence of pictures that are recorded and played successively.

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 58


Question and Answer Session

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 59


What We Will Cover Next

Chapter 3 – CPU and Registers

CT006-3-0-ICAN – Introduction to Computer Architecture and Networking Data Representation SLIDE 61

You might also like