2. Outlines
Base of Number Systems
Decimal Numbers
Binary Numbers
MSB and LSB
Binary to Decimal Conversion
Decimal To Binary Conversion
Hexadecimal Numbers
Conversions
Octal Numbers
Conversions
3. Number Systems
The numeric system we use daily is the decimal system,
but this system is not convenient for machines
since the information is handled codified in the shape of On or Off bits;
A base of a number system defines the range of values that a digit may have. For example,
base 2 Binary number has only Two different values (0 and 1).
base 10 Decimal number has Ten different values (0,1,2,3,4,5,6,7,8 and 9).
And etc.…
4. Decimal Numbers
The position of each digit in a weighted number system is assigned a weight based on the base
of the system.
The base of decimal numbers is ten, because only ten symbols (0 through 9) are used to represent any
number.
The column weights of decimal numbers are powers of ten that increase from right to left
beginning with 100 =1:
105 104 103 102 101 100
For fractional decimal numbers, the column weights are negative powers of ten that decrease
from left to right:
102 101 100. 10-1 10-2 10-3 10-4
5. Decimal Numbers
Decimal numbers can be expressed as the sum of the products of each digit times the column
value for that digit.
Thus, the number 9240 can be expressed as
Example: Express the number 480.52 as the sum of values of each digit.
(9 x 103) + (2 x 102) + (4 x 101) + (0 x 100)
or
9 x 1,000 + 2 x 100 + 4 x 10 + 0 x 1
480.52 = (4 x 102) + (8 x 101) + (0 x 100) + (5 x 10-1) +(2 x 10-2)
6. Binary Numbers
For digital systems, the binary number system is used. Binary has a radix of two and uses the
digits 0 and 1 to represent quantities.
The column weights of binary numbers are powers of two that increase from right to left
beginning with 20 =1:
…25 24 23 22 21 20.
For fractional binary numbers, the column weights are negative powers of two that decrease
from left to right:
22 21 20. 2-1 2-2 2-3 2-4 …
7. LSB and MSB
Binary number can be a stream of 0 and 1
For Example :
10010010
010101
111001
1101100
The first bit from the left is called Most Significant Bit (MSB)
Because of its significance on the number.
The first bit from the right is called Least Significant Bit (LSB)
Because of its low significance on the number.
1001101
MSB LSB
Second MSB
8. Binary-to-Decimal Conversion
The decimal equivalent of a binary number can be determined by adding the column values of
all of the bits that are 1 and discarding all of the bits that are 0.
Example: Convert the binary number 100101.01 to decimal.
Solution:
10. Decimal-to-Binary Conversion
You can convert a decimal whole number to binary by reversing the procedure.
Write the decimal weight of each column and place 1’s in the columns that sum to the decimal
number This Method is called Sum - Of - Weights Method.
Example : Convert the decimal number 49 to binary.
Solution :
The column weights double in each position to the right.
Write down column weights until the last number is larger than the one you want to convert.
11. Decimal-to-Binary Conversion
Repeated Division-by-2 Method
A systematic method of converting whole numbers from decimal to binary is the repeated
division-by-2 process.
For example, to convert the decimal number 12 to binary,
begin by dividing 12 by 2.
Then divide each resulting quotient by 2 until there is a 0 whole-number quotient.
The remainders generated by each division form the binary number.
The first remainder to be produced is the LSB (least significant bit) in the binary number,
and the last remainder to be produced is the MSB (most significant bit).
This procedure is shown in the following steps for converting the decimal number 12 to binary.
14. Decimal-to-Binary Conversion
Converting Decimal Fractions to Binary
Sum-oF-Weights
The sum-of-weights method can be applied to fractional decimal numbers, as shown in the
following example:
0.625 = 0.5 + 0.125 = 2-1 + 2-3 = 0.101
There is a 1 in the 2-1 position, a 0 in the 2-2 position, and a 1 in the 2-3 position.
15. Decimal-to-Binary Conversion
Repeated Multiplication by 2
As you have seen, decimal whole numbers can be converted to binary by
repeated division by 2.
Decimal fractions can be converted to binary by repeated multiplication by 2.
For example, to convert the decimal fraction 0.3125 to binary,
begin by multiplying 0.3125 by 2
and then multiplying each resulting fractional part of the product by 2 until the fractional product is
zero or until the desired number of decimal places is reached.
The carry digits, or carries, generated by the multiplications produce the binary number.
The first carry produced is the MSB, and the last carry is the LSB. This procedure is illustrated as
follows:
18. Hexadecimal Numbers
The hexadecimal number system has sixteen characters.
They are:
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
Hexadecimal is a weighted number system. The column weights are
powers of 16, which increase from right to left.
4096 256 16 1
163 162 161 160
20. Binary-to-Hexadecimal Conversion
Converting a binary number to hexadecimal is a straightforward procedure.
Simply break the binary number into 4-bit groups, starting at the right-most bit and replace each
4-bit group with the equivalent hexadecimal symbol.
21. Hexadecimal-to-Binary Conversion
To convert from a hexadecimal number to a binary number, reverse the process and replace
each hexadecimal symbol with the appropriate four bits.
22. Hexadecimal-to-Decimal Conversion
One way to find the decimal equivalent of a hexadecimal number is
first convert the hexadecimal number to binary and then convert from binary to decimal.
23. Hexadecimal-to-Decimal Conversion
Another way to convert a hexadecimal number to its decimal equivalent is
multiply the decimal value of each hexadecimal digit by its weight and then take the sum of
these products.
The weights of a hexadecimal number are increasing powers of 16 (from right to left).
For a 4-digit hexadecimal number, the weights are
4096 256 16 1
163 162 161 160
24. Hexadecimal-to-Decimal Conversion
Example : Express 1A2F16 in decimal.
Solution :
Start by writing the column weights:
4096 256 16 1
( 1 A 2 F)16
= 1(4096) + 10(256) +2(16) +15(1) = 6703
25. Decimal-to-Hexadecimal Conversion
Repeated division of a decimal number by 16 will produce the equivalent hexadecimal number,
formed by the remainders of the divisions.
The first remainder produced is the least significant Digit (LSD).
Each successive division by 16 yields a remainder that becomes a digit in the equivalent
hexadecimal number.
27. Octal Numbers
Like the hexadecimal number system, the octal number system provides a convenient way to
express binary numbers and codes.
The octal number system is composed of eight digits, which are
0, I, 2, 3, 4, 5, 6, 7
28. Octal-to-Decimal Conversion
Since the octal number system has a base of eight,
each successive digit position is an increasing power of eight, beginning in the right-most
column with 8°.
The evaluation of an octal number in terms of its decimal equivalent is accomplished by
multiplying each digit by its weight and summing the products,
as illustrated here for (2374),
30. Octal-to-Binary Conversion
Because each octal digit can be represented by a 3-bit binary number, it is very easy to convert
from octal to binary. Each octal digit is represented by three bits as shown below.
To convert an octal number to a binary number, simply replace each octal digit with the
appropriate three bits.
31. Binary-to-Octal Conversion
Conversion of a binary number to an octal number is the reverse of the
octal-to-binary conversion.
The procedure is as follows:
Start with the right-most group of three bits and, moving from right to left,
convert each 3-bit group to the equivalent octal digit.
If there are not three bits available for the left-most group, add either one or two
zeroes to make a complete group.
These leading zeroes do not affect the value of the binary number