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 made from 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.
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.
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.
In 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
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.