Docsity

Lab 1: Basic Digital Circuits - Logic Circuit Lab | ECE 241, Lab Reports of Electrical and Electronics Engineering

Toggle sidebar
bg1
COE/EE 244
Logic Circuit Lab Lab #1; Page 1/18
Spring 2003
Basic Digital Circuits
Due: By 6:00pm on Wednesday February 12.
1 Logic Gates and Circuits
In a digital system there are only two stable states, logic 1 and 0 (or HIGH and LOW, TRUE and FALSE,
etc.) In a popular logic family called TTL (Transistor-TransistorLogic), the low logic level is assigned to
0V and the high logic level is assigned to 5V (see Section 3.10 of Wakerly’s Digital Design, Principles
and Practices for more information. Each logic gate is actually implemented in part of an integrated
circuit (IC), with each gate made using several transistors. For the most part we do not need to concern
ourselves with the actual circuitry inside each gate, only the interconnections between individual gates.
Usually each IC package contains several individual gates. The 7408 chip implements 4 two input AND
gates and is commonly referred to as a “Quad two input AND” chip. Similarly the 7432 chip is a “Quad
2 input OR” chip while the 7404 chip is a “Hex Inverter” since it contains 6 inverters. The IEEE standard
logic symbols for each of these devices is shown in Figure 1. The IEEE symbols are better suited to
represent ICs than the distinctive symbols sincetheir rectangular outlines can easily fit together.
(1)
(2)
(4)
(5)
(9)
(10)
(12)
(13)
(3)
(6)
(8)
(11)
1Y
2Y
3Y
4Y
1
A
1
B
2
A
2
B
3
A
3
B
4
A
4
B
(1)
(2)
(4)
(5)
(9)
(10)
(12)
(13)
(3)
(6)
(8)
(11)
1Y
2Y
3Y
4Y
1A
1B
2A
2B
3A
3B
4A
4B
(1)
(5)
(9)
(11)
(13)
(3)
(2)
(4)
(6)
(8)
(10)
(12)
1Y
2Y
4Y
5Y
6Y
3Y
1A
2A
3A
4A
5A
6A
1
≥1
&
7408 7432 7404
positive logic: Y=AB positive logic: Y=A+B
positive logic: Y=A
Figure 1: Standard Logic Symbols
2 Logic Circuits and Diagrams
Each of the chips in Figure 1 are available in 14 pin Dual-In-Line packages or DIPs. The pin numbers
assigned to each logic signal are shown inside brackets in the figure. The pins are numbered as shown
in Figure 2. Pin 1 is usually identified as the pin to the left of an indentation or cutout in one end of the
chip that is visible when the chip is viewed from the top. Occasionally, it is also identified by a printed
or indented dot placed just next to it.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Lab 1: Basic Digital Circuits - Logic Circuit Lab | ECE 241 and more Lab Reports Electrical and Electronics Engineering in PDF only on Docsity!

Logic Circuit Lab Spring 2003

Basic Digital Circuits

Due: By 6:00pm on Wednesday February 12.

1 Logic Gates and Circuits

In a digital system there are only two stable states, logic 1 and 0 (or HIGH and LOW, TRUE and FALSE, etc.) In a popular logic family called TTL (Transistor-Transistor Logic), the low logic level is assigned to 0V and the high logic level is assigned to 5V (see Section 3.10 of Wakerly’s Digital Design, Principles and Practices for more information. Each logic gate is actually implemented in part of an integrated circuit (IC), with each gate made using several transistors. For the most part we do not need to concern ourselves with the actual circuitry inside each gate, only the interconnections between individual gates. Usually each IC package contains several individual gates. The 7408 chip implements 4 two input AND gates and is commonly referred to as a “Quad two input AND” chip. Similarly the 7432 chip is a “Quad 2 input OR” chip while the 7404 chip is a “Hex Inverter” since it contains 6 inverters. The IEEE standard logic symbols for each of these devices is shown in Figure 1. The IEEE symbols are better suited to represent ICs than the distinctive symbols since their rectangular outlines can easily fit together.

(1) (2) (4) (5) (9) (10) (12) (13)

(3)

(6)

(8)

(11)

1Y

2Y

3Y

4Y

1A 1B 2A 2B 3A 3B 4A 4B

(1) (2) (4) (5) (9) (10) (12) (13)

(3)

(6)

(8)

(11)

1Y

2Y

3Y

4Y

1A 1B 2A 2B 3A 3B 4A 4B

(1)

(5) (9) (11) (13)

(3)

(2) (4) (6) (8) (10) (12)

1Y 2Y

4Y 5Y 6Y

3Y

1A 2A 3A 4A 5A 6A

1

& ≥ 1

7408 7432 7404

positive logic: Y=AB positive logic: Y=A+B

positive logic: Y=A

Figure 1: Standard Logic Symbols

2 Logic Circuits and Diagrams

Each of the chips in Figure 1 are available in 14 pin Dual-In-Line packages or DIPs. The pin numbers assigned to each logic signal are shown inside brackets in the figure. The pins are numbered as shown in Figure 2. Pin 1 is usually identified as the pin to the left of an indentation or cutout in one end of the chip that is visible when the chip is viewed from the top. Occasionally, it is also identified by a printed or indented dot placed just next to it.

Logic Circuit Lab Spring 2003

1 2 3 4 5 6

7 8

9

10

11

12

14 13

Figure 2: Identifying Pin 1

You will notice that pins 7 and 14 are not referenced in the logic diagrams. In 14 pin DIP packages, pin 7 isusually connected to ground (Gnd), and pin 14 isusually 1 connected to the 5V power supply (Vcc). These connections must be made or the chip will not work. TTL logic circuits are not passive! While TTL circuits are fairly forgiving, they can be destroyed by wiring mistakes. Take care not to connect pin 7 to power and pin 14 to ground, or to connect the outputs of two or more gates together. Only open collector and Tri-state gates are designed to operate with outputs of several gates connected together, and even in these cases, care must be taken. A complete logic diagram including pin numbers using the 7408 and 7432 chips can be drawn as is done in either of Figure 3 or Figure 4,

(1) (2) (1) (3) (2)

(3)

X

Y

Z

F

U1: 7432

U2: 7408

Figure 3: A Logic Diagram Using Distinctive Symbols

(1) (2) (1) (3) (2)

≥ (^1) (3) &

X

Y

Z

F

U1: 7432

U2: 7408

Figure 4: A Logic Diagram Using IEEE Standard Symbols

Notice that even though there are four AND gates on each IC, only the gates used are shown, and each gate is drawn separately. The U (unit) numbers can be used to identify which chip each gate is found on. A wiring diagram for this circuit is given in Figure 5. The only diagrams you will need to make for this lab are the logic diagrams with part and pin numbers as in Figure 3 or Figure 4. They clearly convey how the circuit is intended to work logically, and they also give the chip and pin numbers which facilitate circuit implementation, testing and debugging.

(^1) Occasionally, different pins are used, so be sure to check the chip’s pinout information in a databook before making any

connections.

Logic Circuit Lab Spring 2003

8dip

20 dip

16 dip

14 dip

20 dip

20 dip

8dip

8dip

Y

VDD VDD VDD VDD VDD VDD VDD CLK O O O O O PD PD PD PD PD PD PD PD PAS PDS PWE PINT BN1S BN1P BN2S BN2P GND GND GND GND GND GND GND

CA CB CC CD CE CF CG DP A A A A SW SW SW SW SW SW SW SW BTN BTN BTN BTN LDG LD LD LD LD LD LD LD LD AUDC AUD AUD

PWE PD PD PD PD PD PD PD PD PAS PINT PRS PWT PDS GND

GND GND O O O R G B HS VS RXD TXD PS2C PS2D

SW (^) SW

SW (^) SW (^) SW (^) SW

SW (^) SW

BTN

BTN

BTN

BTN

LD LD (^) LD (^) LD

LD LD (^) LD

LD

(c) CSCOLE 2000

RP2RP

RP4RP

DSP

DSP

RP6RP C C C C

U1 RP C

R1 RP

RP9U2 C

BN1 BN (^) J

J

J

J

J

U

U

U

U

U

U

U

U10J

J

J

LD

J

J

J

PROG

PORT

INTPRGDINDONECLKGNDVDD

R

SW

RP

RP

C R

C7 C

C11 C10C R

D D

R

C

R

D

R

C13 C

C

C

C C

C

C

C24 C

C

C23 C

R

R

R9 R10 C

J

U

U

F

Z

X

Figure 6: Implementation of a Circuit on a Digilab board

Logic Circuit Lab Spring 2003

Each row of 5 holes forms one node (i.e., the five holes are electrically connected)

J2 connector

Figure 7: Making Connections on a Breadboard

J2 connctor VDD is usually

GND is usually located in this corner Pin 1

located in this corner

Figure 8: Placing DIP Devices on a Breadboard

Logic Circuit Lab Spring 2003

  1. Use a logic probe to check that power and ground is properly connected to each chip.
  2. Next, beginning at the output pin, move backwards though the circuit checking the logic at each point with the logic probe. For example, consider Figure 3. Assume that, for a particular combi- nation of inputs, the output at pin 3 of U2 is supposed to be high, but is in fact low as indicated by an LED to which it is connected. First check pin 3 of U2 with the logic probe to make sure that it really is low and that the LED is not just giving a false indication (maybe it is burned out or the connection between pin 3 and the LED is broken). Assuming that the probe shows that pin 3 of U is low, we next check the gate inputs at pins 1 and 2 of U2. If pin 3 of U2 is supposed to be high, both pins 1 and 2 should also be high. If the probe shows that they are, then itappears that the gate is bad. However, the probe may show that one or both inputs are not connected to anything by indicating neither high nor low. Or it may show that one input is in fact low. In this case the next step is to check the gate output that is connected to this input. Continue this process, working back through the circuit, until a bad gate or a bad connection is identified.
  3. When you find a gate that appears to be bad because its output does not agree with its inputs and the logic function it is supposed to implement, there are a number of things to consider.

(a) The pins you thought were input pins may not be. Check the pin numbers for the inputs and output in the TTL databook. Also check that you properly identified pin one on the chip. (b) You may have the wrong chip. If you had used a 7400 instead of a 7408 for U2, the output at pin 3 should be low if both pins 1 and 2 are high. Check the chip number. The chip tester in the lab can also help you identify chips that have illegible or indecipherable numbers. (c) It may be that the output is being held at the incorrect voltage level by a bad connection. Con- sider what can happen if the outputs of two logic gates are accidentally connected together. One gate may be attempting to drive the output to a high voltage level while the other may be attempting drive the output low. One gate will be stronger than the other and effectively win this tug of war. To test for this situation, disconnect any wires that are directly connected to the output of the gate you suspect to be bad. Then test the end of each disconnected wire with the logic probe. If the probe shows a high or low value on any wire, then you have acci- dentally connected two outputs together and you should trace down and correct the offending connection. Since this situation can physically damage chips, you should probably test any chips whose gate outputs you have connected together. (d) The gate may in fact be bad. Turn the power off, remove the chip from the circuit and place it in the tester. If the chip tests bad (and even if it tests good) you should not simply replace it in your circuit. With the chip still out of the circuit, turn the power back on in the circuit and check the points in the circuit that were originally connected to the chip outputs. Any point that shows a high or low value indicates a point where two outputs were connected together. This situation needs to be corrected before the chip is placed back in the circuit.

  1. If you do not find a bad gate or connection, then the problem is likely in your original design. Go back and check your work.

Logic Circuit Lab Spring 2003

Once a problem has been corrected, you should retest the circuit by observing the output for all possible inputs.

5 Noise Margin

Earlier, we assumed that the high voltage in TTL is 5V and the low voltage is 0V. Figure 9 shows the steady state output of a 7404 inverter gate as a function of the input voltage at several operating temperatures. We notice that the actual range of output voltages appears to be from 0 2 V to 3 5 V. We

Vin (^) Vout

Vin

Vout

0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.

T=-55ºC

T=125ºC (^) T=25ºC

Figure 9: 7404 Inverter Transfer Function

notice that, independent of temperature, if Vin  2 V , Vout will be 0 2 V so we can safely assume that the gate will interpret an input voltage greater than 2 V as a high voltage. Similarly, Figure 9 shows that an input voltage less than 0 8 V will reliably be seen as a low voltage. These two values are presented in Figure 10 as VIH min (V Input High min) and VIL max (V Input Low max). Each individual circuit will have slightly different characteristics, but the designers of TTL circuits guarantee that if the voltage on each gate input is either greater than VIH min or less than VIL max , then the voltage on the gate output will never be less than 2 4 V ( VOH min ) for high output or never greater than 0 4 V ( VOL max ) for low output. Typically, output voltages will be nearer the values of 3 4 V and 0 2 V. Note that VOH min is greater than VIH min. In other words, a TTL output produces a high voltage greater than that required by another TTL input. The difference between the two values, called thenoise margin, is 0 4 V. The same margin exists for the low voltages. Thus, a line connecting a TTL gate output to a TTL gate input can tolerate up to 0 4 V of noise added to or subtracted from the signal without causing the input gate to misinterpret the intended logic. Since noise is always present in electrical systems, it is important to have such noise margins.

Logic Circuit Lab Spring 2003

n

IOH

IIH

IIH

n

IOL

IIL

IIL

n = min( )

IOH IOL

IIH ,IIL

max max max max

Figure 11: Fanout

neously, the input and output voltage waveforms in Figure 12 are shown with finite rise and fall times. t (^) PLH represents the low to high propagation delay and t (^) PHL represents the high to low propagation delay. The timing diagram in Figure 12 shows how the voltages correspond to logic levels. Rather than switch logic levels as the voltages drop below 0 8 V and rise above 2 0 V , the switching takes place at 1 5 V – halfway between the typical high and low values. This is not a bad approximation since rise and fall times are generally quite short. Table 1 shows the propagation delays for the different styles of 04 type TTL inverters. The “S” and

t (^) PLH ns  t (^) PHL ns  typ max typ max 7404 12 22 8 15 74LS04 9 15 10 15 74S04 3 4.5 3 5

Table 1: Propagation Delays for 04 TTL Inverters

“LS” designations in Table 1 refer to “Schottky” and “Low Power Schottky” versions of TTL gates. These versions use different circuits to implement logic gates. The propagation delay of a gate increases with the fanout and can vary if different types of TTL gates are used together. The delays shown in Table 1 assume that the inverter output is driving only a single input of a similar type.

7.1 Timing Diagrams

The effect of propagation delay on circuits is analyzed by means of timing diagrams. Being able to construct them is a critical skill that anyone who wishes to design digital circuits must have. Figure 13

Logic Circuit Lab Spring 2003

A X

A

X

t (^) phl t (^) plh

1.5V

3.0V

0V

1.5V

3.0V 0V

A

X

Voltage levels

Logic levels

Figure 12: Inverter Propagation Delay

shows a truth table, a K-map (a tool for deriving a function from the truth table), a circuit implementing the function, and a timing diagram for the circuit. For this circuit we have assumed that all gates have equal low to high and high to low propagation delays – 10 ns for the Inverter and 15 ns for the AND and OR gates. When constructing a timing diagram we work from the inputs of a circuit to the outputs. In this example we consider what happens when the input C transitions from high to low. We will assume that A and B remain high the whole time. So we first draw lines for A and B showing them to be high and a line for C starting high and then, at some point in time, changing to low. We assume that A , B and C have been high for a long time prior to the point in time that the diagram begins so that we know what levels will be present at X , Y , Z and F at the beginning of the diagram. C changing from high to low will cause Y to change from high to low 15 ns later. It will also cause X to change from low to high 10 ns after C changes. With this knowledge we can complete the lines for X and Y. Next, the change in X will cause Z to change from low to high 15 ns after the change in X. At this point we’ve considered all signals except F. Changes in Y and Z will both produce changes in F. At first you might find it difficult to consider when the output of a gate will change when both its inputs are changing. One way to do this is to draw a line for F assuming that the gate has no propagation delay and then shift the line to the right 15 ns. Another way is to consider the first change first. Since Y changes before Z , we consider Y first. Since Z is low at the point in time Y changes from high to low, F will change from high to low 15 ns later. Then F will change from low to high 15 ns after Z changes from low to high.

7.2 Hazards

Notice that both before and after the change in C , the output of the circuit, F , is high, though the timing diagram shows that it does not stay constantly high. The temporary low in F is a result of propagation delays. Such an unintended result is called ahazard. In this case it is astatic one hazard since the output was supposed to stay unchanged (static) at a high level. Whether or not this hazard is a problem depends

Logic Circuit Lab Spring 2003

1min

on

off

100% 0% 12s

10min

1min

Transmitted command

on off

Received command

Motor speed

Figure 14: Delay Models

exactly the same as the transmitted signal except that it is shifted in time by 10 minutes. Pure delays can always be represented by simple time shifts of the signal. The signal itself is not modified. The inertial delay in the system is shown by the difference in the received signal and the motor speed. If we chose to say that the motor is up to speed when it has reached 50% of full speed, then Figure 14 shows that the system has 12 seconds of inertial delay. Thus, there is an overall delay of 10 minutes and 12 seconds between when the command to turn the motor on was sent, and when the motor is turning at greater than 50% of full speed.

8 Preliminary Questions

  1. In the preceding sections, all our examples involved gates and functions that had at most two inputs. Gates that have more than two inputs are very common. Consider the three input AND function F  A B C (or F  ABC ). In other words, F is 1 only when A is 1 and B is 1 and C is 1.

(a) Find a TTL chip from the data sheets that is capable of directly implementing a 3 input AND function (that is F  ABC ). (b) Draw a logic diagram showing how a 3 input AND function can be implemented using 2 two input AND gates and verify that your design is correct by finding its truth-table as was done in Figure 3.

  1. Consider the following circuit:

Y

X

Z

F

Logic Circuit Lab Spring 2003

Obtain the Boolean expression and truth table that describes this circuit. Compare the truth table with the one given for the circuit in Figure 3. What can you say about these two circuits?

  1. Obtain the Boolean expression and truth table that describes this circuit. Compare the truth table with the one you obtained for the circuit in question 2.

Y

X

Z

F

  1. The propagation delay in a logic gate is largely inertial in nature due to capacitance in the circuit that prevents an output voltage from changing instantaneously.

(a) Complete the following voltage level and logic level timing diagrams for the output of a TTL inverter. Assume that the output of the gate onlybegins to change at the point in time that the input crosses the 1 5 V threshold. Since it is an inverter, whenever the input rises above the logic threshold, the output shouldbegin to fall. Whenever the input falls below the logic threshold, the output shouldbegin to rise. The rate of output voltage change should be 1 5 V  t (^) P where tP represents the propagation delay of the device.

A X

A

X

tp tp tp

A

X

1.5V

3.0V

0V

1.5V

3.0V

0V

Voltage level timing diagram

Logic level timing diagram

pwin

pwout

What happened to the output when the input was asserted (above the 1 5 V threshold) for a period just equal to t (^) P when we use the above model? What would happen to the output if the input were to be asserted for a period of time less than t (^) P?

Logic Circuit Lab Spring 2003

  1. Disconnect Vcc (+5V) from one of the chips in the above circuits. Measure the gate outputs on the chip that has Vcc disconnected. What do you observe? Reconnect Vcc and disconnect Gnd from the chip. Again probe the gate outputs and record your observations. Can this information help you test and debug logic circuits?
  2. Wire up the circuit in Figure 15 as shown in Figure 16 where n is the number of inverter inputs connected to the output of a single inverter. The dashed lines represent jumper wires which can be connected or disconnected to vary n. Start with none of the dashed wires connected. Connect one

OUT

IN

nc

nc

nc

n

Figure 15: Schematic of Fanout Circuit

GND GND

VDD VDD VDD

OUT

GND

74x04 74x04 74x

IN

J

J2 (^) J

Figure 16: Fanout Experiment Setup

of the switches to IN. Use a multimeter to measure the voltage from GND to OUT. (To do this use “banana clips” to connect COMMON on the multimeter to GND on the Digilab board and V on the multimeter to your OUT signal on the Digilab board. Make sure that the ‘V’ switch is pressed on the multimeter to measure volts.) Record your observations and include them in your lab report. Record the voltages at OUT with both High and Low input signals for each configuration:

Logic Circuit Lab Spring 2003

(a) No jumpers connected; zero fanout. (b) J1 connected; fanout of 5. (c) J1 and J2 connected; fanout of 11. (d) J1, J2, and J3 connected; fanout of 17.

What can you conclude from your recorded voltages?

  1. The following experiment will be set up by the TA. It does not require you to construct any of the circuits, but you should analyze and understand the circuits being demonstrated. Consider the following circuit, where n is an odd number of inverters connected one after another.

A

F

n

Figure 17: Schematic of Delay Time Experiment

(a) Complete the voltage level timing diagram in Figure 18 for n  1, n  5, and n  11. You can use the ‘X’ line to calculate the signal after passing through the delay inverters, but be- fore passing through the NAND gate. Assume all gates have the same propagation delay of 1 5 V  t p. If you need more intermediate steps you can draw the voltage diagram on engineer- ing paper. Turn in your diagram to the TA. Do not adjust anything on the oscilloscope.