lab09 - Brookdale Community College

advertisement
ELEC 241
Experiment 9
Encoders And Decoders
OBJECTIVE
Data communications between digital systems or computers are usually transmitted in some form of
code. A circuit that will convert a digital input into some form of binary code is called an Encoder. A
digital circuit that converts a binary code into a recognizable number or character is called a Decoder.
In this experiment, the student will design, build, and test a variety of encoders and decoders.
EQUIPMENT AND PARTS REQUIRED
1
Protoboard
AR 74LSxx IC’s
INTRODUCTION
A digital code is a binary representation of some data. The basic decoder is a combinational logic
circuit that will supply a logic 1 output only when the proper code is present on the inputs. For all other
inputs it will supply a logic 0. In some IC's, the decoder will provide logic 0 only when the proper data
is present on the input and a logic 1 for any other combination of inputs. Most decoders are MSI
combinational logic circuit that performs the opposite function of the decoder. The encoder will take an
active input and output a binary code to represent which input is active. It is possible that more than
one input may be active at a time. In order to eliminate the possibility of invalid outputs, most encoders
are High Priority Encoders. The high priority encoder will output the code for the highest level input
that is active.
C
INPUT
B
A
O7
O6
O5
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
OUTPUT
O4
O3
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
O2
O1
O0
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
FIGURE 1
For example, the BCD code 0101 may be used to represent the decimal number 5. For the same
decimal number 5, we would have the binary representation of 0011 0101 in ASCII or 1111 0101 in
EBCDIC. ASCII and EBCDIC are binary codes but unlike HEX and BCD, they are not weighted codes
and may not be used for performing mathematical or logical computations. We made use of a decoder
in lab 1 when the 74LS47 was used to convert the BCD numbers 0 through 9 to the binary information
necessary to drive the seven segment display.
To design a decoder, first make a truth table of all possible inputs and output combinations. The
number of outputs of the decoder will be 2n where n is the number of inputs. A decoder with three
inputs will have eight outputs and is called and Octal Decoder. The truth table for an 74LS138 octal
decoder with active low (logic 0) outputs may be seen in Figure 1.
Page 1
ELEC 241
Experiment 9
Encoders And Decoders
For Figure 1, bit C is the MSB. There are 8 possible combination of inputs in binary from 000 to 111
and there are 8 different outputs. The number of the outputs is from O0 to O7 and to find the decimal
number of the active output, convert the binary input to decimal.
The basic active
low input decoder
is a nothing more
than a three input
NAND gate. To
make an octal
decoder, a
minimum of eight
3input NAND
gates and three
inverters would be
required. Figure 2
shows logic
diagram for a
1of8 decoder.
FIGURE 2
0
1
1
1
1
1
1
1
1
1
O8
O7
O6
O5
O4
O3
O2
O1
D
C
B
A
Decimal
Value
X
0
1
1
1
1
1
1
1
1
X
X
0
1
1
1
1
1
1
1
X
X
X
0
1
1
1
1
1
1
X
X
X
X
0
1
1
1
1
1
X
X
X
X
X
0
1
1
1
1
X
X
X
X
X
X
0
1
1
1
X
X
X
X
X
X
X
0
1
1
X
X
X
X
X
X
X
X
0
1
0
0
1
1
1
1
1
1
1
1
1
1
0
0
0
0
1
1
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
9
8
7
6
5
4
3
2
1
0
FIGURE 3
Page 2
ELEC 241
Experiment 9
Encoders And Decoders
The 74LS147 is a high priority encoder that accepts data on any of eight active low inputs and provides
a binary representation on three active low outputs. Since it is a high priority, it will indicate the
highest level input that is active. The truth table for the 74LS147 may be found in Figure 3. An X on
the input means that we Don't Care about the logic level of that input. Figure 4 contains the logic
diagram for the 74LS147.
FIGURE 4
PROCEDURE
1. Design an octal decoder that provides a 0 output for the proper binary pattern using 74LS10's and
74LS04's. It is not necessary to provide enable input(s). Draw the logic diagram and make a data
table of the results. Enter the design into Capture and run the simulation. For the digital clocks,
set OFFTIME and ONTIME to 1u for A, 2u for B, and 4u for C inputs. For all clocks,
STARTVAL is 1 and OPPVAL is 0. Compare the Probe output to the predicted output.
2. Repeat step 1 in the lab using the 74xx138 octal decoder. Compare the observed output to the
simulated output.
3. Construct a truth table for all possible inputs for the 74LS147 decimal to BCD encoder. Apply an
active input one at a time and list the outputs in the table. Apply two or more active inputs
simultaneously and note the output.
4. Design and test a decoder to provide an active low output when the last four digits of your
student ID number is applied to the inputs.
QUESTIONS
1.
What is the output of the 74LS147 high priority encoder when more than one input active?
2.
Design a circuit that based on the 74LS154 4lineto16line decoder that will provide an
active high when the binary input is greater than 12 and a logic 0 when the binary input is 12 or
less.
3.
Design a 5line-to-32-line binary decoder using two 74LS154's and a 74LS00.
Page 3
ELEC 241
4.
Experiment 9
Encoders And Decoders
Design a 16lineto4line priority encoder with active low outputs using two 74LS148's and
two 74LS02's.
Page 4
Download