0% found this document useful (0 votes)
471 views16 pages

Number Base Conversion (Lec3)

The document discusses number base conversion between decimal, binary, octal, and hexadecimal number systems. It provides examples and steps for converting between these number systems. Conversions include breaking numbers into groupings based on their bases, then replacing values with their equivalent in the target base. Decimal to other base conversions use successive division, while other bases to decimal uses successive multiplication.

Uploaded by

Md ridoy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
471 views16 pages

Number Base Conversion (Lec3)

The document discusses number base conversion between decimal, binary, octal, and hexadecimal number systems. It provides examples and steps for converting between these number systems. Conversions include breaking numbers into groupings based on their bases, then replacing values with their equivalent in the target base. Decimal to other base conversions use successive division, while other bases to decimal uses successive multiplication.

Uploaded by

Md ridoy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Digital logic circuit design Lec.

(3)
 

Number base conversion


The human being use decimal number system while computer uses
binary number system. Therefore it is necessary to convert decimal
number into its binary equivalent while feeding number into the
computer and to convert binary into its decimal equivalent while
displaying result of operation to the human beings. However, dealing
with a large quantity of binary number of many bits is in convenient for
human beings, therefore, octal and hexadecimal numbers are used as
shorthand means of expression large binary numbers. But it is necessary
to keep in mind that the digital circuits and systems work strictly in
binary; we are octal and hexadecimal only as a convenience for the
operators of the system before going to see conversions between binary,
octal and hexadecimal numbers we see the number of digits in several
number systems. Table below shows the decimal, binary, octal and
hexadecimal numbers.

Decimal Binary Octal Hexadecimal


0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7

  1 
Digital logic circuit design Lec. (3)
 

8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F

1- Binary to octal conversion


We know that the base for octal is 8 and the base for binary is 2.
The base for octal number is the third power of the base for binary
number and therefore, by grouping 3 digits of binary number and then
converting each group digits to its octal equivalent we can convert
binary number to its octal equivalent.
Ex. (1) Convert (111101100)2 to octal equivalent?
Sol.
111 101 100
7 5 4 .; Octal number = (754)8

2- Octal to binary conversion


Conversion from octal to binary is a reversal of the process
explained in the previous section. Each digit of the octal number is
individually converted to its binary equivalent to get octal to binary
conversion of the number.

  2 
Digital logic circuit design Lec. (3)
 

Ex. (2) Convert (634)8 to binary equivalent?


Sol.
6 3 4
110 011 100 .; Binary number = (110011100)2
Ex. (3) Convert (725.63)8 to binary equivalent?
Sol.
7 2 5 . 6 3
111 010 101 . 110 011
.: Binary number = (111010101.110011)2

3- Binary to hexadecimal conversion


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.
Ex. (4) Convert (1100101001010111)2 to hexadecimal equivalent?
Sol.
1100101001010111 = 1100 1010 0101 0111
C A 5 7
.: Hexadecimal number = (CA57)16
 Note: each group must be four bits.

  3 
Digital logic circuit design Lec. (3)
 

4- Hexadecimal – to – Binary Conversion


Reverse the process and replace each hexadecimal symbol with the
appropriate four bits.
Ex. (5) Convert (10AF)16 to binary equivalent?
Sol.
10AF = 1 0 A F
0001 0000 1010 1111
.: Binary number = (0001000010101111)2

5- Octal to hexadecimal conversion


The easiest way to convert octal number to hexadecimal number is
given below:
1- Convert octal number to its binary equivalent.
2- Convert binary number to its hexadecimal equivalent.
Ex. (6) Convert (615)8 to hexadecimal equivalent?
Sol.
 Step1 octal to binary 6 1 5
110 001 101
Binary number = 110001101
 Step2 binary to hexadecimal 0001 1000 1101
1 8 D
.: Hexadecimal number = (18D)16

  4 
Digital logic circuit design Lec. (3)
 

6- Hexadecimal to octal conversion


The easiest way to convert hexadecimal number to octal number is
given below:
1- Convert hexadecimal number to its binary equivalent.
2- Convert binary number to its octal equivalent.
Ex. (7) Convert (25B)16 to octal equivalent?
Sol.
 Step1 hexadecimal to binary 2 5 B
0010 0101 1011
Binary number = 001001011011
 Step2 binary to octal 001 001 011 011
1 1 3 3
.: Octal number = (1133)8

Converting of any radix to decimal


Ex. (8) Convert the binary number (1101.1) to its decimal equivalent?
1 2 1 2 0 2 1 2 1 2
8 4 0 1 0.5= (13.5)10
Ex. (9) Convert (475.25)8 to its decimal equivalent?
4 8 7 8 5 8 2 8 5 8
256 56 5 0.25 0.078125 = (317.32814)10

  5 
Digital logic circuit design Lec. (3)
 

Ex. (10) Convert (9B2.1A)H to its decimal equivalent?


9 16 11 16 2 16 1 16 10 16
2304 176 2 0.0625 0.039 = (2482.1)10
Ex. (11) Convert (3102.12)4 to its decimal equivalent?
3 4 1 4 0 4 2 4 1 4 2 4
192 16 0 2 0.25 0.125 = (210.375)10
Ex. (12) Convert (214.15)7 to its decimal equivalent?
2 7 1 7 4 7 1 7 5 7
294 7 4 0.142857 0.102 = (305.24486)10

Converting of decimal number to any radix numbers


We have to carry out the conversion of decimal number to any radix
number in two steps. In step 1 we have to convert integer part and in
step 2 we have to convert fractional part. The conversion of integer part
is accomplished by successive division method, and the conversion of
fractional part is accomplished by successive multiplication method. Let
us discuss these two methods.

1) Successive division for integer part conversion


In this method we repeatedly divide the integer part of the decimal
number by (new radix) until quotient is zero. The remainders are taken
in the reverse order to form a new radix number. This means that the
first remainder is the least significant bit (LSB) and the last remainder is
the most significant bit (MSB)in the new radix number . this procedure
is illustrated in following examples.

  6 
Digital logic circuit design Lec. (3)
 

Ex. (13) Convert decimal number (37) to its binary equivalent?


Sol. Here (r) is (2)

Divide 37 by 2 18

2 37 R

36

1 1 (LSB)

Divide 18 by 2 9

2 18

18

0 0 Q R

Divide 9 by 2 4
2 37 1 (LSB)
2 9
2 18 0
8

1 1 2 9 1

Divide 4 by 2 2 ≡ 2 4 0
2 4
2 2 0
4
2 1 1 (MSB)
0 0

Divide 2 by 2 1 0

2 2

2 Note: Q; Quotient.

0 0 R; Remainder.

Divide 1 by 2 0

2 1

1 1 (MSB) Binary equivalent =(100101)2

Ex. (14) Convert decimal number (214) to its octal equivalent?

  7 
Digital logic circuit design Lec. (3)
 

Sol. Here; (r) is (8)


Divide 214 by 8 26 R

8 214

208

6 6 LSB

Divide 26 by 8 3
Q R
8 26
8 214 6 (LSB)
24

2 2 ≡ 8 26 2

8 3 3 (MSB)
Divide 3 by 8 0
0
8 3

3 3 MSB

Octal equivalent=(326)8
Ex. (15) Convert decimal number (3509) to its hexadecimal
equivalent?
Sol. Here; (r) is (16)
Divide 3509 by 16 219 R

16 3509

3504

5 5 LSB

Divide 219 by 16 13

16 219

208

  8 
Digital logic circuit design Lec. (3)
 
Q R
11 B

Divide 13 by 16 0 16 3509 5 (MSB)

16 13 ≡ 16 219 11(B)
0
16 13 13(D)(LSB)
13 D MSB
0
Hexadecimal equivalent=(DB5)16

Ex. (16) Convert (54)10 to radix 4?


Sol. Here; (r) is (4)
Divide 54 by 4 13 R

4 54

52

2 2 LSB

Divide 13 by 4 3
Q R
4 13
4 54 2 (LSB)
12

1 1 ≡ 4 13 1

Divide 3 by 4 0 4 3 3 (MSB)
4 3

0 0

3 3 MSB

Radix 4 equivalent=(312)4

1- Successive multiplication for fractional part conversion

  9 
Digital logic circuit design Lec. (3)
 

Conversion of fractional –decimal numbers to another radix


number is accomplished using a successive multiplication method. In
this method the number to be converted is multiplied by the radix of the
new number proceeding product that has an integer part and fractional
part. The integer part (carry) of the product becomes a numeral in the
new radix number. The fractional part is again multiplied by the radix
and this process is repeated until fractional part reaches zero or until the
new radix number is carried out to sufficient digits. The integer part
(carry) of each product is read downward to represent the new radix
number. This illustrated in the following examples.

Ex. (17) Convert decimal number (0.8125) to its binary


equivalent?
Sol.
Fraction Radix Result Recoded carries
0.8125 × 2 = 1.625 = 0.625 with a carry of 1 (MSB)

0.625 × 2 = 1.25 = 0.25 with a carry of 1

0.25 × 2 = 0.5 = 0.5 with a carry of 0

0.5 × 2 = 1.0 = 0.0 with a carry of 1 (LEB)

Binary fraction =0.1101, witch is equivalent to 0.8125 decimal.

Ex. (18) Convert decimal number (0.95) to its binary


equivalent?
Sol.

  10 
Digital logic circuit design Lec. (3)
 

Fraction Radix Result Recoded carries


0.95 × 2 = 1.9 = 0.9 with a carry of 1 (MSB)

0.9 × 2 = 1.8 = 0.8 with a carry of 1

0.8 × 2 = 1.6 = 0.6 with a carry of 1

0.6 × 2 = 1.2 = 0.2 with a carry of 1

0.2 × 2 = 0.4 = 0.4 with a carry of 0

0.4 × 2 = 0.8 = 0.8 with a carry of 0

0.8 × 2 = 1.6 = 0.6 with a carry of 1 (LSB)

In this case; 0.8 is repeated and if new multiply further, we will get
repeated sequence. If we stop here, we get 7 binary digits, 1111001. This
answer is approximate answer. To get more accurate answer we have to
continue multiplying by 2 until we have as many digits as necessary for
our application.
Binary fraction =0. 1111001, witch is equivalent to 0.8125 decimal.

Ex. (19) Convert decimal number (0.640625) to its octal


equivalent?
Sol.
Fraction Radix Result Recoded carries
0. 640625 × 8 = 5.125 = 0.125 with a carry of 5 (MSB)

0.125 × 8 = 1 = 0.0 with a carry of 1 (LSB)

  11 
Digital logic circuit design Lec. (3)
 

Octal fraction =0. 51, witch is equivalent to 0. 640625 decimal.

Ex. (20) Convert decimal number (0.1289062) to its hex


equivalent?
Sol.
Fraction Radix Result Recoded carries
0.1289062 × 16 = 2.0625 = 0.0625 with a carry of 2 (MSB)

0.0625 × 16 = 1 = 0.0 with a carry of 1 (LSB)

Hexadecimal fraction =0. 21, witch is equivalent to 0.1289062 decimal.

Ex. (21) Convert decimal number (24.6) to a binary


equivalent?
Sol.
Step 1: Separate out integer and fraction part
Integer part= 24 Fractional part= 0.6
Step 2: Find equivalent binary number for integer part:

Divide 24 by 2 12 R

2 24

24

0 0 LSB

Q R

2 24 0 (LSB)

2 12 0

  12 
Digital logic circuit design Lec. (3)
 

Divide 12 by 2 6
2 6 0
2 12

12 2 3 1
2 1 1 (MSB)
0 0 ≡

Divide 6 by 2 3 0

2 6

0 0

Divide 3 by 3 1

2 3

1 1

Divide 1 by 2 0

2 1

1 1 MSB

Binary equivalent for integer part =(11000)2


Step 3: Find equivalent binary number for fractional part:
Fraction Radix Result Recoded carries
0.6 × 2 = 1.2 = 0.2 with a carry of 1 (MSB)

0.2 × 2 = 0.4 = 0.4 with a carry of 0

0.4 × 2 = 0.8 = 0.8 with a carry of 0

0.8 × 2 = 1.6 = 0.6 with a carry of 1

0.6 × 2 = 1.2 = 0.2 with a carry of 1 (LSB)

  13 
Digital logic circuit design Lec. (3)
 

Binary equivalent =11000.10011. This number is an approximation of


decimal 24.6 , because we have terminated the conversion of fraction
part after 5 digits .

Ex. (22) Convert decimal number (35.45) to octal number?


Sol.
Step 1: Separate out integer and fraction part
Integer part= 35 Fractional part= 0.45
Step 2: Find equivalent octal number for integer part:

Divide 35 by 8 4 R

8 35

32

3 3 LSB Q R

Divide 12 by 2 0
8 35 3 (LSB)
8 4 ≡
8 4 4 (MSB)
0 0
4 4 MSB

Octal equivalent for integer part =(43)8

Step 3: Find equivalent binary number for fractional part:


Fraction Radix Result Recoded carries
0.45 × 8 = 3.6 = 0.6 with a carry of 3 (MSB)

  14 
Digital logic circuit design Lec. (3)
 

0.6 × 8 = 4.8 = 0.8 with a carry of 4

0.8 × 8 = 6.4 = 0.4 with a carry of 6

0.4 × 8 = 3.2 = 0.2 with a carry of 3

0.2 × 8 = 1.6 = 0.6 with a carry of 1 (LSB)

Octal equivalent =43.34613. This number is an approximation of


decimal 35.45, because we have terminated the conversion of fraction
part after 5 digits.

Ex. (23) Convert decimal number (22.64) to hexadecimal


number?
Sol.
Step 1: Separate out integer and fraction part
Integer part= 22 Fractional part= 0.64
Step 2: Find equivalent hexadecimal number for integer part:
Divide 22 by 16 1 R

16 22

16

6 6 LSB Q R

Divide 12 by 2 0 16 22 6 (LSB)

16 1 ≡ 16 1 1 (MSB)
0
0

1 1 MSB

Hexadecimal equivalent for integer part =(16)16


Step 3: Find equivalent hexadecimal number for fractional part:
Fraction Radix Result Recoded carries
0.64 × 16 = 0.24 with a carry of 10(A) (MSB)

  15 
Digital logic circuit design Lec. (3)
 

0.24 × 16 = 0.84 with a carry of 3

0.84 × 16 = 0.44 with a carry of 13(D)

0.44 × 16 = 0.04 with a carry of 7 (LSB)

Hexadecimal equivalent =(16.A3D7)16 This number is an approximation


of decimal 22.64, because we have terminated the conversion of fraction
part after 4 digits.

  16 

You might also like