Beginners guide to Computer Logic...
Ok, sooner or later you're going to see lots of logic 'gates' all over your pinball diagrams.
Here's a simple overview of some very basic logic gates, and how signals turn them ON & OFF.
This will help you later when fault finding if you know HOW the chip should be working.
A logic gate (or a chip full of gates) is nothing more than a bunch of tiny switches.
Let's go thru some REALLY SIMPLY analogies to get the ball rolling.
Before getting into the logic chips, let's first understand simple switching ON & OFF of a small Lamp.
Here's a 12volt battery on the left, wired via a switch, which then provides a supply voltage onto the lamp.
Currently the switch is OPEN, so the lamp is OFF (GREY colour).
Now the switch is CLOSED, so the lamp is ON (YELLOW colour).
At this stage, i'll refer to signals being ON or OFF, although later in the logic gates, they're called "HIGH" and "LOW".
To clarify, These are all mean the same thing :
Switch OPEN = OFF = No Voltage = Digital "LOW" or "0" (zero).
Switch CLOSED = ON = Voltage present = Digital "HIGH" or "1" (one).
Now that we can turn a lamp ON & off, lets add more switches....
By adding 2 switches inline (often termed "in series") we now need
BOTH switches to be ON for the lamp to turn ON.
Switch A
and Switch B are both OFF - Lamp is OFF.
Switch A is ON, but Switch B is OFF - Lamp is still OFF.
Switch A is OFF, but Switch B is ON - Lamp is still OFF.
Finally, Switch A
and Switch B are both ON - Lamp is ON.
What this illustrates is that you need Switch A "AND" B to be switched ON for the lamp to turn ON.
This is referred to as "ANDing" and the equivelant method is to use a chip called an "AND gate":
The "AND gate" is similar to the diagrams above, like tiny switches inside the chip, waiting to be controlled
by the 2 external switching pins (inputs).
If both inputs pins (A and B) are turned ON, then the ouput pin (X) will turn on, just like the lamp previously did.
Here's a real-Life example:
Your car ignition (the X output) will only turn ON when you turn on the ignition switch (input A) "AND" have the seatbelt
buckled into place (input B) - most modern cars do something like this.
"AND gates" can have more than 2 inputs, you can join several "2 input" chips together to create an 'AND array'.
Eventually the 8 inputs all make there way thru all the gates, resulting in 1 final output pin turning OFF or ON:
Some "AND gates" also have as many as 8 inputs in 1 chip, which is a more compact way of getting the same result as above :
This is called a "Truth Table" and shows us a sort of 'Map' (table) of what each gate will do.
We see on the left that the "AND" gate will provide a certain 'X' output, based on what is presented onto the inputs A and B.
if A is 0(off), "AND" B is 0 (off), then X(output) is also OFF.
if A is 0(off), "AND" B is 1 (on), then X(output) is also OFF.
if A is 1(on), "AND" B is 0 (off), then X(output) is also OFF.
if A is 1(on), "AND" B is 1 (on), then X(output) is also ON.
This table proves what we saw above with the 2 switches and the lamp.
Also in the table is a "NAND" gate, what the hell is a "NAND" anyway ??
Before getting into "NAND" lets first get into the "NOT gate" more popular known as "The Invertor" as it simply
"inverts" whatever passes through it.
The invertor Truth table is simple and self explanatory?
Switch ON the input to the invertor, and the ouput turns OFF, and vica-verca:
Switch OFF the input to the invertor, and the ouput turns ON,
Also to note is the "BUFFER gate".
A Buffer provides some isolation between 2 different sections of a circuit, it basically passes whatever comes into it
straight on to the output, however, it naturally wont allow any circuitry opn the output pin to interfere with circuitry
on the input pin.
BUFFERs are used to 'drive' into several other gates at a time without loading (interfering) with the logic on the input side.
(probably getting too deep now, i'll stop).
Ok, now back to the "NAND gate" finally...
A "NAND gate" is just an "AND gate", with a "NOT gate"(invertor) added inside the chip, on it's ouput pin.
That's all.
Look at the Truth Table, you now see the "NAND" works exactly opposite to the "AND".
You can basically make ANY logic gate the exact opposite by adding a "NOT gate"(Invertor) onto the output pin.
This table shows that a "NAND" is the addition of an "AND" & a "NOT".
(also shown is a "NOR gate"...more about them shortly).
Here's an example of an "AND array" now inverted to become a "NAND" function:
Of course "NAND gates" are also have as many as 8 inputs in 1 chip.
....and moving onto the "OR gate"...
But first, Here's a 12volt battery on the left, wired via 2 switches, which then provides
a supply voltage onto the lamp.
Currently, both switches are OPEN, so the lamp is OFF (GREY colour).
Now switch 'A' is CLOSED, and switch 'B' is OPEN, so the lamp is ON, (YELLOW colour).
Now switch 'A' is OPEN, and switch 'B' is CLOSED, so the lamp is still ON, (YELLOW colour).
Now switch 'A' is CLOSED, and switch 'B' is CLOSED, so the lamp is still ON, (YELLOW colour).
What this illustrates is that you turn Switch A "OR" B ON (closed) for the lamp to turn ON.
(you could almost call this an "Either gate" where EITHER input will turn ON the lamp).
This is referred to as "ORing" and the equivelant method is to use a chip called an "OR gate":
If EITHER inputs pins (A or B) are turned ON, then the ouput pin (X) will turn on, just like the lamp previously did.
This is the "Truth Table" :
We see on the left that the 'OR' gate will provide a certain 'X' output, based on what is presented onto the inputs A and B.
Basically, if A is 0(off) and B is 0 (off), then X(output) is also OFF.
if A "OR" B is 1(on), then X(output) is also ON.
Also, if A is 1(on), and B is 1(on), then X(output) is also ON.
This table proves what we saw above with the 2 switches and the lamp.
Also in the table is a "NOR gate", and i'm sure you now know that it is an "OR" with a "NOT" fitted onto it.
Here's a real-Life example:
Your car interior light (the lamp) will only turn when you Open the Front-LEFT door "OR" the Front-Right door (or both doors).
I tried to keep this a simple and easy as possible, hopefully the diagrams and examples in your car help understand the logic.
MM.