Maker Pro
Logic gates

Logic gates

0. Introduction

This resource will cover what logic gates are, some examples of logic gates and what logic gates can be used for, the resource is targeted mainly at people who know the basics of electronics, but have little or no previous experience with logic gates or any form of digital electronics. Across this resource you will see lots of 1's and 0's, these are used to represent the binary states of high and low voltage, many integrated circuits use the system of active high, in which the 1 represents a high voltage and the 0 a low voltage.

1. Basic information
Logic gates come comercially in the form of integrated circuits, these integrated circuits contain several transistors in different configurations to create logic gates. There are several types of logic gate, each using 1, 2 or sometimes even more inputs to produce an output based on this input.

1.1 Construction and types
There are several ways logic gates are constructed, the 2 most popular are called TTL (transistor transistor logic) this uses bipolar transistors to create the logic gate and the other is called CMOS (complementary metal oxide semiconductor) this uses MOSFET (metal oxide semiconductor field effect transistor) transistors. CMOS logic gates are often preferable (for the average hobbyist) to TTL's as CMOS generally require a much less specific supply voltage range (3 Volts up to 15 Volts for CMOS as opposed to a stabilised voltage of 4.5 Volts to 5.5 Volts for TTL) and draw much less power than TTL (CMOS draws microamps as opposed to miliamps for TTL) to operate. You may be thinking why use TTL then?, it is because TTL has a much faster reliable switching speed.

MOSFETS (the type of transistor used in CMOS logic gates) are extremely sensitive to ESD (electrostatic discharge), ESD's can be several thousand volts, far more than enough to fry the thin wafer of insulation in the MOSFET. CMOS IC's should be stored with the pins inserted into anti-static foam when not in use. Ensure you do not build up any static and ground yourself (preferably with a anti-static wrist strap).

1.2 Datasheets
Datasheets contain all the information you could ever want for a logic gate unless you were building a Mars rover, the datasheet will contain information like power consumption, maximum and minimum input voltages, maximum and minimum supply voltages, maximum and minimum operating temperatures and lots of other maximum ratings and specifications. To see an example datasheet enter the series of digits ringed from the logic gate below. Logic gates require a supply voltage to work, to see where to provide the supply voltage see the datasheet for the logic gate you are using (What you need to type in to Google depends on what type of logic gate series you are using). The picture below shows where the series of characters that would need to be entered for a CMOS logic gate are located, the picture is of a CMOS logic 4000 series NOR gate.
CMOS 4000 series characters for entering.jpg



All IC's (integrated circuit) have a little notch, this is used to find where pins of certain numbers are, pin numbers count counter-clockwise. below is a picture of an IC, showing which pins belong to which numbers.
DIP pin numbering better.jpg


The notch appears at the top of a DIP (dual inline package) integrated circuit however may be found elsewhere on other form factors of IC such as SMT (surface mount technology) integrated circuits.

2. Analogue and digital electronics

Logic gates work in a form of electronic signal known as digital, the voltage can only represent discrete amounts, high or low. Modern computers use digital signals. Binary is two-state and so each bit (a single 1 or 0) can represent any data where there are only two answers such as yes/no or light/dark. Binary can represent more than simple two-state data as bits are used in conjunction with each other, each bit in the sequence doubles the number of possibilities, and doubling does not have to happen very many times before the numbers reach into the millions and beyond. Analogue signals can vary, they are non-discrete, some of the first computers used analogue signals.

3. Truth tables, Inputs and Outputs

Inputs for logic gates are high voltage (or sometimes just called "high") and low voltage (or sometimes just called "low") what voltage a "high" or "low" input would be depends on the supply voltage. For a "high" input, the desired input would have to be connected to a point of voltage near to the supply voltage, mechanical switches or transistors may be used to supply this connection. For a "low" input the pin must be connected via pull down resistor to the 0 volt rail, the reason it is connected by a pull down resistor instead of directly to ground is that with a pull down resistor the input can stay connected to ground while the voltage is "high", the pull down resistor stops the battery from short-circuiting. For a 9 Volt supply a resistor around the value of about 10 Kilohms may be used and for a 5 Volt supply a resistor around the value of 5 Kilohms is used (You may however want to research this further however as a more efficient value can be calculated), a pull down resistor does not need to be an exact value, the electronics hobbyist will only ever need to use from about 3 Volts up to about 9 Volts when dealing with logic. Instead of a pull down resistor a pull up resistor could be used instead, with the input being connected to the positive supply by the resistor and directly connected to ground, this means if a switch is used between the input and ground the action of the switch will be inverted, an open switch will provide a high input and a closed switch will provide a low input. Positive logic, where a "1" input will be considered a high voltage, use pull down resistors. Negative logic, where a "1" input will be considered a low voltage, utilise pull up resistors. Any inputs in use should not be left "floating" as this can cause the input to be constantly "high" or "low" depending on which type of gate is in use.

Truth tables are used to show the logic of a logic gate, what inputs will produce what output. Truth tables are very simple to read, they consist of 2 or 3 columns (some contain more) with a series of 1's and 0's. These ones and zeros represent high and low voltages, there are only two values in truth tables as they work in a binary, digital signal. The binary part means it uses base 2, we use base 10, the values can only be a 1 or a 0. The columns on the left (there are usually 2 as most standard logic gates have 2) are the inputs, truth tables will show all the combinations of inputs, for a 2 input logic gate this is:
0,0
0,1
1,0
1,1
Then the column on the right will show the corresponding output next to the series of inputs, the out put can only be a 1 or a 0. You can see some truth tables in the next section.
5. Types of logic

5.1 NOT gate


A NOT gate is a single input logic gate, it is also known as an inverter. If the input is high the output will be low and vice versa. Below is the truth table for a NOT gate.
NOT gate truth table.jpg


5.2 AND gate
AND gates have 2 or more inputs, the output will only be high if all inputs are high. If any of the inputs are low the out put will be low. AND gates are available with more than 2 inputs, these follow the same rule, requiring all the inputs to be high for the output to be high. Below is the truth table for a dual input AND gate.
AND gate truth table.jpg


5.3 OR gate
OR gates have 2 or more inputs, the output will be high if either inputs are high. All outputs must be low for the output to be low. OR gates are available with more than 2 inputs, these follow the same rule, requiring all the imputs to be low for the output to be low. Below is the truth table for a dual input OR gate.
OR gate truth table.jpg


5.4 NAND gate
NAND gates have the logic of an AND gate followed by a NOT gate (hence the name NAND), the output will only be low if all inputs are high. NAND gates have a property called functional completeness, meaning that all other logic gates can be constructed from NAND gates. Below is the truth table for a dual input NAND gate.
NAND gate truth table.jpg


5.5 NOR gate
NOR gates have the logic of an OR gate followed by a NOT gate (hence the name NOR), the output will only be high if all the inputs are low. Like NAND gates, NOR gates have a property called functional completeness, meaning that all other logic gates can be constructed from NOR gates. Below is the truth table for a dual input NOR gate.

NOR gate truth table.jpg


5.6 XOR gate
XOR gates have logic similar to that of an OR gate, the output will be high if only one of the inputs is high. XOR gates may also be known as EXOR, EOR or Exclusive-OR gates. Below is the truth table for a dual input XOR gate

XOR gate truth table.jpg


5.7 XNOR gate
XNOR gates have logic similar to that of an NOR gate, the output will be low if only one of the inputs is high. XNOR gates may also be known as EXNOR, ENOR or Exclusive-NOR gates. Below is the truth table for a dual input XNOR gate

XNOR gate truth table.jpg


6.Schmitt gates
You may see when searching for logic gates some of them are labelled Schmitt ..... gate/trigger. Schmitt gates are logic gates with Schmitt triggers before their inputs. The property that Schmittt gates/ triggers possess, called hysteresis, is extremely important when feeding an analogue signal into a logic gate, the simple explanation is that turning on (going from 0 to 1) and turning off (going from 1 to 0) will happen at slightly different levels of voltages, this can be used to prevent rapid switching, where a circuit turns on and off extremely fast. E.g. a dark activated light, when it goes dark the light is set to come on, however when the light does come on it raises the light level slightly, with a standard logic gates this would cause the input and output to rapidly fluctuate between a 1 and a 0. With a schmitt logic gate/ trigger, under normal circumstances, this would not happen. For a more in depth explanation see: here

7. Logic gate uses

The outputs of logic gates can be fed in to the inputs of other logic gates, enabling the possibility of creating very complex logic systems to deal with lots of inputs. Logic gate outputs can also be used to turn a load on and off by feeding the output of the logic gate in to the base of a bipolar-junction transistor.
Author
Anon_LG
Views
72
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Anon_LG

Top