Number systems & their interconversion

It was mentioned in our previous section (can be viewed here.) that digital quantities are represented by the symbols and digits. There are different systems of numbers and codes to represent these symbols and digits. In this section, we will be looking at these number systems. Different codes to represent digital quantities will be covered in next section.
Major systems of numbers are as follows:
  • Decimal System
  • Binary System
  • Hexadecimal System
  • Octal System
Here is the description of all these systems.
Decimal System:
The most familiar system of number is “Decimal System”, that is the system with the base “10”, which we use in our daily life for counting and general daily life calculations. It will be covered only in due detail. It is important to note that there are only ten (10) symbols (digits) in this number system i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 so only 10 quantities can be represented using these symbols. These symbols are then appended with each other to get the number which represent larger quantities. For example, if someone wants to count in decimal system, it is only possible to count up to “9” with the help of these symbols. After “9”, the next symbol which can represent the quantity greater than 9 can be got using two symbols out of the given 10 symbols. So, after 9, the next symbol is acquired due to the fact that digit at unit place (of previous number i.e. 9) overflows to get “0” and, to show this overflow, a “1” is appended to the left that is at “tens” place. This process continues till the reading reaches “19”. After that, same thing happens. “0” will be inserted at unit place and “1” is added to the number at “tens” place hence the number “20” forms. This process continues till the time one wants to count.
Now, to understand the quantity represented by the decimal numbers and to find its value, we introduce the term “weight” here. Weight of any symbol in a whole number is the magnitude of quantity represented by that specific symbol with respect to its position in that number. For example, weight of a symbol at a unit place in a whole number represented in decimal system is “100”. Similarly, for symbol at tens place, weight will be “101” and so on. This can best understood with the help of these examples:

In 45, weight of 5 is “100” i.e. 1 and 4 is “101” i.e. 10.
In 345, weight of 5 is “100” i.e. 1, 4 is “101” i.e. 10 and 3 is “102” i.e. 100.
For the fractional numbers, the power of ten will be negative for every digit after the decimal point that decrease from left to right after starting from “10-1”. For example:
In 45.32, weight of 4 is “101” i.e. 10, 5 is “100” i.e. 1, 3 is “10-1” i.e. 0.1 and that of 2 is “10-2” i.e. 0.01.
Now that we are familiar with the concept of weight, it is time to learn about the equivalent value of each digit in a decimal number. To get this, we need to simply multiply that specific digit with its weight. For example:
In 45.32, equivalent value of 4 is “4 x 101” i.e. 40, 5 is “5 x 100” i.e. 5, 3 is “3 x 10-1” i.e. 0.3 and that of 2 is “2 x 10-2” i.e. 0.02.
And the final number can be acquired by summing the equivalent values of every digit in a number. To get 45.32, we need to add all the equivalent weights, that is:
40 + 5 + 0.3 + 0.02 = 45.32
Although, decimal number system is most widely used in our daily life but it is not much important in digital systems. It is only explained here to build the basic concepts of counting and getting the next higher order number as the basic theory of these concepts about the numbers, represented in any number system, remains the same. The only difference arises when considering the base, which is also the maximum number of symbols in that system, of that number.

Binary System:
This is a number system with base two, and hence with only two digits, which is used in computations and counting in digital system. This system is far less complicated than decimal system due to only two digits, that is 0 and 1, in whole of this system. A binary digit is also called “Bit”.
Like decimal system, binary counting starts from 0, but, for single digit numbers, it ends at 1. For the number greater than 1, we need to take two digits in account. Therefore, the digit at unit place overflows to 0 and 1 is appended to the left and so on. Binary counting for the numbers with 4 binary digits (bits) is given in the table below.
Decimal Number Binary Numbers

Decimal Number
Binary Numbers
MSB


LSB
0
0
0
0
0
1
0
0
0
1
2
0
0
1
0
3
0
0
1
1
4
0
1
0
0
5
0
1
0
1
6
0
1
1
0
7
0
1
1
1
8
1
0
0
0
9
1
0
0
1
10
1
0
1
0
11
1
0
1
1
12
1
1
0
0
13
1
1
0
1
14
1
1
1
0
15
1
1
1
1

From this table, it is clear that if we want to represent decimal 15, we need 4 bits in binary system. Similarly, with three bits, we can represent the numbers up to decimal 7 and with two bits, numbers up to decimal 3 can be represented. On the basis of these important points, we can deduce a formula for the maximum decimal number which can be represented by the any specific number of bits. So in general form:
If “n” is the number of bits in a binary number, maximum equivalent decimal number which can be represented by them is 2n – 1.
Subtraction of 1 is due to the fact that the first number is always ”0” otherwise, there are total 2n decimal numbers which are represented using “n” bits.
Another noteworthy point in the table above is MSB and LSB. MSB stands for “Most Significant Bit” while LSB is “Least Significant Bit”. The significance of certain bit in binary number is defined by the weight of that bit. Higher the weight of that specific bit, higher is the significance so the bit at the left most column has the highest weight so these are MSBs. Throughout this literature, left most bits (or in more general form, the digit on the left most of any number regardless of the number system) will be the MSB (or MSD – Most Significant Digit) and right most bit will be the LSB (or LSD – Least Significant Digit). Similarly, if some numbers are represented vertically, the MSB will be at the bottom and LSB will be at the top of number.
From now onwards, for the sake of simplicity, avoiding confusions and better understanding, base of the number will be shown as subscript.
Binary-to-Decimal Conversion:
Decimal value of any binary number is simply calculated by summing the equivalent value of each bit and then adding all of them. While calculating the weight of any bit, it should be kept in mind that base will b “2” instead of “10” as was in case of decimal system. Consider the following examples: (Click to enlarge image)

Example 1.1, 1.2
Decimal-to-Binary Conversion:
There are two different ways of conversion from decimal to binary, repeated division method and sum-of-weight method. Each of these will be given here and explained with the help of elaborated examples.

1. Repeated Division Method:
The general approach in repeated division method can be summarized as:
Decimal number is divided with the base of that system in which conversion needs to be made, then the remainder will be the LSD of resulting number. The quotient will again divided by same number (base of the system) and remainder will be the next higher order digit. This process continues till the quotient becomes less than base of the system and the last quotient will become the MSD.
For conversion to binary system, decimal number is divided by “2” repeatedly. Following example further explains this process. (Click to enlarge image)

Example 1.3
Conversion of Fractional Decimal Numbers:
The general approach in converting decimal fractions is called repeated multiplication method which can be summarized as:
Fractional decimal number is multiplied by the base of that system in which conversion needs to be made, then the whole number part of resulting fraction will be the MSD of resulting number. The fractional part of result will again multiplied by same number (base of the system) so the whole number part will be the next lower order digit. This process continues till the fractional part of result becomes zero. Whole number part of this last result becomes the LSD.
For conversion to binary system, fractional decimal number is multiplied by “2” repeatedly. Following example further explains this process. (Click to enlarge Image)

Example 1.4
2. Sum-of-Weights Method:
In this method, we need to determine the set of binary weights whose sum is equal to the decimal number. Simplest method to memorize the binary weights is to remember the decimal equivalent of 20 which is 1, then double it to get the next weight which is 2, and then for next weight double this 2 and so on. So in this way we can get the weights of seven bit number as 64, 32, 16, 8, 4, 2, 1. Now we can understand this method by following examples. (Click to enlarge image)

Example 1.5
References:
1. Ronald J. Tocci and Neal S. Widmer, Digital Systems Principles and Applications, 7th Edition, Prentice-Hall, New Jersey.
2. Thomas L. Floyd, Digital Fundamentals, 7th Edition, Prentice-Hall, New Jersey.

Related Posts :



0 comments:

Post a Comment

 
Copyright 2010 | All Rights Reserved Electrical & Electronics
BloggerTheme by BloggerThemes | Design by 9thsphere