Lab 9 Encoders and Decoders
Lab 9 Encoders and Decoders
Lab 9 Encoders and Decoders
Lab No. 9
2. Basic Information
Encoding Circuit (Encoder)
An encoder is a combinational logic circuit that has a limited number of output lines, i.e. “n” and
many more input lines (up to a maximum of 2n input lines). Depending upon which of the input
lines are activated, the output lines assume a specific state. Since the fewer lines at the output are
used to describe the state of inputs, this process is called encoding and the circuit, which
performs this operation, is called an Encoder. Fig 2.1 shows a circuit for a 4-to-3 lines (i.e. 4-
inputs and 3-outputs) encoder. The four bits D0, D1, D2 and D3 are applied at the inputs and x,
y, and v are the resultant outputs. The function of the circuit is very clearly defined by the input
output relationship shown in Table 2.1.
Fig 2.1
The circuit shown above is just to elaborate the basic theme of encoding, i.e. any combination of
the outputs, no matter how strange or odd, can be assigned to represent any particular input line.
However, usually the encoders are designed such that their outputs are either in plain binary or
BCD formats; although sometimes other output codes are also used, e.g. Grey code.
Inputs Outputs
D0 D1 D2 D3 X Y V
0 0 0 0 0 0 0
1 0 0 0 0 0 1
X 1 0 0 0 1 1
X X 1 0 1 0 1
X X X 1 1 1 1
Table 2.1
A decoder is a combinational circuit that performs the reverse operation of that of an Encoder. In
other words, the decoder takes the binary information from its “n” input lines and depending
upon its inputs activates one of the many output lines (there can be a maximum of 2n unique
output lines for an “n” bit decoder). Fig 2.2 shows the logic diagram of a 2-to-4 lines decoder.
The functionality of this circuit is defined by the truth table shown in Table 2.2.
Fig 2.2
Note that A and B are the two input lines whose combination dictates which of the four outputs
are going to be activated, whereas E is the enable input of the chip, i.e. unless we enable this
chip (by applying a LOW at this E input), the outputs would not change even if we change the
inputs A and B. For such a case we say that the enable input E is active LOW. Also note that any
output becomes LOW when activated, while all non-activated outputs remain HIGH – i.e. the
outputs in this circuit are also active LOW.
Inputs Outputs
E A B D0 D1 D2 D3
1 X X 1 1 1 1
0 0 0 0 1 1 1
0 0 1 1 0 1 1
0 1 0 1 1 0 1
0 1 1 1 1 1 0
Table 2.2
a) Logic Trainer
b) Multimeter
c) Logic ICs:
74LS139 (Dual 2-to-4 Decoder)
74LS148 (8-to-3 Priority Encoder
d) Connecting wires
Procedure
1. Connect the logic Trainer to 220V AC power supply.
2. Install the IC 74LS139 (Dual 2-line-to-4 Decoder) on the trainer’s breadboard.
3. Connect the +VCC (pin # 16) and Ground (pin # 8) pins of the IC to +5V and Ground
supply of the trainer board.
4. Wire the circuit according to the schematic given in Fig 3.3. It should be kept in mind
that 74LS139 has Active HIGH inputs and Active LOW outputs.
5. Use the trainer’s LEDs to display the decoded outputs.
6. Indicate the status of each output LED in Table 3.1 for the input combinations shown in
the table.
7. Now install the IC chip 74LS148 (8-to-3 Priority Encoder) on the trainer’s breadboard.
8. Connect the +VCC (pin # 16) and Ground (pin # 8) pins of the IC to +5V and Ground
supply of the trainer board.
9. Wire the circuit. It should be kept in mind that 74LS148 has both inputs and outputs
Active LOW.
10. Use the trainer’s LEDs to display each encoded output for the set of inputs provided in
Table 3.2. Record the status of output LEDs in that table.
Experimental Results
5. Questions
1- Redraw Table 3.1 assuming that the inputs are also Active LOW for 74LS139.
2- Draw the circuit diagram to show how can we use 74LS139 (Dual 2-to-4 line decoder)
to construct a 3-to-8 line decoder
Understanding(8)
Total: /20