History of the Computer: It's a Binary World - How Computers Count

Many have cursed their computer for taking things too literally! It's easy to blame the computer when something goes wrong.

You get to the checkout at the market, and the item you bought 'on special' comes up at the full price. The manager has to be called to fix it up, and what does he say? "We've been having problems with the computer, it gets the wrong price on some things."

You put in a list of addressess to your Word processor, and print off party invitations for next week. Then you find that today's date has been inserted in the signature block - by the computer!

Maybe you have heard the expression 'Garbage in Garbage out"? Someone, at some point instructed the computer to do what it did, It didn't decide to screw you up deliberately. Computers can only do what they are told, they are more logical than Spock and they take everything literally.

We are going to look at why they are so pedantic!

The world around us has many aspects which work in the same way as a computer. There are many examples of opposites, for instance Up and Down, Left and Right, Forwards and Backwards. A light may be On or Off, maybe it's Night or Day. Yes or No? You can think of many others. This system of two possible states is called a Binary System. If it's not one, it must be the other.

A computer uses the Binary System to perform all its functions, the basic unit, originally a vacuum tube, then a transistor, then a chip, is used thousands of times over to make the total unit. The light being On or Off which we mentioned above is controlled by a switch. In the computer this switch is a transistor, which is either On or Off.

Now we get to the Math! Don't worry, it's very simple Math! In fact it's so simple we only count up to 1. That's right, we can only have two states so we count from 0 to 1. (That's another thing computers are pedantic about, they insist on starting at zero).

The Binary system is a Number System. You are familiar with the Decimal system which has 10 numerals 0 to 9 (think like a computer 0 comes first). You can make up all sorts of number systems for whatever purpose you want. You probably know about a dozen (12) and have also heard of a half dozen. If you've used your computer much you may have come across the Hexadecimal system. This one has 16 'numerals' 0-9and A-F. Another number system used by computer people is the Octal system which has 8 numerals, 0-7.

Ok so how do we count with only 0 and 1. Simple, in exactly the same way you count in decimal. The first ten numbers are OK, 0-9, but what next? We start again but add in a 1 making 10 or "one, zero". This gets us to "one, nine" and we go to "two, zero", and so on up to "nine, nine" then we again add a 1 to make 100 - "one, zero, zero."

DECIMAL 0-9, 10-19, 20-.....-99, 100.

If you've followed me so far you are ready for the Binary sequence, it's much simpler. Starting off at zero we have 0,1 - and that's it. We follow the same rule and add in a 1, making "one,zero". Next come "one, one"; then "one, zero, zero"; -"one, zero, one"; etc. These are equivalent to Decimal 0,1,2,3,4,5. How does this relate to computers? That's next.

BINARY - 0 1 10 11 100 101
DECIMAL- 0, 1, 2, 3, 4, 5

In our computer we have transistor switches, as described above. For the math example we just looked at, we need 3 switches. These each represent a Binary Digit, or Bit. To represent a Decimal 1, these switches would be OFF,OFF,ON or 001. For a Decimal 5 we would have ON,OFF,ON, or 101. By extension you can see that with 4 switches we could go to 1111 or 15 Decimal.

TRANSISTORS [OFF OFF ON] [ON OFF ON] [ON ON ON ON]
BINARY...... 001 101 1111
DECIMAL..... 1, 5, 15

Another point to note is that each binary digit, or bit, has a value. Just as in Decimal we have units, tens, hundreds, etc. in Binary the values are 1,2,4,8,16,32,64,128 etc. etc. The binary code 1111 mentioned above is thus 1+2+4+8=15. what would BINARY 1010 be in decimal?

BIT VALUE 8 4 2 1
BINARY.... 1 0 1 0
DECIMAL... 8+2=10

If you wanted to work out what binary 100101100 was in decimal, you could add up the individual values. In fact people who work on the basic machines need to know "machine code"! To them 1010 would be A in Hexadecimal or 12 in octal.

One of the reasons for using the octal or hexadecimal code is to enable humans to interpret machine codes. Some mainframe computers use 'words' composed of 24, 32, 36 or 72 bits. These are displayed or printed in groups of three for octal, or four for hexadecimal. For example the 24 bit binary word in a computer may be interpreted as shown here.

BINARY 100 111 000 011 010 000 011 100
OCTAL.. 4 7 0 3 2 0 3 4

BINARY 1001 1100 0011 0100 0001 1100
HEX.... 9 D 3 4 1 D

This probably seems a very long-winded way to work out numbers, until you remember that these 'switches' can operate at nanosecond speed, in the order of 1,000,000,000 times per second, large calculations become possible.

Thats probably enough to digest in one go. Next we will look at how a computer adds and multiplies.

Tony is an experienced computer engineer. He is currently webmaster and contributer to http://www.what-why-wisdom.com. looking at things you can do At Home. A set of diagrams accompanying these articles may be seen on that website. Go to http://www.what-why-wisdom.com/historyofthecomputer.html to start.