# Articles/Electronics/Other/Logic Gates

Logic gates take binary values and perform functions on them, similar to the functions found in simple algebra. Binary algebra is the set of mathematical laws that are valid for binary values. A binary value can only be a 1 or a 0. 1 is a high value, representing true and high voltage. 0 is a low value, representing a false value and low voltage.

Logic gates are typically packaged in integrated circuits, although they can be constructed using analogue components. Integrated circuits allow multiple logic gates to be packaged in one chip and are usually quite reliable. Logic gates typically come in two flavors, TTL (transistor-transistor logic) and CMOS (Complementary Metal Oxide Semiconductor). One must be careful mixing the two types, there logic low and logic high are different voltages. A CMOS might take a TTL high as a LOW and a TTL will accept a CMOS low as a high. Because of this they are generally incompatible, but there are a few CMOS that can accept TTL inputs and vice versa.

The buffer and NOT gates are the simplest of the logic gates. The buffer would be used as a digital signal booster, if a logic signal was to travel for some distance voltage drop from wire resistance would lower a logic high voltage so low that when it reaches its destination its read as a logic low, putting this in between would solve that problem. The buffer's algebra function is B = A.

NOT gates simply change the input from a 1 to a 0 or vice versa. It is also called an inverter and has many uses in logic circuits. For example, you have 2 lights, but you only want 1 on at any one time, you would put a NOT gate between one light so when there is a logic high input 1 light is on and the other connected to the NOT gate is off and when there is a logic low input the second comes on because of the NOT gate. The circle on the end of the triangle indicates that its an inverting gate and you can recognize any inverting logic device by this circle.

The equivalent binary algebra function is B = A', where B is the output and A is an input value.

The AND gate most commonly come in IC packages of 2 and 3 input versions. The output only produces a logical 1 when all of the inputs are 1. An AND gate could be used in an alarm circuit, where input A would be a reed switch input and B would be an armed control, So the alarm would only be activated if the alarm was active AND the reed switch was circuit was opened (opened door ect.).

The equivalent binary algebra function is C = A * B * ... * N, where C is the output and A and B are two of N total inputs.

The OR gate has a minimum of two inputs and produces an output of 1 if at least one of the inputs has a value of 1. An OR gate could be used to expand the number of reed switches in the previous example.

The equivalent binary algebra function is C = A + B + ... + N, where C is the output and A and B are two of N total inputs.

The NAND gate has a minimum of two inputs and is the equivalent of an AND gate with a NOT gate on the output. It produces a 0 only if all of the inputs are 1. A NAND gate could be used to switch a device off if it gets too hot or a cooling fan stops working, so a temperature sensor would be connected to input A and a tachometer output filtered so its a logical high when there is rotation and logical low when there is no rotation, is connected to input B. The equivalent binary algebra function is C = (A * B * ... * N)', where C is the output and A and B are two of N total inputs.

The NOR gate has a minimum of two inputs and is the same as an OR gate with a NOT gate on the output. The NOR gate produces a 1 only if all of the inputs are 0. The NOR gate can be used to shutdown a device if either of 2 temperature sensors measure a temperature too high for the circuit.

The equivalent binary algebra function is F=(A+B+...+N)', where F is the output and A and B are two of N total inputs.

The XOR aka EOR gate has a minimum of two inputs. The NOR gate produces a 1 only if one of the inputs is a 1. The equivalent binary algebra function is C = AB'+ A'B, where C is the output and A and B are two inputs.

The XNOR aka ENOR gate has a minimum of two inputs. The XNOR gate produces an output of 1 if inputs A and B match. The most obvious application for this logic gate is a comparator, this could be used as error checking in data transmission or it can form the basis of a combination keypad. The equivalent binary algebra function is C = AB + A'B', where C is the output and A and B are two inputs.