Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






Unsigned Binary Counting

The simplest form of numeric representation with bits is unsigned binary. When we count upward through the positive integers using decimal, we start with a 0 in the one's place and increment that value until we reach the upper limit of a single digit, i.e., 9. At that point, we've run out of the "symbols" we use to count, and we need to increment the next digit, the ten's place. We then reset the one's place to zero, and start the cycle again.

 

Figure 1.1Counting in Decimal

 

Since computers do not have an infinite number of transistors, the number of digits that can be used to represent a number is limited. This would be like saying we could only use the hundreds, tens, and ones place when counting in decimal. This has two results. First, it limits the number of values we can represent. For our example where we are only allowed to count up to the hundreds place in decimal, we would be limited to the range of values from 0 to 999. Second, we need a way to show others that we are limiting the number of digits. This is usually done by adding leading zero to the number to fill up any unused places. For example, a decimal 18 would

be written 018 if we were limited to three decimal digits. Counting with bits, hereafter referred to as counting in binary, is subject to these same issues. The only difference is that decimal uses

ten symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9) while binary only uses two symbols (0 and 1).

To begin with, Figure 2 shows that when counting in binary, we run out of symbols quickly requiring the addition of another "place" after only the second increment.

Figure 1.2 Counting in Binary

 

If we were counting using four bits, then the sequence would look like: 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, and 1111. Notice that when restricted to four bits, we reach our limit at 1111, which happens to be the fifteenth value. It should also be noted that we ended up with 2 x 2 x 2 x 2 = 16 different values. With two symbols for each bit, we have 2n possible combinations of symbols where n represents the number of bits. In decimal, we know what each digit represents: ones, tens, hundreds, thousands, etc. How do we figure out what the different digits in binary represent? If we go back to decimal, we see that each place can contain one of ten digits. After the ones digit counts from 0 to 9, we need to increment the tens place. Subsequently, the third place is incremented after 9 tens and 9 ones, i.e., 99 increments, have been counted. This makes it the hundreds place.

In binary, the rightmost place is considered the ones place just like decimal. The next place is incremented after the ones place reaches 1. This means that the second place in binary represents the value after 1, i.e., a decimal 2. The third place is incremented after a 1 is in both the ones place and the twos place, i.e., we've counted to a decimal 3. Therefore, the third place represents a decimal 4. Continuing this process shows us that each place in binary represents a successive power of two.



Figure 3 uses 5 bits to count up to a decimal 17. Examine each row where a single one is present in the binary number. This reveals what that position represents. For example, a binary 01000 is shown to be equivalent to a decimal 8. Therefore, the fourth bit position from the

right is the 8’s position.

Figure 1.3Binary-Decimal Equivalents from 0 to 17

 

This information will help us develop a method for converting unsigned binary numbers to decimal and back to unsigned binary. Some of you may recognize this as "base-2" math. This gives us a method for indicating which representation is being used when writing a number down on paper. For example, does the number 100 represent a decimal value or a binary value? Since binary is base-2 and decimal is base-10, a subscript "2" is placed at the end of all binary numbers in this book and a subscript "10" is placed at the end of all decimal numbers. This means a binary 100 should be written as 1002 and a decimal 100 should be written as 10010.

Binary Terminology

When writing values in decimal, it is common to separate the places or positions of large numbers in groups of three digits separated by commas. For example, 34532374510 is typically written 345,323,74510 showing that there are 345 million, 323 thousands, and 745 ones. This practice makes it easier to read and comprehend the magnitude of the numbers. Binary numbers are also divided into components depending on their application. Each binary grouping has been given a name. To begin with, a single place or position in a binary number is called a bit, short for binary digit. For example, the binary number 01102 is made up of four bits. The rightmost bit, the one that represents the ones place, is called the Least Significant Bit or LSB. The leftmost bit, the one that represents the highest power of two for that number, is called the Most Significant Bit or MSB. Note that the MSB represents a bit position. It doesn't mean that a '1' must exist in that position. The next four terms describe how bits might be grouped together.

Nibble – A four bit binary number

Byte – A unit of storage for a single character, typically an eight bit (2 nibble) binary number (short for binary term)

Word – Typically a sixteen bit (2 byte) binary number

Double Word – A thirty-two bit (2 word) binary number

 

The following are some examples of each type of binary number.

Bit 12

Nibble 10102

Byte 101001012

Word 10100101111100002

Double Word 101001011111000011001110111011012


Date: 2015-12-17; view: 1704


<== previous page | next page ==>
Information is knowledge about individuals, objects, facts, events, phenomenons and processes irrespective of their form of representation. | Unsigned Binary to Decimal Conversion
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.011 sec.)