Microprocessor Based Systems
Session 5
Content:
1. Numbering systems
a. Binary to Decimal & Hexadecimal
b. Decimal to Hexadecimal & Binary
c. Octal to Decimal, Hexa & Binary
Microprocessor –Session5- Eng.Ahmed Abdel-Gawad 1
Q- Compare between Decimal, Binary and Hexadecimal.
Decimal Binary Hexadecimal
(Base 10) (Base 2) (Base 16)
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15Microprocessor –Session5-
1111Eng.Ahmed Abdel-Gawad F 2
Q- Convert the following numbers. (Binary to Decimal & Hexadecimal)
• 1011 2 to Decimal and Hexadecimal numbers.
1011 2 = 1𝑥23 + 0𝑥22 + 1𝑥21 + 1𝑥20 = 11 10
1011 2 = 1𝑥23 + 0𝑥22 + 1𝑥21 + 1𝑥20 = 11 ÷ 16 = 11 = (𝐵)16
• 1011.101 2 to Decimal and Hexadecimal numbers.
1011.101 2 = 1𝑥23 + 0𝑥22 + 1𝑥21 + 1𝑥20 + 1𝑥2−1 + 0𝑥2−2 + 1𝑥2−3 = 11.625 10
11.625 10 = 11 → 𝐵16 , 0.625 ∗ 16 = 10 = 𝐴16
11.625 10 = 𝐵. 𝐴 16
Microprocessor –Session5- Eng.Ahmed Abdel-Gawad 3
Q- Convert the following numbers. (Decimal to Hexadecimal & Binary)
• 315 10 to Binary and Hexadecimal numbers.
Division Result Reminder
315/2 157 1 Division Result Reminder
157/2 78 1 315/16 19 11
78/2 39 0 19/16 1 3
39/2 19 1 1/16 0 1
19/2 9 1
315 10 = 13𝐵 2
9/2 4 1
4/2 2 0
2/2 1 0
1/2 0 1
315 10 = 100111011 2 Microprocessor –Session5- Eng.Ahmed Abdel-Gawad 4
Q- Convert the following numbers. (Decimal to Hexadecimal & Binary)
• 315.25 10 to Binary and Hexadecimal numbers.
Division Result Reminder
315.5*22 1261 Division Result Reminder
1261/2 630 1
315.25*161 5044
630/2 315 0
315/2 157 1 5044/16 4 0
157/2 78 1 315/16 19 11
78/2 39 0
19/16 1 3
39/2 19 1
1/16 0 1
19/2 9 1
9/2 4 1 315.25 10 = 13𝐵. 4 2
4/2 2 0
2/2 1 0
1/2 0 1
315.25 10 = 100111011.01 2
Microprocessor –Session5- Eng.Ahmed Abdel-Gawad 5
Q- Convert the following numbers. (Octal to Decimal, Hexa & Binary)
• 763 8 to Binary
763 8 = 111 110 011 2
• 763 8 to Hexadecimal
763 8 = 0001 1111 0011 2 = 1𝐹3 16
• 763 8 to Decimal
763 8 = 7𝑥82 + 6𝑥81 + 3𝑥80 = 499 10
Microprocessor –Session5- Eng.Ahmed Abdel-Gawad 6