☰ خطة العام · تكنولوجيا المعلومات والاتصالات (بالإنجليزية)

Hexadecimal and binary together

الأسبوع 5 · الوحدة ١ «النظم العددية» (٥): مثال آخر على التحويل إلى السداسي عشر، ومن السداسي عشر إلى الثنائي ومن الثنائي إلى السداسي عشر · 3 دروس
2

Hexadecimal to binary: four bits for each symbol

ICT Secondary 3 Term 1, Unit 1, Topic 1: pp. 22–26
GoalConvert hexadecimal to binary symbol by symbol.
New words
group of four bits · the 4 bits that stand for one hexadecimal symbollookup table · a table you read the answer from; here 16 rows, symbol and four bitsleading zeros · zeros at the left end of a number; they may be dropped only at the very start of the whole answer
Explanation

Because 16 = 2×2×2×2, one hexadecimal symbol is exactly four bits. To convert hexadecimal to binary, replace each symbol by its group of four bits from the lookup table and put the groups side by side. Every group must have four bits, so write zeros on its left when needed: 7 is 0111, not 111. At the end you may drop the zeros at the very start of the whole answer, but never the zeros inside it. For example (3B)₁₆ is 0011 for the 3 and 1011 for the B, so 00111011, and without the leading zeros (111011)₂, which is 59.

HexadecimalFour bitsDecimal
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
A101010
B101111
C110012
D110113
E111014
F111115
Worked examples
Symbol9C0
Four bits100111000000
Convert (9C0)₁₆. The 9 is 1001, the C is 1100 and the 0 is 0000. The answer is 100111000000: the zeros inside it must stay, and here there are none to drop at the start.
Symbol7F
Four bits01111111
Convert (7F)₁₆. The 7 is 0111 and the F is 1111, so 01111111. The first 0 is at the very start of the whole answer and can be dropped: (1111111)₂, which is 127.
Class activity

Write the 16-row table from memory, from 0000 for 0 up to 1111 for F. Then use it to convert (D4)₁₆ and (2F5)₁₆ to binary.

Practice
1
Convert (A5)₁₆ to binary.
2
Convert (B2)₁₆ to binary.
3
Convert (100)₁₆ to binary.
4
A hexadecimal number has 6 symbols. How many bits does it stand for, keeping all the zeros?
5
Why do we write 7 as 0111 inside a longer answer?