But How Do It Know? - the Basic Principles of Computers for Everyone (3 page)

This computer part is a simple device that has three connections where there may or may not be some electricity. Two of those connections are places where electricity may be put into the device, and the third connection is a place where electricity may come out of the device.

Of the three connections, two of them are called “inputs,” because electricity can be sent to them from somewhere else. The third connection is called the “output” because electricity can come out of it and then be sent somewhere else. 

This computer part is a device that does something with bits. If you have two bits, and you connect those two bits to the inputs, this device “looks” at those two bits, and “decides” whether to turn the one output bit on or off.

The way it “decides” is very simple, and is always the same. If both inputs are on, the output will be off. If one or both of the inputs are off, then the output will be on. That’s just the way that the room with the odd light switches worked.

Remember that there is nothing but bits inside the computer. This simple device is where bits come from and where they go to. The “decision” that this device makes is how bits come to be turned on and off in a computer.

Two bits go into the device, and one bit comes out. Two bits come from somewhere else, are examined by the device, and a new third bit is generated so that it may go somewhere else.

If you have been extra observant, you may have asked yourself this question: “when both inputs are off, the output is on, so…. how do you get electricity at the output if both inputs are off?” Well, that is an excellent question, and the excellent answer is that every one of these devices is also connected to power. Like every appliance or table lamp in your house, where each has a plug with two pins, this device has a pair of wires, one of which is connected to a place where the electricity is always on, and the other is connected to a place where the electricity is always off. This is where the electricity for the output comes from. When someone builds a computer, they have to make all of those power connections to each one of those parts in order to have it work, but when we are drawing diagrams of parts, how they are connected, and what they will do, we won’t bother drawing the power wires – they would just clutter up the drawing. It is understood that each part has its power connection, and we don’t worry about it. Just understand that it is there, and we won’t mention it any more for the rest of the book. I wouldn’t have even mentioned it here except that I figured that you’d probably ask yourself that question sooner or later.

Now I know I said that you don’t have to understand much about electricity to understand computers. Here is as complicated as it gets. There are actually a half dozen electronic parts inside of this device that make it work, but we are not going to examine those parts in this book. Someone who has an electronics background could look at what’s in there, and in about 30 seconds would say “Oh yeah, if both inputs are on, the output will be off, and for any other combination the output will be on, just like the book says.” And then that person could go ahead and read this book without ever having to think about what’s in there again. Someone who doesn’t know electronics misses out on those few seconds of understanding, but this book is the same for everyone.

In normal house wiring, one switch turns one light on and off. In the computer, it takes two switches, and it’s sort of backwards in that they both have to be on to turn the light off. But if you accept the fact that something could be made that operates this way, you can then understand how everything in the computer works.

This type of computer part is in fact the ONLY type of part required to build a computer. Of course it takes a lot of them to build a complete computer, but with enough of them, you can make any type of computer. So there you go again, see how simple a computer is? It is just full of this little type of thing – a lot of them to be sure, but this is all there is.

Now we need to give this device a name, this thing inside the computer that bits are made of, it is called a “gate.” I can’t find a good reason why it is called a gate, a gate in a fence lets people through when it is open, and stops people when it is closed. A computer gate generates a third bit from two other bits, it doesn’t open and close or stop or let anything through. The meaning of this computer term “gate” doesn’t seem to fit into the common meaning of the word, but sorry, I didn’t make up the name, that’s just what it is called. You’ll get used to it. At least it isn’t some long word from the ancient Greek.

In the next few chapters, we are going to show how we can do something useful by connecting several gates together. We will use drawings like the following. The ‘D’ shape with the little circle at its tip represents the device we have described, and the lines represent the wires going in and coming out of it that get attached to other parts of the computer. The picture on the left shows a gate complete with its power wires, but as promised, we won’t be concerned with them for the rest of this book. The drawing on the right shows everything we need:

Sometimes it is useful to make a little chart that shows how the various input combinations create the output, like this:

 

 

 
a

 

 
b

 

 
c

 

 
Off

 

 
Off

 

 
On

 

 
Off

 

 
On

 

 
On

 

 
On

 

 
Off

 

 
On

 

 
On

 

 
On

 

 
Off

 

Each line shows one possible combination of the inputs, and what the output will be under those circumstances.

Compare this little chart with the experience with the odd room with the two light switches. If one switch is called ‘a,’ the other switch is called ‘b,’ and the ceiling light is called ‘c,’ then this little chart describes completely and exactly how the equipment in that room operates. The only way to get that light off is to have both switch ‘a’ and switch ‘b’ on.

 

Simple Variations

As mentioned, this gate is the only thing you need to build a computer, but you need a lot of them, and they have to be wired together in an intelligent manner in order to be able to make them do something useful. What we are going to do here is to show two simple things that are done many times inside any computer.

This first one is very simple. Take the gate above, and take the two input wires, ‘a’ and ‘b,’ and tie them together. Thus ‘a’ and ‘b’ will always be the same. They can still be changed on and off, but ‘a’ and ‘b’ can never be different. ‘A’ and ‘b’ can either both be on, or both be off. Thus the chart of this combination only has two lines on it, two possibilities:

 

 

 
a

 

 
b

 

 
c

 

 
Off

 

 
Off

 

 
On

 

 
On

 

 
On

 

 
Off

 

Actually, since columns ‘a’ and ‘b’ are the same, there is really only one input and it can be drawn simply like this with a triangle instead of the ‘D’ shape. Its chart is also very simple:

 

 

 
a

 

 
c

 

 
Off

 

 
On

 

 
On

 

 
Off

 

For our second variation, lets combine one of our original type of gate with the new gate that we just invented, like this:

And we’ll combine the charts of how they work. The ‘a,’ ‘b’ and ‘x’ are like the first gate, the ‘x’ and ‘c’ are like the second gate.

 

 
a

 

 
b

 

 
x

 

 
c

 

 
Off

 

 
Off

 

 
On

 

 
Off

 

 
Off

 

 
On

 

 
On

 

 
Off

 

 
On

 

 
Off

 

 
On

 

 
Off

 

 
On

 

 
On

 

 
Off

 

 
On

This combination is used so often inside computers, that it is built as a single unit, and the ‘x’ bit is not available to connect to. So to make it simpler to understand, it is drawn as a single unit like this:

Other books

Never Be Lied to Again by David J. Lieberman
Divine Evil by Nora Roberts
Eyes of Silver, Eyes of Gold by Ellen O'Connell