Книга: Introduction to Microprocessors and Microcontrollers

Counting with only two figures

Counting with only two figures

We can count using any base that we like. In the denary or decimal system, we used a base of 10 but we have seen that microprocessors use a base of 2 – just the two digits 0 and 1. This is called the binary system.

We usually abbreviate the words BInary digiT to bit. Counting follows the same pattern as we have seen in the denary system: we use up the digits then start again. Let’s give it a try. Start by listing all the digits:

0

1

and that’s it!

We now put a ‘1’ in the next column and start again:

10

11

It is convenient at this stage to keep the number of binary columns the same and so we add a 0 at the start of the first two digits. These extra zeros do not alter the value at all. For example, the denary number 25 is not affected by writing it as 025 or 0025 or even 000 000 000 000 025.

The binary and decimal equivalents are:

Binary Denary
00 0
01 1
10 2
11 3

We do the same again – put a ‘1’ in the next column and repeat the pattern to give:

Binary Denary
100 4
101 5
110 6
111 7

and once more:

Binary Denary
1000 8
1001 9
1010 10
1011 11

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


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