Книга: Introduction to Microprocessors and Microcontrollers

Converting binary to denary

Converting binary to denary

If we look at a denary number like 8328, we see that it contains two eights. Now these two figures look identical however closely we examine them, but we know that they are different. The 8 on the right-hand end is really 8 but the other one is actually 8000 because it is in the thousands column.

The real value of a digit is dependent on two things: the digit used and the column in which it is placed.

In the denary system, the columns, starting from the right, are units, tens, hundreds, thousands etc. Rather than use these words, we could express them in powers of ten. A thousand is 10?10?10=10? and in a similar way, a hundred is 10?, ten is 10? and a unit is 100. Each column simply increases the power applied to the base of the number system. Columns in a binary world also use the base raised to increasing powers as we move across the columns towards the left. So we have:

2? 2? 2? 20

The denary equivalent can be found by multiplying out the powers of two. So 2? is 2?2?2 = 8 and 2?=4, 2?=2 and finally 20=1. Starting from the right-hand side, the column values would be 1, 2, 4, 8 etc. Let’s use this to convert the binary number 1001 into denary.

Method

Step 1: Write down the values of the columns

8 4 2 1

Step 2: Write the binary number underneath

8 4 2 1

1 0 0 1

Step 3: Evaluate the values of the columns

8 ? 1 = 8

4 ? 0 = 0

2 ? 0 = 0

1 ? 1 = 1

Step 4: Add up the values

8 + 1 = 9

As we have seen, all the columns containing a binary 0 can be ignored because they always come out to 0 so a quicker way is to simply add up all the column values where the binary digit is 1.

Method

1 Write down the column values for the binary system using the same number of columns as are shown in the binary number.

2 Enter the binary number, one bit under each column heading.

3 Add the values of each column where a 1 appears in the binary number. Calculator note: This is much the same as we saw the previous conversion. To tell the calculator that the answer has to be in decimal I have to press mode mode 3 then the ‘decimal’ key.

It now has to be told that the input number is binary. This is done by the key sequence logic logic logic 3 now just put in our binary number 1001 and press the = key and out will pop the answer 9.

Another example

Once again, here is one for you to try. If you have problems, the answer follows.

Convert 1011001012 to a denary number

Step 1: Write down the column values by starting with a 1 on the right-hand side then just keep doubling as necessary

28 27 26 25 24 23 22 21 20
256 128 64 32 16 8 4 2 1

Step 2: Enter the binary number under the column headings

256 128 64 32 16 8 4 2 1
1 0 1 1 0 0 1 0 1

Step 3: Add up all the column values where the binary digit is 1

256 + 64 + 32 + 4 + 1 = 357

So, 1011001012 = 35710 or just 357 since denary can be assumed in this case.

Оглавление книги


Генерация: 0.825. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз