1 Data Representation - L5 - Decimal To Hexadecimal Conversion

You might also like

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

Chapter 1 : Data Representation

Decimal to Hexadecimal
Conversion

5 Number System
Previously we Learned

• Concept of Binary
Numbers
• Base and Range of Binary
numbers
• How to convert a Decimal
to a Binary number.
Decimal Binary Octal Hexadecimal

0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
The table is shows the decimal, binary, 4 0100 4 4

octal, and hexadecimal numbers 5 0101 5 5

from 0 to 15. 6 0110 6 6


7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
LESSON OBJECTIVE

• Why the processors use only


Decimal to HEX Hexadecimal Number system
and how a decimal number is
Conversion converted to a hexadecimal
number?

KEYWORDS SUCCESS CRITERIA


• Base • Able to convert the Decimal
• Power table of 2 number to Hexadecimal
• MSB
Number using the power
• LSB
table.
Hexadecimal Numbers
• These numbers are used extensively in
microprocessor work.

• The hexadecimal number system has a base of


16.
Hexadecimal Numbers
• The range of digits in Hexadecimal number system is :
– 0 to (radix -1)
– 0 to (16-1)
– 0 to 15

• It consists of the following sixteen number of digits.


0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Range of Hexadecimal Numbers

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Decimal to Binary Conversion
• To convert a Denary number to Hexadecimal
we should follow two steps
– Denary to Binary Conversion
– Binary to Hexadecimal Conversion
1. Decimal to Binary Conversion
1. Start by making a power chart of 2.
2. Look for the greatest power of 2.
3. Move to the next lower power of two.
4. Subtract each successive number that can fit, and
mark it with a 1.
5. Continue until you reach the end of your chart.
6. Write out the binary answer.
2. How to Convert Binary to Hex
• Converting from binary to hex is easy since
hexadecimal numbers are simplified versions of binary
strings. You just need to remember that each hex digit
represents four binary digits.

• It follows that four binary digits will be equal to one


hex digit. The method is easier than it sounds but it’s
always useful to use a binary to hex conversion chart to
save time.
2. Algorithm to Convert Binary to Hex

• Step 1: Write down the binary number and group the


digits (0’s and 1’s) in sets of four.
• Step 2: Every group of four in binary will give you one
digit in hexadecimal.
• Step 3: Add the products within each set of four. Write
the sums below the groups they belong to.
• Step 4: The digits you get from the sums in each group
will give you the hexadecimal number, from left to
right.
SUMMARY
Binary integers to Hexadecimal: Algorithm
• Step 1: Write down the binary number and group the
digits (0’s and 1’s) in sets of four.
• Step 2: Every group of four in binary will give you one
digit in hexadecimal.
• Step 3: Add the products within each set of four. Write
the sums below the groups they belong to.
• Step 4: The digits you get from the sums in each group
will give you the hexadecimal number, from left to
right.
PLENARY
Find the Hexadecimal Find the Hexadecimal
Find the Hexadecimal equivalent of the
GROUP 1 equivalent of the Binary equivalent of the Decimal
Decimal number 420
Conversion number 100001000111 number 65

GROUP 2 Find the Hexadecimal Find the Hexadecimal


equivalent of the Binary equivalent of the Decimal Find the Hexadecimal equivalent of the
Conversion number 101110111 number 45 Decimal number 700

Find the Hexadecimal Find the Hexadecimal


GROUP 3 Find the Hexadecimal equivalent of the
equivalent of the Binary equivalent of the Decimal
Decimal number 350
number 101111000111 number 35
Conversion

Evaluation Worksheet
3! 2! 1!

1.

3 Things I 2.
learned
3.

1.
2 Interesting
2.
facts

1 Question
1.

You might also like