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

CHAPTER 1 BINARY

SYSTEM AND
HEXADECIMAL

1.1 Data representation


1.1.1 Binary systems
1.1.2 Hexadecimal
OBJECTIVES:

 Introduction to number systems

 Conversion
of binary number system into
decimal number system

LESSON 1
Used by Used in
System Base Symbols humans? computers?
Decimal 10 0, 1, … 9 Yes No
Binary 2 0, 1 No Yes
Octal 8 0, 1, … 7 No No
Hexa- 16 0, 1, … 9, No No
decimal A, B, … F

Common Number Systems


Conversion Among Bases

Decimal

Hexadecimal

Binary
Decimal Octal

Binary Hexadecimal

Binary to Decimal
Example 1
Bit “0”

1010112 => 1 x 20 = 1
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
4310

Example 2
DIY:
Convert these 8-bit binary numbers in to denary.

 0 0 0 1 1 0 0 1
 0 1 0 1 0 0 0 0
 1 0 0 1 0 0 1 1
 1 1 1 1 1 1 1 1

Home Task
Activity 1.1 a – j
(peer/self checking)

TODO
OBJECTIVES:

 Conversion
of denary number system into
binary number system (using both
methods)

LESSON 2
Decimal Octal

Binary Hexadecimal

Decimal to Binary
Consider the conversion of the denary number, 110 , into
binary. This method involves placing 1s in the appropriate
positions so that the total equates to 110

128 64 32 16 8 4 2 1
0 1 1 0 1 1 1 0

METHOD 1/EXAMPLE 1
Consider the conversion of the denary number, 142 , into
binary. This method involves placing 1s in the appropriate
positions so that the total equates to 142

128 64 32 16 8 4 2 1
1 0 0 0 1 1 1 0

METHOD 1/EXAMPLE 2
METHOD 2/EXAMPLE 1
12510 = ?2 2 125
2 62 1
2 31 0
2 15 1
2 7 1
2 3 1
2 1 1
0 1

12510 = 11111012

METHOD 2/EXAMPLE 2
DIY:

Convert the following from denary to


binary

a) 55
b) 248
c) 13
d) 191
e) 250

Home Task
Activity 1.2 a – j (both methods)
(peer/self checking)

TODO
OBJECTIVES:

 Conversion
of denary number system into
hexadecimal number system

LESSON 3-4
Decimal Octal

Binary Hexadecimal

Decimal to Hexadecimal
Example 1
123410 = ?16

16 1234
16 77 2
16 4 13 = D
0 4

123410 = 4D216
Example 2
Consider the conversion of the denary numbers 55 and 2004 into hexadecimal.

BOTH METHODS AT A GLANCE


DIY
Convert the following denary into
hexadecimal
a) 1234
b) 500
c) 1010
d) 345
Home Task
Activity 1.7 a-j
(peer/self ckecking)

TODO
OBJECTIVES:

 Conversionof hexadecimal number


system into decimal number system`

LESSON 4-5
Decimal Octal

Binary Hexadecimal

Hexadecimal to Decimal
Example 1
ABC16 => C x 160 = 12 x 1 = 12
B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
274810

Example 2
DIY
Convert the following hexadecimal
into denary
a) C0B
b) F2
c) A12
Home Task
Activity 1.6 a-j
(Peer/self checking)

TODO
OBJECTIVES:

 Conversionof hexadecimal number


system into binary number system

LESSON 6
Decimal Octal

Binary Hexadecimal

Hexadecimal to Binary
Example 1
10AF16 = ?2

1 0 A F

0001 0000 1010 1111

10AF16 = 00010000101011112
Example 2
DIY
Convert the following hexadecimal
notations into binary
 A00
 BFF
 C09

Home Task
Activity 1.5 a-j
(peer/self checking)

TODO
OBJECTIVES:

 Conversion
of binary number system into
hexadecimal number system

LESSON 7
Decimal Octal

Binary Hexadecimal

Binary to Hexadecimal
Example 1
Example 2
10101110112 = ?16

10 1011 1011

2 B B

10101110112 = 2BB16
DIY
Convert the following binary into hexadecimal notations
a) 1010 1100
b) 1101 1011 0111
c) 1001 1001 1000
d) 1100 1010
e) 0001 1111 0011
Home Task
Activity 1.4 a-j
(peer/self checking)

TODO
Plenary task

Hexa-
Decimal Binary decimal
33
1110101
1AF

Exercise – Convert ...


Exercise – Convert …

Answer

Hexa-
Decimal Binary decimal
33 100001 21
117 1110101 75
431 110101111 1AF
USES OF BINARY
A robot vacuum cleaner has three wheels,
A, B and C. A rotates on a spindle to allow
for direction changes (as well as forward
and backward movements); B and C are
fixed to revolve around their axles to
provide only forward and backward
movement, and have an electric motor
attached:

EXAMPLE
If the register contains 1 0 1 0 1 0 1 0 this means ‘motor B is ON
and motor C is ON and both are turning to produce forward
motion’. Effectively, the vacuum cleaner is moving forward.

EXAMPLE
ACTIVITY
EXAMPLE
EXAMPLE
EXAMPLE
EXAMPLE
1 0 0 1 0 1 1 0

EXAMPLE
Binary numbers are very useful in computer science, but they have
disadvantages:

 It is hard for people to read and understand binary numbers.


 When you write a binary number it is easy to make a mistake.
 It is hard to spot and fix errors in binary number.
 Writing binary takes a lot of space.

The hexadecimal notation was chosen for these reasons:


 It is easier to turn hexadecimal into binary.
 It is very easy to turn binary into hexadecimal.
 Hexadecimal is much easier to read than binary.
 Hexadecimal numbers take up much less space than binary number.
WHY DO WE USE HEXADECIMAL?
BINARY VS HEXADECIMAL
BINARY VS HEXADECIMAL
MEMORY DUMP
MEMORY DUMP
HTML
HTML
HTML
MAC
MAC
WEB ADDRESS
WEB ADDRESS
ASSEMBLY AND MACHINE CODE

You might also like