3 Feb 2013

Digital Systems Part 1 - Logic Gates

In electronics, there is the analog world and digital world. The analog circuits operate on continuous valued signals. Digital circuits operate on discrete signals values i.e. 1/0, on/off, high/low, true/false. In the digital world, we're interested in bits, that is binary numbers. You can learn more about the binary number base here. In numeric circuits, each signal (wire) is seen as either being high or low (two-valued logic). Depending on the voltage at which the circuit operate, the high value will be the power supply voltage : 3.3V, 5V, 12V, 24V... The low value will be equal to the ground reference.

Logic gates

The logic gates are the basic building blocks of digital systems. They provide the most simple operations on binary signals. With a combination of multiple logic gates, you can build complex circuits e.g. adders, comparators, encoders/decoders, timers, multiplexers, etc.  Here are the logic gates that we are going to work with (you can see the schematic diagrams of the gates and their truth table) :

The NOT gate

The most simple logic gate, the inverter will flip the value of the bit at the input pin (left pin on the picture above). Imagine you have a light connected to a N.O. (Normally Open) push button, when you press the button, the light will turn on. If you connect the light to a N.C. (Normally Closed) push button, the light will always be on unless you press the button. With an inverting gate, you could easily change the behavior of an N.O. contact into a N.C contact and vice versa.

The AND - OR gate

These gates are used to make logical equations. For the AND gate, all the inputs have to be on for the output to come on. Example : if button A is pressed AND button B is pressed, the LED will light up. For the OR gate, one of the inputs have to be on for the output to come on. Example : if button A is pressed OR button B is pressed, the LED will light up.

The XOR gate

The XOR logic gate serve a special purpose : when you look at it's truth table you realize that the output is on only when the inputs bits are not the same. This gate is then used to detect if there is an inequality of the input bits. The XOR gate is also used to compute the sum (S) of a one-bit adder. S being the sum, C being the carry bit : 

0 + 0 : S = 0, C = 0
0 + 1 : S = 1, C = 0
1 + 0 : S = 1, C = 0
1 + 1 : S = 0, C = 1

From the following equations can you see that S = A XOR B and C = A AND B? Here is the schematic of the one-bit adder.

In the second part of this tutorial, we're going too see how simple logic gates can be made with Bipolar Junction Transistors (BJTs).

No comments:

Post a comment