Introduction to Binary Logic Circuits - by Nick Fletcher (2006)

home | page 1 | page 2 | page 2 | page 4 | page 5 | page 6

To me, computers represent a very important human achievement. Computers were theorised over for a long time (centuries), and it was only until the 1930's that what we today recognise as a computer, was first 'blue printed'. Even though this was still mainly theory.

That's enough for the intro because we have a lot to get through. What I plan to do with this tutorial(s) is cover many aspects of computing. I want to show you how computers perform operations on data at the most basic and close up levels and I also want to teach you about C and C++ programming!
How am I going to do that???

I want to let you know that this is a follow along type tutorial. You can just read along and read the C and C++ code that I present, but it will be much better to have a compiler sitting there, ready to try out and use the code!
I will be using DJGPP and LCC(for win32) to build the examples. The examples will eventually form a complete piece of software.

Firstly, you will need to know a little bit about C programming. Not much though! After all, the idea is to teach you that as well. Secondly, you'll need plenty of time. We are going to cover a lot of areas and do quite a bit of programming! Also, you will end up with a useful piece of software at the end of this. Not to mention a very good understanding of what's going on inside your own computer. (I hope...)

Our project begins with an outline of what we hope to achieve:

Ok, let's begin. A computer is basically a big calculator. It can add numbers together, very quickly and accurately. I was always fascinated by this fact. I always used to think to myself, "Hmm... They say a computer can add numbers together. How can a machine add numbers together? They would then say, 'Oh... That's easy. They use binary instead of decimal...'"

Well, that wasn't good enough for me. Everyone knows that computers use binary. But that's a lie. It's just a way to make it easier for humans to think about what a computer is doing. In fact, computers don't use binary, they use electricity! What they meant when they said computers use binary was really,

"Oh, computers use electricty and we 'map' the voltage readings to abstract values like, TRUE FALSE ONE ZERO

But this wasn't really helpful either. What I wanted to know was how a machine could be given an input of voltage somewhere and then, somewhere else, output a correct answer without any help from a human! To me, this was simply amazing.

As it turns out, the mechanics of how this is achieved are quite simple. The simple, easy way of doing this has been left behind in the cobwebbed annals of computer history. The simple way I am going to show you would be waaay too slow for any modern system. But, the principles are the same still.

Now we are going to learn a bit about how a machine can add numbers, then we'll build a model of such a machine in C++ code. Ok? You've probably seen a binary number before. It's a group of one or more 1's and 0's set out like any decimal number. I won't dwell too much on why computers use binary, because really, they don't have to. It's just simpler that way, which translates to cheaper!
The whole business of machines that can add(and subract which is just adding a negative number to a positive) comes down to electronic switches called gates. Imagine a house with a long passageway and a light halfway along the passage. In this situation, you normally have a light switch at each end of the passage. The switches are wired so that they can operate the light regardless of what each individual switch is set to(on or off). You could say that the light will turn on if one switch or the other, or both are switched to on. Now, this works, because of the way the switches are wired to the power and the light itself. Imagine a 'Y' shaped arrangement where the light is at the base the 'Y'. The two light switches are each 'branch' of the 'Y'. Power can only make it's way to the light through either branch of the 'Y'. You can imagine now that as long as one switch is turned on, power can make it to the base of the 'Y' and light the globe. Notice, when I described how the switches may be used that I used the word OR to indicate that either one switch OR the other OR both can be used to light the lamp? This arrangement of switches is known as an OR GATE.

The OR GATE may have two or more inputs and one output. In this case, there are two light switches for the inputs and a light globe representing the output.
Something called a truth table can be used to describe an OR GATE's various input and ouput results. It looks like this:

The OR Truth Table
input 1 input 2 output
0 0 0
0 1 1
1 0 1
1 1 1

From two possible input values, 1 or 0, you can have four possible input combinations. The output of an OR GATE is always ONE or TRUE etc as long as at least one of the imputs is 1. You can see this from the table.

home | page 1 | page 2 | page 2 | page 4 | page 5 | page 6
nickeax AT