Файл: Microcontroller Programming. Thi Micro Chip PIC (Julio Sanchez, 2007).pdf

ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 14.06.2025

Просмотров: 8595

Скачиваний: 0

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

Circuits and Logic Gates

85

A

A

A

Y

Y

Y

B

B

B

AND

OR

XOR

A

Y

NOT

A

A

A

Y

Y

Y

B

B

B

NAND

NOR

XNOR

Figure 5-10 Logic Gate Symbols

5.4 Transistor-Transistor Logic

Transistor-Transistor Logic is a class of digital circuits built from bipolar transistors and resistors. TTL is used in a popular family of integrated circuits originally developed by Texas Instruments in 1962. These are known as the 7400 series of ICs. Components of the 7400 family are used in computers, industrial controllers, music synthesizers, and electronic test and measurement instruments. TTL provided a low-cost digital option to the expensive analog methods of the day.

TTL integrated circuit are available to perform the following functions:

1.logic gates such as AND, OR, NAND, NOR, and XOR

2.flip-flops

3.latch elements

4.counters and adders

5.shift registers

6.timing circuits

7.data bus drivers and buffers

8.display drivers

9.multifunction logic

10.memory

11.programmable logic arrays


86

Chapter 5

The TTL logic gates require a 5-volt DC power supply regulated to within 5% (5V ± 0.25V). They are available in a variety of packages. For prototyping and manually built applications the most-used package is the dual inline package (DIP). DIP integrated circuits have 14, 16, 20, 24, 28, or 40 pins arranged in a row along two sides of a rectangular plastic package containing the silicon chip. The ground pin is usually the last in the first row. For example, pin 7 of a 14-pin DIP. The 5-volt power pin is usually the highest numbered pin. For example, pin 14 on the 14-pin DIP. The pins in a DIP package are spaced 0.1" apart. DIP components are mounted on a printed circuit board by inserting the pins through a set of holes and then soldering the pins in place. Figure 5-11 shows two integrated circuits in a DIP package.

notch

dot

mark

pin 1

Figure 5-11 Dual Inline Packaged (DIP) Integrated Circuits

One objection to DIP packages is that they become too large if more than 40 pins are required. The pin grid array (PGA) is one solution to this problem. PGAs are square packages with an array of pins coming out of the bottom. Microprocessors are sometimes implemented in PGAs. Surface mount technologies are often used in commercial electronic boards, since they allow fitting more circuitry into a smaller space. The pins on surface mount packages are bent out horizontally and soldered to the top surface of the board. In surface mount ICs the pin spacing is .05 inch or less. But surface mount packages are difficult to handle outside of commercial production, since the smaller pins spacing require special soldering irons and inspection microscopes. For non-manufactured projects, such as the ones in this book, the

DIP is the most suitable.

In the present context we discuss TTL logic gates furnished as integrated circuits constructed using semiconductor electronics. The part number of logic gate ICs is in the format 74XXX, where XXX refers to the specific gate implementation.

5.4.1 Inverter Gates

IC number 7404 is a hex inverter. Here the term hex refers to the six inverters included in the circuit. Figure 5-12 shows the schematics of the 7404 hex inverter.

+5V

14

13

12

11

10

9

8

In

Out

7404

H

L

L

H

1

2

3

4

5

6

7

GND

Figure 5-12 7404 TTL Hex Inverter IC


Circuits and Logic Gates

87

The function of a given logic gate can be shown in a truth table, such as the one in Figure 5-12. The truth table lists the outputs (high or low) for the given inputs (also high or low).

5.4.2 The AND Gate

The 7408 is an AND gate that includes four individual gates per package. The 7408 AND gate and its truth table are shown in Figure 5-13.

+5V

14

13

12

11

10

9

8

In1

In2

Out

L

L

L

7408

L

H

L

H

L

L

H

H

H

1

2

3

4

5

6

7

GND

Figure 5-13 7408 Quad 2-input AND Gate

The AND gate in Figure 5-13 is described as quad 2-input. Four individual AND gates are contained in the circuit and each one has two input lines. The gate logic corresponds to the Boolean AND: if both inputs are high, then the output is high, otherwise the output is low. If the input lines are designated as A and B, and the output as Y, then the AND operation can be expressed in the equation:

Y = A• B

In this case the dot operator represents the AND function, not arithmetic multiplication.

5.4.3 The NAND Gate

A variation of the AND gate is the 7400 NAND gate. In this case the AND operation is replaced with the inverted AND, or NAND. Thus, if both inputs are high, the output is low, otherwise the output is high. The 7400 NAND gate is shown in Figure 5-14.

+5V

14

13

12

11

10

9

8

In1

In2

Out

L

L

H

7400

L

H

H

H

L

H

H

H

L

1

2

3

4

5

6

7

GND

Figure 5-14 7400 Quad 2-input NAND Gate


88

Chapter 5

Note that in the NAND gate of Figure 5-14, the AND symbol has been replaced with the NAND symbol as in Figure 5-10. The logic equation for the NAND gate is the combination of the AND and NOT operations, as follows:

Y = A• B

Here the vertical bar over the equation’s right-hand side indicates negation.

5.4.4 The OR Gate

The 7432 OR gate performs the Boolean OR of the two input lines. If either line A or line B is high, then line Y is high, otherwise line Y is low. Figure 5-15 is a diagram of the 7432 quad 2-input OR gate.

+5V

14

13

12

11

10

9

8

In1

In2

Out

L

L

L

7432

L

H

H

H

L

H

H

H

H

1

2

3

4

5

6

7

GND

Figure 5-15 7432 Quad 2-Input OR Gate

The equation of the OR operation with two inputs is:

Y = A + B

The plus sign in the previous equation indicates the Boolean OR operation, not arithmetic addition.

5.4.5 The NOR Gate

Another version of the OR gate is the 7402 NOR quad 2-input NOR gate. Here the Boolean OR is negated, as shown in Figure 5-16.

+5V

14

13

12

11

10

9

8

In1

In2

Out

L

L

H

7402

L

H

L

H

L

L

H

H

L

1

2

3

4

5

6

7

GND

Figure 5-16 7402 Quad 2-input NOR gate


Circuits and Logic Gates

89

The equation for the NOR gate consists of negating the inputs of the OR gate, as follows:

Y = A + B

The gates shown in this section contain two input lines, labeled A and B. Logic gates are also available that contain more than two inputs, for example, the 7410 is a three 3-input NAND gate. Other logic gates with 3, 4, and 8 inputs are available. For example, the 7410 is a three 3-input NAND gate, the 7420 a two 4-input NAND gate, and the 7430 is a single 8-input NAND gate.

5.4.6 Positive and Negative Logic

The gates discussed so far assume that logic high is regarded as true and logic low as false. This is called positive logic. If we were to invert these assumptions so that logic high is regarded as true and logic low as false we would have a system based on negative logic. In this case the AND and the OR functions would be exchanged in regards to positive logic.

Digital circuit designers can often reduce the number of required integrated circuits by switching between positive and negative logic. For example, if an extra AND gate is available but the circuit requires an OR gate, the AND gate can be used by assuming negative logic. Circuit diagrams can be shown to use positive or negative logic by the position of the inverting circles. By convention, a circle on the input lines indicates negative logic and positive logic if it is placed on the output line. Figure 5-17 shows the equivalent circuits for gates using positive and negative logic.

POSITIVE

NEGATIVE

LOGIC

LOGIC

=

=

=

Figure 5-17 Circuit Symbols for Positive and Negative Logic Gates

The position of the inverting circles in the circuit diagrams is consistent with the notion that inverting the inputs changes the gate function. Thus, a negative logic AND gate functions as an OR gate and vice versa. In this manner a circle on the input line is read as the signal on that line being active low. An active low signal is asserted as true when it is electrically low. For example, the output of the 2-input NAND gates of Figure 5-14 is low when inputs A and B are both high, as shown in the

90

Chapter 5

circuit truth table. But the NAND gate can also be interpreted as a negative logic OR gate as in Figure 5-17. The one logic operation that is the same in negative or positive logic is NOT, as also shown in Figure 5-17.

An alternative explanation of positive and negative logic can be based on the truth table for the Boolean OR, as follows:

A

B

|

Y

--------

|

-----

T

T

|

T

T

F

|

T

F

T

|

T

F

F

|

F

In binary form and positive logic the OR truth table is as follows:

A

B

|

Y

--------

|

----

1

1

|

1

1

0

|

1

0

1

|

1

0

0

|

0

If we now invert the binary values in the second table, the results are as follows:

A

B

|

Y

--------

|

-----

0

0

|

0

0

1

|

0

1

0

|

0

1

1

|

1

Note that the last truth table matches that of the AND function. Thus, by inverting the truth table for the logical OR we produced the truth table for logical AND, validating the previous assertion that a negative logic AND gate is equivalent to an OR gate.

5.4.7 The XOR Gate

The last elementary logic gate is called the XOR or exclusive OR gate. In the XOR function the output is high if the inputs have opposite values, otherwise the output is low. Figure 5-18 shows the 7486 quad 2-input XOR gate and the corresponding truth table.

+5V

14

13

12

11

10

9

8

In1

In2

Out

L

L

L

7486

L

H

H

H

L

H

H

H

L

1

2

3

4

5

6

7

GND

Figure 5-18 7486 Quad 2-input XOR gate