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


PC/CP120 Digital Electronics Lab

Encoder Lab

Objective:

Background:

In this lab you will wire a keypad with a priority encoder.


7-segment display

Encoder Chip

We will use the 74147 IC as the encoder in our circuit. This encoder is called a 0-line-to-4-line priority encoder by the manufacturer. The 74147 takes the selected input and outputs the corresponding 4-bit binary number. See the datasheet for more information.

http://rabbit.eng.miami.edu/info/datasheets/
74147 decimal encoder
74147 function table 74147 schematic diagram
"No connection" pins

Occasionally a chip will have one or more pins marked NC for "no connection. These pins should be left unconnected.

Hexadecimal Keypad

A keypad provides an easy input device to a digital circuit. It consists of several switches, one under each key, which have one of their two poles in common.
The pins for the keypad aren't connected in numerical order. You can see which pin goes with which key by looking at the bottom of the keypad. (If you look for the pin with no visible connection to a key, you can find the common pin.)

keypad top and bottom view

Because the side-by-side image is reversed left-to-right when it's upside down, it may be easier to figure out in the following diagram:

keypad alternate top and bottom view

Here's how the pin connections go, looking from the top:

keypad pin map

The common pin has the circle drawn on it.
(Note that A and E don't follow the normal pattern.)

Active high inputs

To use a key to send a HIGH (1) signal, one must connect the common pin to 5 volt supply and put a resistor to ground from each of the other pins, as with the DIP switch package. Using 16 individual resistors to do this it would be rather tedious, so we will once again use the resistor arrays. The particular resistor array which we will use has several resistors in it which all have one end in common.
Since the common pin for the keypad is sort of in the middle, note that the resistor array on the left has to have its common pin on the left, while the resistor array on the right has to have its common pin on the right.

keypad for active high output

Active low inputs

In some cases, such as in this lab, you will be using the keypad for input to devices which use active low inputs. This means that you will want a key pressed to give a low output on the corresponding line. To do this, simply switch the common connections of the keypad and resistor array mentioned above. This means you will connect the common pin of the keypad to ground and the resistor array to Vcc (+5V).



keypad for active low output

The actual resistor value isn't critical; anything between about 100 Ω and 1 k Ω should work. If the resistors get too large, then the circuit will stop working; if the resistors get too small, there will be excessive current drawn from the circuit. Ideally you want to choose a large value that works consistently.

Task:

Parts list

Wiring an Encoder with I/O

  1. Look at the truth table for the 74147. Are its inputs active HIGH or active LOW?. You have to figure this out in order to figure out which way to wire up the keypad.
  2. Identify the appropriate picture showing how to wire the keypad and resistor arrays given what you determined about active high or active low inputs.
  3. Wire the decimal to binary encoder.
    Using what you know about modular design, in what order can you wire the different portions of the circuit to make it easy to debug? Hint: You haven't used the keypad before, so that is the most unfamiliar.
  4. Use the keypad as your input and the debugger board (in display mode) to display your output.
    Be sure to daisy-chain the breadboard and the debugger board, rather than using several clip leads or having clip leads holding more than one wire.

Question: If the encoder is "decimal", it should encode zero to nine. Why is there no input for zero? Think about this so you can explain the answer when you demonstrate your circuit.

Demonstrate the circuit to the lab demonstrator before you leave.

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