## ECEN 1400 - Introduction to Digital and Analog Electronics

### Lab 6: Introduction to Digital Logic

#### Goals of this Lab

• Become familiar with basic digital logic building blocks.
• Learn how to simulate logic circuits in Multisim.
• Design and build basic logic circuits using TTL circuits.

This lab is a group activity. Choose to either stay with your current group or form a new one. In either case, declare your group membership by Tue. 2-25-14, 11:59 pm, by submitting a text with the names of the group members to the dropbox on D2L. One lab report per group will have to be turned in on D2L. The responsibilites for the successful completion of the lab consist of three parts: The prelab, the actual lab measurements, and the writing of the report. The report will be graded according to three criteria: Correctness, completion, and clarity. On the cover page you must clearly state the student numbers of the group member who had the main responsibility for the prelab, the group member who had main responsibility for the lab measurements, and the group member who had main responsibility for the report writing. Only put your student numbers and not your names on the the report (so that peer grading is reasonably anonymous). All group members need to be knowledgeable for all three parts, but each member assumes a specific role in the group. The responsibilities must be rotated for future labs so that each group member will have experienced all three roles.

#### Prelab

Digital systems, such as computers, the Internet, modern cell phones, digital television, media players, etc, represent and manipulate information using discrete elements. Decimal systems use the integers 0,1,2,...,9 as the basic elements. Binary systems only use two basic elements, e.g., 0 and 1, or FALSE and TRUE, or low and high, or 0 volts and 5 volts, etc. The three most basic binary logic operations are AND, OR, and NOT. The truth tables, logic symbols, and Boolean equations for these functions are:

Using these three functions as building blocks, any binary logic function can be implemented. Some functions appear frequently enough to be given their own names and symbols. This is shown below for the NAND, NOR, and XOR functions.

A binary logic function f that is specified by a truth table can always be implemented by using an AND function for each input combination for which f = 1 and then taking the OR combination of the AND gate outputs. Here is an example:

This implements the correct function f, but it may use more gates (logic functions) than are truly necessary. For the example above a minimal-cost implementation looks like this:

As it turns out, for practical implementations NAND gates, NOR gates, and NOT gates work best. Fortunately, there is DeMorgan's theorem which says that it is possible to convert AND gates into NOR gates (with inverted inputs) and OR gates into NAND gates (with inverted inputs). Here is the statement of DeMorgan's theorem:

Applying this to the (minimal-cost) version of the example given earlier yields the following implementation that uses only NAND and NOT gates.

For the TTL/CMOS (Transistor Transistor Logic/Complementary Metal Oxide Semiconductor) integrated circuits (ICs) that we are going to use in this and future labs, the device number for 2-input NAND gates is 74AC00 (or SN74AC00) and for NOT gates it is 74AC04 (or SN74AC04). The 74AC00 IC contains four 2-input NAND gates. It has 14 pins, 12 for the NAND gates and 2 for the power supply (VCC and digital GND). The 74AC04 IC has six NOT gates. It has also 14 pins, 12 for the NOT gates and 2 for the power supply.

P1. Digital Logic in Multisim. To try out a logic circuit in Multisim use the following setup. Note that there are no 74AC00 and 74AC04 devices in the Multisim library. The closest equivalents are the 74HC00 and 74HC04 devices and we will use the 4V power supply versions of these integrated circuits in Multisim.

Verify the truth table for the NAND gate by operating the two switches and observing the state of the LED.

A more interesting circuit is the one shown below.

Determine the truth table of this logic circuit. What could it be used for? Hint: Look at the decimal equivalent of the binary numbers (switch J1A is the most significant bit, switch J3A is the least significant bit) for which the LED lights up.

P2. The Upstairs/Downstairs Switching Problem. Suppose you live in a two story house with a stairway between the two floors. When you enter from the bottom you will need to turn on the light in the stairway. Once you reach the top you want to be able to turn off the light in the stairway, no matter what the position of the switch at the bottom is. If someone else uses the stairway later, they should be able to turn on the light when they enter the stairway (either from the top or from the bottom) and then they should be able to turn off the light again when they exit the stairway (either at the bottom or at the top). Write a truth table for the two switches (the one at the top and the one at the bottom) that shows when the light is on (logic 1) and when it is off (logic 0). Assume that the switches connect to ground (logic 0) when they are closed and that they connect to the VCC power supply (logic 1, through a 10 kohm pullup resistor), as shown in the schematics for prelab problem 1. Hint: Start out with both switches in position 0 and assume that the light is off in this state. Then, if one of the two switches changes to position 1, the light turns on. But if the other switch also changes to position 1, the light has to turn off.

Once you have a truth table that shows when the light is on or off, draw a schematic for the implementation using AND, OR and NOT gates. Then use DeMorgan's theorem to convert the circuit so that it only uses NAND and NOT gates. Implement this circuit in Multisim (with a LED instead of the staircase lamp) and test that it is working correctly.

#### Lab Experiments

74 Series Logic ICs. There are several families of logic integrated circuits (ICs) numbered starting from 74xx00, e.g., 74LS00, 74LS04, 74HC00, 74HC04, 74HCT00, 74HCT04, 74AC00, 74AC04, 74ACT00, 74ACT04, etc. The original family of TTL (Transistor-Transistor Logic) ICs started with the 7400 quad 2-input NAND gate. The newer families are characterized by the xx-letters following the 74 prefix. 'LS' stands for low-power Schottky, 'HC' stands for high-speed CMOS, and 'AC' stands for advanced CMOS. The versions with a 'T' at the end, like 'HCT' and 'ACT' have the same switching threshold (the threshold below which the logic value is 0 and above which the logic value is 1) as the original TTL ICs.

The 74LS (low-power Schottky) family uses TTL circuitry. It is fast but requires more power than CMOS versions. The power supply must be +5V +-5% which means that a regulated power supply is necessary.

The 74AC (advanced CMOS) family is slightly faster than both the HC nad the LS families. In static mode it uses substantially less power than the LS family and it can drive loads with up to +-24mA, which is quite a bit better than the LS and HC families. The power supply voltage can vary between 2V and 6V, so the AC family can be used in battery-powered circuits.

The 74ACT (advanced CMOS with TTL threshold) family has the same features as the 74AC family, except for the different threshold between logical 0 and logical 1. Because of this different threshold the power supply voltage has to be regulated to 5V +-5%.

74xx...Function# of Pins
...00 Quad 2-input NAND Gate14
...04 Hex Inverter14

For most of the digital circuits that we will build in this class we will use the 74AC family of ICs.

Connection diagrams for 74AC00 and 74AC04.

E1. Digital Logic on the Breadboard. Build the following circuit (repeated from P1) on your breadboard:

Instead of the 74HC00 IC use a 74AC00. Note that there are 4 gates in one package. You can use any of the 4 for this setup. Look up the connection diagram in the 74AC00 datasheet. Note that the power must be connected as well. Pin 7 is the ground (digital ground in the Multisim schematic) and pin 14 is the positive supply voltage VCC. We will in general use VCC = 5V in the lab (Multisim only offers either 4V or 6V for the 74HC family). It is a good idea in general to connect a 0.1uF capacitor between pins 7 and 14 as close to the IC as possible. This capacitor acts as a short term energy storage for the IC and reduces noise and glitches in the output voltage during the times when changes between logical 0 and logical 1 occur.

For the two switches use the 8-position DIP (dual in-line package) switch from your lab kit. The values of the two 10kohm resistors are not critical, you can use 6.8kohm or 22kohm resistors instead if you don't have any 10kohm resistors.

Here is an example of how to build up the circuit on a breadboard (click image to enlarge):

Test all 4 possible combinations of the switch positions and verify that you obtain the truth table of a NAND gate. Note that when the DIP switch is in the "ON" position, the input to the NAND gate is grounded, corresponding to a logical 0. Measure the output voltage of the gate for both a logical 0 and a logical 1 output.

Optional: Build and test the second circuit from P1 which has three inputs (switches) and uses both NAND gates and Inverters.

E2. Upstairs/Downstairs Switch. Implement the circuit that you designed in prelab problem P2 for the upstairs/downstairs light switch problem on your breadboard. You can only use 74AC00 and 74AC04 ICs. Check the datasheets for the connection diagrams of the ICs and don't forget to power them. Use an LED as the staircase light. Test that the circuit works properly by simulating all possible scenarios of using the staircase lighting by more than one person.

Question: How could your solution be extended from two to three light switches, e.g., for a room with three different entrance/exit doors? Be specific and show a truth table for your solution.