I love logic gates. They are what all digital electronics are based upon. You can make really awesome stuff with it!
I was first introduced to logic gates when I was around 14 years old. I heard that computers consisted on ones and zeroes. But I didn’t understand what that really meant.
So I asked my father to explain it. And I loved his explanation, because it was so simple and easy to understand.
Ones and Zeroes
You may have heard that computers are really just 1’s and 0’s. But what does that mean?
It’s actually very simple. A “1” is represented by a wire with current flowing in it, a “0” is a wire with no current.
Sometimes 1’s and 0’s are called “high” and “low”.
By using the binary number system, we can make sense of these numbers.
Basic Logic Gates: AND, OR, INVERTER
Logic gates (or ports) are components that we use for “doing stuff” with the 1’s and 0’s.
For example an AND-gate is a gate that checks if both its inputs (a AND b) are 1. If they are, the output is 1. Otherwise it’s 0.
|A||B||A AND B|
An OR-gate is a gate that checks if either one of its inputs (a OR b) is 1. If one or more of them are, the output is 1. Otherwise the output is 0.
|A||B||A OR B|
An inverter is a really simple component that inverts the input. If the input is 1, the output is 0. And vice versa.
More Logic Gates: NAND, NOR, XOR
The AND and OR gate described above can be turned into NAND and NOR gates by putting an inverter at the output of the gates. Now they will give the opposite result.
|A||B||A NAND B|
|A||B||A NOR B|
In addition to these gates, there is one more. The XOR. Which stands for the Exclusive OR. This gate will only give out 1 if one and only one input is 1. Otherwise it will return 0.
|A||B||A XOR B|
Flip-flops are the fundamental building blocks of almost everything in digital electronics.