Hexadecimal Number Systems: Digital Electronics
Hexadecimal Number Systems: Digital Electronics
Number Systems
Digital Electronics
What, More Number Systems?
Why do we need more number systems?
• Humans understand decimal
Check out my ten digits !
• Since computers have 32, 64, and even 128 bit busses, displaying
numbers in binary is cumbersome.
• Data on a 32 bit data bus would look like the following:
0110 1001 0111 0001 0011 0100 1100 1010
• Hexadecimal (base 16) and octal (base 8) number systems are
used to represent binary data in a more compact form.
• This presentation will present an overview of the process for
converting numbers between the decimal number system and the
hexadecimal & octal number systems. 2
Converting To and From Decimal
Decimal10
0123456789
Weighted
Multiplication
Successive
Division
Successive Weighted
Division Multiplication
Hexadecimal16
0123456789ABCDEF
Binary2
01
3
Counting . . . 2, 8, 10, 16
Decimal Binary Hexadecimal
0 00000 0
1 00001 1
2 00010 2
3 00011 3
4 00100 4
5 00101 5
6 00110 6
7 00111 7
8 01000 8
9 01001 9
10 01010 A
11 01011 B
12 01100 C
13 01101 D
14 01110 E
15 01111 F
16 10000 10
17 10001 11
18 10010 12 4
19 10011 13
Review: Decimal ↔ Binary
Successive
Division
a) Divide the decimal number by 2; the remainder is the LSB of the binary
number.
b) If the quotation is zero, the conversion is complete. Otherwise repeat step
(a) using the quotation as the decimal number. The new remainder is the
next most significant bit of the binary number.
Weighted
Multiplication
Successive
Division
a) Divide the decimal number by N; the remainder is the LSB of the ANY
BASE Number .
b) If the quotient is zero, the conversion is complete. Otherwise repeat step
(a) using the quotient as the decimal number. The new remainder is the
next most significant bit of the ANY BASE number.
Weighted
Multiplication
a) Multiply each bit of the ANY BASE number by its corresponding bit-
weighting factor (i.e., Bit-0→N0; Bit-1→N1; Bit-2→N2; etc).
b) Sum up all of the products in step (a) to get the decimal number.
6
Decimal ↔ Hexadecimal Conversion
The Process: Successive Division
• Divide the decimal number by 16; the remainder is the LSB of the
hexadecimal number.
• If the quotation is zero, the conversion is complete. Otherwise
repeat step (a) using the quotation as the decimal number. The
new remainder is the next most significant bit of the hexadecimal
number.
Example:
Convert the decimal number 9410 into its hexadecimal equivalent.
5
16 94 r E LSB
0
16 5 r 5 MSB
9410 = 5E16
7
Example: Dec → Hex
Example:
Convert the decimal number 42910 into its hexadecimal equivalent.
8
Example: Dec → Hex
Example:
Convert the decimal number 42910 into its hexadecimal equivalent.
Solution:
26
16 429 r D (13) LSB
1
16 26 r A (10) 42910 = 1AD16 = 1ADH
0
16 1 r 1 MSB
9
Hexadecimal ↔ Decimal Process
The Process: Weighted Multiplication
• Multiply each bit of the hexadecimal number by its
corresponding bit-weighting factor (i.e., Bit-0→160=1; Bit-
1→161=16; Bit-2→162=256; etc.).
• Sum up all of the products in step (a) to get the decimal number.
Example:
Convert the octal number 5E16 into its decimal equivalent.
5 E
161 160 5E 16 = 9410
Bit-Weighting
16 1 Factors
80 + 14 = 9410
10
Example: Hex → Dec
Example:
Convert the hexadecimal number B2EH into its decimal equivalent.
11
Example: Hex → Dec
Example:
Convert the hexadecimal number B2EH into its decimal equivalent.
Solution:
B 2 E
162 161 160
256 16 1
B2EH = 286210
2816 + 32 + 14 = 286210
12
Binary ↔ Hex Shortcut
Because binary and hex number systems are all powers of two (which is
the reason we use them) there is a relationship that we can exploit to
make conversion easier.
0 1 0 1 1 0 1 0 2= 5 A 16
5 A 0101 1 010
13
Example: Binary ↔ Hex
Example:
Using the shortcut technique, convert the hexadecimal number A616
into its binary and octal equivalent. Use your calculator to check your
answers.
14
Example: Binary↔ Hex
Example:
Using the shortcut technique, convert the hexadecimal number A616
into its binary & octal equivalent. Use your calculator to check your
answers.
Solution:
First convert the hexadecimal number into binary by expanding the
hexadecimal digits into binary groups of (4).
A 6 16
A616 = 101001102
1010 0110
15
Youtube Video
https://www.youtube.com/watch?v=tSLKOKGQq0Y
16