Gates:The
building blocks of digital electronics...
What is a
gate?
Gates are simple switches that only "turn on" when their inputs receive
the right conditions. The right conditions to turn on a certain gate
depend on what type of gate it is. Each gate has its own special
conditions. Before getting into this too much more it is important to
understanding what I mean by "condition". In digital electronics, we
generally only deal with two possible values of inputs. Consider your
keyboard, for a moment. It typically has a little over 100 keys and
each one of these keys is an input to your computer. When dealing with
gates, on the other hand, we only use two types of inputs, high and
low. High is also sometimes refered to as "1" and low is "0" or
othertimes might be called on and off. It doesn't really matter. To
some of you the 1 and 0 notation might be familiar or you might atleast
recognize it. It is the binary number system
which consists of 1's and
0's and is extremely important to understand many of the more
complicated circuits.
For clarification, consider the image above. This is the AND gate. The
output wire "OUT" only turns on if inputs "A" AND "B" are
on, can you see why it is called an AND GATE? Remember turning On and
Off is the same as changing to a 1 or to a 0, respectively. Since there
are two inputs and two possible states(1 or 0) there is a total of 4
possible sets of conditions which include (00,01,10, and 11) for the A
and B input pins. Look at the figures below for a better explanation.
These are
the four possible states a single (2-input) AND gate can be in (there
are AND gates that have more than two inputs, we will discuss them in
more detail in a later section).
You can see from the example of the 4 gates
combinations that the logic statement could also be rewritten as: The
LED only turns on if both A AND B are
connected to the positive part of the battery.
This simple circuit with two switches in series represents the same
thing. In order for the LED to light up there has to be a complete
circuit. For there to be a complete circuit, both switches have to be
closed. Having only one or the other switch closed makes no difference,
it has to be both of them.
Play with the simulation below. Click on the
switches to make them move. Try to make the LED light up. Do you
understand the AND gates operation?
The LED (light emitting diode) lights up when the two switches
connected to positive are closed. In otherwords, when input A and input
B are high (have the logical value of 1) the output is high. Any other
combination results in a low output (logical 0) and does not light the
light.
This simplifed
drawing (left) represents two high inputs, which causes a high output
(remember high=1 and low=0). In general, this tutorial will use the 1
and 0 notation and sometimes H and L to represent high and low, they
are all interchangable.
Instead of using a group of 4 pictures to show all possible states it
is sometimes easier to use a "truth-table". The truth table for a two
input AND gate would look like this:
A
B
OUT
0
0
0
0
1
0
1
0
0
1
1
1
From this table it is easy to
see that "OUT" will only equal 1 if "A" and "B" equal 1. By taking this
idea one step further, an equation can be made: A*B=OUT.
So, lets try a possiblity and see if the equation works. Plug in 0 and
1 to A and B respectively, which gives us 0*1=0. Now check the
truth table to see if this is correct. It is! Since AND gates are
multiplication logic they are actually be used to make the
multiplication circuit used in calculators and computer processors.
In the next section we will discuss the various other gates and how
they work.