CHAPTER 2: NUMBER SYSTEM CONVERSION
The
binary number system is a positional
notation numbering system, but in this case, the base is not ten, but is
instead two. Each digit position in a binary number represents by power of two.
So, when we write a binary number, each binary digit is multiplied by an
appropriate power of 2 based on the position in the number.
In
the decimal number system, there are
ten possible values that can appear in each digit position, and so there are ten
numerals required to represent the quantity in each digit position. The decimal
numerals are the familiar zero through nine (0, 1, 2, 3, 4, 5, 6, 7, 8, 9).
In
addition to binary, another number base that is commonly used in digital
systems is base 16. This number system is called hexadecimal, and each digit position represents a power of 16. For
any
number base greater than ten, a problem occurs because there are more than ten
symbols needed to represent the numerals for that number base. It is customary
in these cases to use the ten decimal numerals followed by the letters of the
alphabet beginning with A to provide the needed numerals.(0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)
In
this section, the number system conversion between decimal, binary and
hexadecimal number will be shown out.
Decimal
|
Binary
|
Hexadecimal
|
0
|
0
|
0
|
1
|
1
|
1
|
2
|
10
|
2
|
3
|
11
|
3
|
4
|
100
|
4
|
5
|
101
|
5
|
6
|
110
|
6
|
7
|
111
|
7
|
8
|
1000
|
8
|
9
|
1001
|
9
|
10
|
1010
|
A
|
11
|
1011
|
B
|
12
|
1100
|
C
|
13
|
1101
|
D
|
14
|
1110
|
E
|
15
|
1111
|
F
|
Table
1:
Number system conversion
1.1
Conversion from decimal number to binary number.
Example:
Convert decimal number 101.6875 to binary number.
Weight
|
26
|
25
|
24
|
23
|
22
|
21
|
20
|
2-1
|
2-2
|
2-3
|
2-4
|
Value
Represented
|
64
|
32
|
16
|
8
|
4
|
2
|
1
|
0.5
|
0.25
|
0.125
|
0.0625
|
Binary
|
1
|
1
|
0
|
0
|
1
|
0
|
1
|
1
|
0
|
1
|
1
|
For
the non-decimal point,
101-64
= 37 →
37-32 = 5 → 5-4 = 1
→ 1-1 = 0
For
the decimal point,
0.6875-0.5
= 0.1875 → 0.1875-0.125 = 0.0625 → 0.0625-0.0625
= 0
Then,
fill in the binary row with 1 if we have
used the value represented and fill in binary column with 0 if we did not use corresponding value represented.
Therefore,
101.687510 = 1100101.10112
*Note: Take the closer number of value represented
to do subtraction.
1.2
Conversion from binary number to decimal number.
For
example: Convert 10101102 to decimal.
1
0 1 0 1 1 02
\ \ \ \________1
x 21 = 2
\ \
\_________1 x 22 = 4
\ \___________1 x 24 = 16
\_____________1 x 26 = 64
Therefore,
10101102 = (2+4+16+64) = 8610
2.1
Conversion from decimal to hexadecimal number.
Example:
Convert 3456.12510 to hexadecimal number.
Weight
|
163
|
162
|
161
|
160
|
16-1
|
16-2
|
Value
Represented
|
4096
|
256
|
16
|
1
|
0.0625
|
0.00390625
|
Hexadecimal
|
|
D(13)
|
8
|
0
|
2
|
|
For
the non-decimal point,
3456
– (256 x 13) = 3456 -3328 → 128 – (16
x 8) = 128 - 128
=
128 = 0
For
the decimal point,
0.125
– (0.0625 x 2) = 0
Therefore,
3456.12510 = D80.2 (Refer to
Table 1, D = 13 in hexadecimal number.)
*Note: Take the closer number of value represented
to do subtraction.
2.2
Conversion from hexadecimal number to decimal number.
Example:
Convert E23C16 to decimal number.
E23C16
= (14 x 163) + (2 x 162)
+ (3 x 161) + (12x160)
= 57344+512+48+12
= 5791610
Refer
to Table 1, E=1410 and C=1210 in hexadecimal number
system.
Therefore,
E23C16 = 5791610
3.1
Conversion from hexadecimal number to binary number.
Example:
Convert the hexadecimal number 543F into binary number.
5 4 3 F
0101 0100 0011 1111
Therefore,
543F = 01010100001111112
Note:
In this case, divide the hex number into 4 digits and convert it into binary
number according to the Table 1.
3.2
Conversion from binary number to hexadecimal number.
Example: Convert 1011011100012
into hexadecimal number.
1011 0111 0001
B 7 1
Therefore,
1011011100012 = B7116
Note: Divide the
binary number into few parts and each part contain 4 numbers only and convert
it into hex number (refer to the Table 1).
The reason for the common use of
hexadecimal numbers is the relationship between the numbers 2 and 16. Sixteen
is a power of 2 (16 = 24). Because of this relationship, four digits
in a binary number can be represented with a single hexadecimal digit. This
makes conversion between binary and hexadecimal numbers very easy, and
hexadecimal can be used to write large binary numbers with much fewer digits.
Furthermore, working with large digital systems, such as computers, it is
common to find binary numbers with 8, 16 and even 32 digits.
Last but not least, the numbers can be written with fewer digits and much less
likelihood of error by using hexadecimal number.
Written by: Sim Fu Cheng (B031210069)
0 comments:
Post a Comment