Pages created and updated by Terry Sturtevant Date Posted: May 12, 2017


PC/CP120 Digital Electronics Lab

Digital I/O (Input/Output) Lab

Objective:

Background:

In this lab you will wire DIP switches to NAND gates with LEDs for output.


inputs and outputs

Light Emitting Diodes

Light Emitting Diodes, or LED's for short, emit light when an electric current is passed through them. The amount of current must be limited, however, or the diode will be destroyed. Usually a current of 10 mA is sufficient to light a diode, so if a 5 volt supply is being used, a 500 resistor placed in series with the diode will provide the right current. Note that the diode has one long pin, called the anode, and one short pin, called the cathode. The longer pin is connected to the higher (i.e., more positive) voltage, and the short pin goes to ground.



Note in the following image, the two LEDs on the right light with a high signal (on the yellow wires), while the two LEDs at the left light with a low signal (on the orange wires).
Note that the order of the resistor and LED don't matter as long as the circuit is connected correctly.


LEDs with resistors

Note: You don't have to wire up all of these different configurations; use whichever one suits the application at hand.

DIP Switches

A Dual Inline Package, or DIP switch can be used to select between 0 and 5 volts at some point in a circuit. Since the DIP switch does not have any power or ground connectors this must be done externally.

In our case we want a high (5V) when then switch is turned on, so each input pin we are using must be connected to power. When the switch is off we want a low (0V); but remember when the switch is off it is in a floating state. To resolve our floating pins issue we need to add a resistor to the output pins. Since we are using 8 switches, using 8 individual resistors would be rather tedious, so it is fortunate that we have a device called a resistor array which makes this convenient. The particular resistor array (10x-1-102) which we will use has several resistors in it which all have one end in common. In our circuit we connect the common pin of the resistor array to ground.

The green wire is the signal coming from switch number 6. None of the other switches are connected.



DIP switch with 
         resistor array

In the image below, the cases have been reversed, so that when the switch is closed, the output is low, and when the switch is open, the output is high. Note the changes that happen in this case.

Usually it doesn't matter which switch position (i.e. "on" or "off") gives a high, so either setup is fine.

The output is taken from the side of the switch with the resistor array.

The yellow wire is the signal coming from switch number 8. None of the other switches are connected.



DIP switch connection

Since all of the points in a row are connected, the output can come from any place in the correct row.



DIP switch 
         equivalent connection

Here's the active high setup again, with all of the switches connected.
The green wires are the signal wires coming from the switches.



DIP switch complete connection

This is a side view so you can see the common pin of the resistor array on the left.



DIP switch complete connection

7400 IC

For this lab we will be using the 7400 Quad NAND gate IC. This chip contains four 2-input NAND gates. The pin numbers associated with each input and output of this chip are listed above the input and output of the NAND gates in the diagram. You can also find more information in the datasheet. The pinout is shown below.

NAND pin description

Modular design and debugging

When building a circuit with several components, it's easier to debug if you build it in a modular fashion. This circuit will be in three modules:

Daisychaining boards

When you have multiple breadbords and/or debugger boards, applying power and ground to each board should be achieved by daisy-chaining them.
This makes things organized and easy to debug. It also prevents poor connections due to trying to hold more than one wire in an alligator clip.

daisychaining 
boards

Here's a photograph.

daisychaining

Here's how a modular circuit might look on a single board.

modular layout

You'll build them one at a time, and as each module is known to work, use it to help test the others.

Task:

In this lab you will create a circuit which will turn an LED (light emitting diode) on or off depending on the selected input. The LEDs will give a visual indication of a 1 (LED lighted) or a 0 (LED dark). We connect the DIP switch to select between 1 (high voltage +5v) and 0 (low voltage).

Parts List

Plan of attack

Below there is a schematic diagram for one gate of the completed circuit, but don't look at it yet. The following description of modular construction and testing applies to any circuit so that you don't waste a lot of time trying to debug a complete circuit without knowing which, if any, parts of the circuit are correct.

Output module

For debugging purposes, it's easiest to make sure your outputs work first. If you don't know your outputs are working, you have no way of knowing whether the rest of your circuit is working or not.

  1. On one end of the breadboard, wire up one of the LEDs with its resistor.
  2. Test to see that the LED lights up when the other end of the resistor attached to the LED is connected to Vcc (i.e. power). If the LED is very dim, try using a lower resistor; down to 100 Ω or so should be fine.
  3. Once you have one LED working, wire up the other LED with its resistor and test it.
    This is the output module.
Input module

Once you have the output working, you can use it to test the inputs.

  1. On the other end of the breadboard, connect the DIP switch and the resistor array.
    Make sure you get the common pin of the resistor array at the correct end.
  2. Now connect one of the inputs directly to one of the outputs you wired previously. If it works, the switching the DIP switch should turn the LED on and off.
  3. Repeat this to test each input.
    This is the input module.
Logic module

Since you have now verified that the inputs and outputs work, you should be able to connect them to the gates to see if the gates work.

  1. Put the chip in the middle of the breadboard.
    This is the logic module.
    (Usually the logic module will be more than one chip, in which case using separate breadboards for each module is a good habit to get into.)
  2. Hook up the two inputs and the output of one gate on the chip. If everything has been wired correctly everything should work.

    When you have one gate working, demonstrate it to the lab demonstrator.

  3. Once you have one gate working, wire up the inputs and outputs to one other gate and verify the operation of each of the gates.

Schematic diagram

Here's the schematic for the completed circuit for one gate. The lines with arrows represent the DIP switches. (When the switch is closed, the input will be HIGH. When the switch is open, the input will be LOW. This is called active high configuration.)

circuitry for 7400 
test

 

Demonstrate your results to the lab demonstrator.

Resources

To view pdf documents, you can download Adobe Acrobat Reader .
get Acrobat Reader
If you need to update a browser, you might try Firefox which is Get Firefox!
Since this page uses cascading style sheets for its layout, it will look best with a browser which supports the specifications as fully as possible.

If you are looking for an office package, with a word processor, spreadsheet, etc., you might try LibreOffice which is Get LibreOffice!

Go to the main page for the Department of Physics and Computer Science.

Valid XHTML 1.1

Valid CSS!

WCAG 2.0
(Level AA)

Wilfrid Laurier University