Home | | Basic Electrical and Electronics Engineering | Converting Between Binary Numbers and Decimal Numbers

Chapter: Basic Electrical and electronics : Digital Electronics

Converting Between Binary Numbers and Decimal Numbers

We humans about numbers using the decimal number system, whereas computers use the binary number system. We need to be able to readily shift between the binary and decimal number representations.

Converting Between Binary Numbers and Decimal Numbers

 

We humans about numbers using the decimal number system, whereas computers use the binary number system. We need to be able to readily shift between the binary and decimal number representations.

Converting a Binary Number to a Decimal Number

 

To convert a binary number to a decimal number, we simply write the binary number as a sum of powers of 2. For example, to convert the binary number 1011 to a decimal number, we note that the rightmost position is the ones position and the bit value in this position is a 1. So, this rightmost bit has the decimal value of 120 . The next position to the left is the twos position, and the bit value in this position is also a 1. So, this next bit has the decimal value of 1 21 . The next position to the left is the fours position, and the bit value in this position is a 0. The leftmost position is the eights position, and the bit value in this position is a 1. So, this leftmost bit has the decimal value of 123 . Thus:


1. The binary number 110110 as a decimal number. Solution:

For example, to convert the binary number 10101 to decimal, we annotate the position values below the bit values:


Then we add the position values for those positions that have a bit value of 1: 16 + 4 + 1 = 21. Thus

 

101012 = 2110

 

You should “memorize” the binary representations of the decimal digits 0 through 15 shown below.


You may be wondering about the leading zeros in the table above. For example, the decimal number 5 is represented in the table as the binary number 0101. We could have represented the binary equivalent of 5 as 101, 00101, 0000000101, or with any other number of leading zeros. All answers are correct.

 

 

Sometimes, though, you will be given the size of a storage location. When you are given the size of the storage location, include the leading zeros to show all bits in the storage location. For example, if told to represent decimal 5 as an 8-bit binary number, your answer should be 00000101.

 

Converting a Decimal Number to a Binary Number: Method 2

 

The second method of converting a decimal number to a binary number entails repeatedly dividing the decimal number by 2, keeping track of the remainder at each step. To convert the decimal number x to binary:

 

Step 1. Divide x by 2 to obtain a quotient and remainder. The remainder will be 0 or 1.

 

Step 2. If the quotient is zero, you are finished: Proceed to Step 3. Otherwise, go back to Step 1, assigning x to be the value of the most-recent quotient from Step 1.

 

Step 3. The sequence of remainders forms the binary representation of the number.

 

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Basic Electrical and electronics : Digital Electronics : Converting Between Binary Numbers and Decimal Numbers |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.