Practical Electronics/Logic

< Practical Electronics

Ii In the sense of electronics, logic means that the circuit works using only two voltage levels - high and low (or on/off, true/false or 1/0). These voltage levels are sometimes called logic levels and digital circuits use only these logic levels to represent information.

Logic Gates

InputOutput
AQ
01
10

Logic gates are devices that can combine multiple inputs at independent logic levels and come up with an output accordingly. There are many kinds of logic gates, and the distinction lies in that each kind processes the inputs differently, and may give different ouputs for the same inputs.

The way the logic gate processes different inputs is given in a truth table for that gate, which lists all the possible combinations of inputs next to their outputs. An example is given for a simple one-input gate with the function of giving the opposite logic level at the output to the one at the input. The inputs are given on the left, and the outputs are on the right. Generally, the inputs are called A, B, C, etc., and the output is labelled Q. In this case, there are only two possible inputs, 1 or 0, but logic gates can have any number of inputs.

There are seven kinds of logic gates,each kind of logic gate has a circuit symbol associated with it. In fact, there are several conflicting standards defining the symbols for logic gates. The standard symbols are ANSI symbols, sometimes called the MIL symbols. These are the most distinctive and are widely used and recognised. It is recommended to use these symbols for basic logic cirucits, and this wikibook will use them to the exclusion of the others. It is better to use the IEC (rectangular) symbols for advanced logic designs, but this is at a higher level that this book. The comparison between the three symbol sets is given here.

Boolean Algebra

Boolean algebra is a way to mathematically express logical operations performed on data. There are symbols for the operations performed by each logic gate, and these are given in the relevant sections below. It uses several symbols that are not generally used anywhere else, and the use of these will be also be explained below. Boolean algebra can be used to represent several logical operations done at once, and this be explained in this section.

Each kind of gate has its own symbol used when writing the functions down, but ideally, only the symbols for NOT, AND, OR and XOR are used, to reduce confusion, and to ease simplification.

The 7 Basic Gates

NOT

AQ
¬A
01
10

A NO gate or an inverter is the simplest kind of logic gate. Its function is to give the opposite output to its input - if it gets a high, it gives a low, and vice versa. This is equivalent to saying that the output is not the input.

The circuit symbol, left, for a NOT gate is a triangle with the point facing towards the output, and a circle at the output.

The boolean symbol for the NOT operator is either a line over the relevant input, or a "¬" symbol preceding it. Thus, the statement that the output, Q, is not the input, A, is either

\bar{A}=Q or \neg A = Q\,

For instructions on how to write this in Wikitext or HTML, see here.

NOT gates can be implemented in a variety of ways. See the following for more information:


AND

ABQ
AB
000
010
100
111

An AND gate gives a high output only when both inputs are high. If one or more inputs are low, then the output is also low. This is equivalent to saying that the output is high when one input and the other one are high.

The circuit symbol, left, for an AND gate is a box with one rectangular end (inputs) and one semi-circular end (output).

Boolean multiplication is equivalent to the AND function (see why here Thus, the AND gate can be represented by a multiplication dot · or just putting the two terms together.

A \cdot B=Q or AB=Q \,.

For instructions on how to write this in Wikitext or HTML, see here

See the following for more information on the implementation of AND gates:


NAND

ABQ
A|B
001
011
101
110

A NAND gate gives a low output only when both inputs are high. If one or more inputs is low, then the output is high. This is equivalent to saying that the output is NOT the output of an AND gate presented with the same inputs. This NOT AND combination is shortened to just NAND.

The circuit symbol, left, for an NAND gate is a box with one rectangular end (inputs) and one semi-circular end (output). This output end has a small circle, denoting an inversion.

The boolean symbol for the NAND operator is a vertical line (the Sheffer Stroke). Thus, the NAND gate can be represented by the boolean statement

A | B=Q \,

NAND can also be written as the negation (NOT) of the AND:

\overline {A \cdot B}=Q or \overline {A B}=Q \,.

This is the prefered notation, as it is easier to see what is happening in terms of the basic functions.

See the following for more information on the implementation of AND gates:

NAND gates have the property that any other logic gate can be mode from just NAND gates. For the method of achieving this, see NAND Logic(NAND logic).


OR

ABQ
A+B
000
011
101
111

An OR gate gives a high output if any input is high. If all inputs are low, then the output is low. This is equivalent to saying that the output is high only when one OR the other OR both inputs are high.

The circuit symbol, left, for an OR gate is similar to that of an AND gate, but with a pointed end (ouptuts) and a concave end (inputs).

Boolean addition is eqivalent to the OR function (see why here Thus, the OR gate can be represented by a plus sign (+):

A + B=Q \,

A V-shaped symbol can also be used, but it is not common and should not generally be used.

A \lor B=Q \,

See the following for more information on the implementation of OR gates:


NOR

ABQ
A⊥B
001
010
100
110

A NOR gate gives a high output only if no inputs are high. If an input is high, then the output is low. This is equivalent to saying that the output is high only when when neither one NOR the other input is high. It is the opposite to an OR gate.

The circuit symbol, left, for a NOR gate is similar to that of an OR gate, but for the addition of a circle to denote the inversion from an OR gate.

NOR can also be written as the negation (NOT) of the OR:

\overline {A + B}=Q.

This is the preferred notation. Another symbol for the NOR operator is a symbol like "⊥", which can be used when the line over the top cannot easily be drawn (e.g. in normal text like this):

A \perp B=Q \,

See the following for more information on the implementation of NOR gates:

NOR gates have the property that any other logic gate can be mode from just NOR gates. For the method of achieving this, see NOR Logic.

XOR

ABQ
A≠B
000
011
101
110

An XOR gate short for "exclusive-OR", gives a high output if one input is high and the other is low. If both inputs are the same, the output is low. This is equivalent to saying that the output is high only when one OR the other but not both inputs are high.

The circuit symbol, left, for an XOR gate is similar to that of an OR gate, but with a double line at the concave input end.

The boolean symbol for the XOR operator is a plus-sign in a circle or, because it only returns a high when the inputs are different,a not-equal-to sign (not generally used). Thus, the XOR gate can be represented by the boolean statements

A \oplus B=Q \, or (A \ne B)=Q \,

For instructions on how to write this in Wikitext or HTML, see /Practical Electronics/Help/Logic Symbols#XOR

See the following for more information on the implementation of XOR gates:

XNOR

ABQ
A≡B
001
010
100
111

An XNOR gate short for "exclusive-NOR", gives a high output if both outputs are the same - it is the opposite of the XOR gate.

The circuit symbol, left, for an XNOR gate is similar to that of an XOR gate, but it has a circle representing the inversion at the ouput.

XNOR is written as the negation of the XOR function:

\overline{A \oplus B}=Q

As the XNOR function only returns a "one" when both inputs are the same, the boolean symbol for the XNOR operator is an equalvalent-to sign (≡) sign (not equals) in normal text. Because this looks very much like an equals sign it is easily mistaken and should not be used where possible.

(A \equiv B)=Q \,

See the following for more information on the implementation of XNOR gates:

Uses of Logic Gates

Logic gates underpin most of digital electronics, (indeed the entire on-board computer in the Apollo spacecraft was made of NOR gates).

The most obvious uses is for simple control. Imagine designing a washing machine so that the water only turns on when the washing is loaded (logic-1), the door is closed (logic-1) but the clothes are not yet wet (logic-0). This can be done by ANDing the first two conditions, and inverting the third. Now, AND these together, and you get a high only when all three conditions are satified.

WashingDoorWet ClothesWashing AND DoorNOT Wet ClothesWater (output)
ABCAB¬C(AB)(¬C)
000010
001000
010010
011000
100010
101000
110111
111100

By using just three logic gates (and, at most two ICs - one 4081 and one 4049), the problem has been solved.

However, logic gates are also used to make flip-flops and other vital electronic components.

One convenient use of them is as transmission gates which allow a signal to pass only under certain conditions.

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.