Decimal Binary Octal Hexadecimal Binary Coded Decimal (BCD)
Decimal Binary Octal Hexadecimal Binary Coded Decimal (BCD)
Binary
Octal
Hexadecimal
Binary Coded Decimal (BCD)
• At the end of this chapter, students should
be able to:-
– Differentiate between decimal, binary, octal,
hexadecimal and BCD.
– Convert number between bases.
10/9/2012 RA/Sept2013-Jan2014 2
10/9/2012 RA/Sept2012-Jan2013 3
Type Base Numbers/Symbols
Decimal 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Binary 2 0, 1
Octal 8 0, 1, 2, 3, 4, 5, 6, 7
Hexadecimal 16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
10/9/2012 RA/Sept2012-Jan2013 4
Binary Octal Decimal Hexadecimal
0 0 0 0
1 1 1 1
10 2 2 2
11 3 3 3
100 4 4 4
101 5 5 5
110 6 6 6
111 7 7 7
1000 10 8 8
1001 11 9 9
1010 12 10 A
1011 13 11 B
1100 14 12 C
1101 15 13 D
1110 16 14 E
10/9/2012 1111 17RA/Sept2012-Jan201315 F 5
10/9/2012 RA/Sept2012-Jan2013 6
Decimal - Binary
Technique:
– Divide the decimal number by 2, keep track of the remainder.
– First remainder is the Least Significant Bit (LSB).
Eg. 8710 = _________ 2
Binary – Decimal
Technique:
– Multiply each hexadecimal number by 2n, where n is the weight of the bit.
– The weight is the position of the bit, starting from 0 on the right. (LSB)
– Then, sum the results. MSB LSB Description
Eg. 10101112 = _________ 10
2
6 5
2 4
23
22
2
1
20
2 Bit Weights
1 0 1 0 1 1 1 Binary Number
= 1*26 + 1*24 + 1*22 + 1*21 + 1*20
= 64 + 16 + 4 + 2 + 1
= 8710
10/9/2012 RA/Sept2012-Jan2013 7
Decimal - Octal
Technique:
– Divide the decimal number by 8, keep track of the remainder.
– First remainder is the Least Significant bit (LSB).
Eg. 26610 = _________ 8
Octal – Decimal
Technique:
– Multiply each octal number by 8n, where n is the weight of the digit.
– The weight is the position of the digit, starting from 0 on the right. (LSD)
– Then, sum the results.
MSD LS Description
Eg. 4128 = _________ 10 D
82 81 80 Bit Weights
4 1 2 Octal Number
10/9/2012 RA/Sept2012-Jan2013 8
Decimal - Hexadecimal
Technique:
– Divide the decimal number by 16, keep track of the remainder.
– First remainder is the Least Significant Digit (LSD).
Eg. 42310 = _________ 16
Hexadecimal – Decimal
Technique:
– Multiply each hexadecimal number by 16n, where n is the weight of the digit.
– The weight is the position of the digit, starting from 0 on the right. (LSD)
– Then, sum the results.
MSD LS Description
Eg. 1A716 = _________ 10
D
162 161 160 Hex Digit Weights
1 A 7 Hex Number
= (1 x 162 ) + (10 x 161) + (7 x 160)
= 256 + 160 + 7
= 42310.
10/9/2012 RA/Sept2012-Jan2013 9
Decimal - BCD
Technique:
Replace each decimal digit (0 – 9) with a 4-bit BCD code. Decimal BCD
Eg. 87410 = _________ BCD 0 0000
MSD LSD Description
1 0001
8 7 4 Decimal Number
1000 0111 0100 BCD Code 2 0010
3 0011
Therefore, 87410 = 100001110100BCD
4 0100
BCD – Decimal 5 0101
Technique: 6 0110
Replace each 4 bits BCD digit with a decimal number. 7 0111
Eg. 0001100101111000BCD = _________ 10 8 1000
MSD LSD Description 9 1001
0001 1001 0111 1000 BCD Code
1 9 7 8 Decimal Number
10/9/2012 RA/Sept2012-Jan2013 10
Therefore, 0001100101111000 = 1978
Binary - Octal
Technique:
- Group bits in threes, starting from right (LSB).
- Then, convert to octal.
MSD LS Description
D
Eg. 110101102 = _________ 8 011 010 110 Binary number
3 2 6 Octal number
Octal – Binary
Technique:
- Replace each octal digit with 3-bit binary number.
MSD LS Description
Eg. 4728 = _________ 2 D
4 7 2 Octal number
100 111 010 Binary number
Technique:
- Group bits in fours, starting from right (LSB).
- Then, convert to hexadecimal.
MSD LSD Description
Eg. 101111110101102 = _________ 16
0010 1111 1101 0110 Binary Number
2 F D 6 Hex Number
Hexadecimal – Binary
Technique:
- Replace each octal digit with 4-bit binary number.
MSD LSD Description
Eg. 1A716 = _________ 2 1 A 7 Hex Number
0001 1010 0110 Binary Number
Technique:
- Use binary as an intermediary. Description
1 7 4 . 3 6 Octal number
Eg. 174.368 = _________ 16
001 111 100 . 011 110 Binary number
7 C . 7 8 Hexadecimal number
Hexadecimal - Octal
Technique:
- Use binary as an intermediary.
Description
Eg. 7C.7816 = _________ 8
7 C . 7 8 Hexadecimal number
10/9/2012 RA/Sept2012-Jan2013 13
Decimal - Binary
10/9/2012 RA/Sept2012-Jan2013 14
2. Then, convert the fraction:
(Take 0)
(Take 1)
(Take 1)
10/9/2012 RA/Sept2012-Jan2013 15
Binary - Decimal
Technique:
– Multiply each binary number by 2-n, where -n is the weight of the bit for fraction
starting from left to right. .
– Then, sum the results.
Eg. 1010.012 = _________ 10
10/9/2012 RA/Sept2012-Jan2013 16
Octal – Decimal
Technique:
– Multiply each octal number by 8-n, where -n is the weight of the bit for fraction
starting from left to right. .
– Then, sum the results.
Eg. 46.38 = _________ 10
46.38 = 4 x 81 + 6 x 80 + 3 x 8-1
= 38 + 0.375
= 38.375 10
Therefore, 46.38 = 38.37510
10/9/2012 RA/Sept2012-Jan2013 17
Hexadecimal - Decimal
Technique:
– Multiply each hexadecimal number by 16 -n, where -n is the weight of the bit for
fraction starting from left to right. .
– Then, sum the results.
Eg. A7.0F16 = _________ 10
10/9/2012 RA/Sept2012-Jan2013 18
BCD – Binary, Octal, Hexadecimal
Technique:
– First, convert the BCD number to decimal.
– Then, convert the decimal number to the indicated base .
Eg. 01011000BCD = _________ 8
Technique:
– First, convert the indicated base to decimal.
– Then, convert the decimal number to BCD.
Eg. E216 = _________ BCD
1. 10101112
2. BACA16
3. 10010011BCD
4. 3248
5. 69410
10/9/2012 RA/Sept2012-Jan2013 20