Custom Search

Binary Code

The computer speaks 'binary'. Binary is a code with only two states - high and low - 1 or 0 - 'on' or 'off' - it is ideal for communication within any electrical system. Each '1' or '0' in the code is called a binary digit or 'bit' and eight bits make a byte.

The number 11111111 in binary is 255 in decimal. Therefore using eight bits you can make 256 different binary numbers (if you include 00000000).

That means that an '8-bit register' can have 256 different 'states'.

Binary is a number system with a base of 2. That means only two symbols are used to express numbers in binary (bi means two): 0 and 1.

We are used to a number system with a base 10 - in our decimal system (deci meaning ten) ten symbols are used to represent numbers - 0 1 2 3 4 5 6 7 8 9

Counting in binary is similar to counting in any other number system. Beginning with a single digit, counting proceeds through each symbol, in increasing order.

When the symbols for the first digit are exhausted, the next-higher digit (to the left) is incremented, and counting starts over at 0. In decimal, counting proceeds like so:

000, 001, 002, ... 007, 008, 009, (rightmost digit starts over, and next digit is incremented)
010, 011, 012, ...
   ...
090, 091, 092, ... 097, 098, 099, (rightmost two digits start over, and next digit is incremented)
100, 101, 102, ...

After a digit reaches 9, an increment resets it to 0 but also causes an increment of the next digit to the left.

In binary, counting is the same except that only the two symbols 0 and 1 are used. Thus after a digit reaches 1 in binary, an increment resets it to 0 but also causes an increment of the next digit to the left:

0000,
0001, (rightmost digit starts over, and next digit is incremented)
0010, 0011, (rightmost two digits start over, and next digit is incremented)
0100, 0101, 0110, 0111, (rightmost three digits start over, and the next digit is incremented)
1000, 1001, ...
 

Binary Integer Representations

There are five integer representations in computing

—Unsigned

—Sign-and-magnitude

—One's complement

Two's complement - almost all modern computers employ Two's complement representation

—Biased representation (not commonly known)

Useful links:

Negative binary numbers

Biased representation