## Due: In Class

In class, we have begun a discussion of how basic logic gates can be used to create complex logical and arithmetic circuits.

In this lab, you will use a logic circuit simulator to investigate the design and analysis of logic circuits.  During the lab you will be asked a series of questions. Record your answers and turn them in to the instructor at the end of the lab period.

### In Lab

The three basic logic gates are the NOT gate, the AND gate, and the OR gate.  These are symbolized as follows:

NOT                         AND                             OR

We will use these basic gates as building blocks for more complex circuits. We will build our circuits using an on-line logic circuit simulator. Open a new browser window and go to the page http://www.gac.edu/~hvidsten/courses/MC170/simcir121/simcir.html
to run the simulator.

To use the simulator one can click and drag logic gates and other elements onto the page and connect them to form circuits.

Notice that the cicuit loaded initially involves a single AND gate. Click the upper toggle switch. The top-most LED (the A LED)turns red to indicate that current is flowing through the switch (which corresponds to a value of 1). No current means a value of 0 is fed to that input of the gate. Notice that when both switches are depressed, the rightmost LED turns red. This corresponds to two 1s being input to the AND gate, which produces a 1 (as it should). (Note: LED stands for Light Emitting Diode; you can think of it as a little red light that glows when current is fed to it.)

Notes on the use of the simulator:
• To create a new circuit element, simply left click on the element in the window on the left-hand side of the interface (note: you can use the scroll bar to scroll in this window). Hold down the mouse button and drag the element into the white drawing area.
• To delete an element, left click it. While it is surrounded by a black box, click on the scissors icon in the top menu bar.
• You can connect the output of one element to the input of another by simply left-clicking on the output box, holding down the mouse button while dragging, and then letting go when you reach the input box of the next element.
• To delete a connection, left click once on the input box involved in the connection.
• Every circuit will need a 5V power source (the pink box). The power source should be connected to each input switch (normally toggle switches).
• You should have one toggle switch and LED for each input to your circuit to clearly indicate whether that input is a 0 or 1.
• You should also have an LED to indicate the final output of the circuit.
• To change the label on a LED, double-click near the end of the label of the LED, using the left mouse button. A dialog box will popup for you to type in a new name.

EXERCISE 1:   Starting with the initial configuration, replace the AND gate with an XOR gate (labeled EOR in the simulator). Construct a truth table based on setting the two toggle buttons of the simulator to 0 or 1. Do the results match the truth table we had in class for the XOR gate?

EXERCISE 2:  Use the Circuit Simulator to build the circuit indicated below and then complete the truth table given below the circuit diagram.

A B C | Z
------+---
0 0 0 |
0 0 1 |
0 1 0 |
0 1 1 |
1 0 0 |
1 0 1 |
1 1 0 |
1 1 1 |

EXERCISE 3:  Use the simulator to construct the half-adder on page 294 of the text.  Create two output LED's for the circuit and label one of them "sum" and one "carry" so that they represent the correct carry and sum outputs. Print out the circuit to hand in for this exercise.
EXERCISE 4:  Use the simulator to construct the circuit for the logical statement
(A and B) or ( not B or A).  Print out the circuit to hand in for this exercise.
EXERCISE 5:  What did you find most confusing in working with the Logic Circuit Simulator?