Transcript Document
Lab 7 : Decoders/Encoders :
Slide #2
“1 of 10” Decoder.
Slide #3
“1 of 8” Decoder.
Slide #4
“1 of 10” Encoder
Slide #5
“1 of 10” Encoder Connected to a SPST Keypad.
Slide #6
Control Signal Generator
Lab 7 : 1 of 10 Decoder with Active Low Outputs:
A 1 of 10 decoder receives BCD data at its inputs (A3, A2, A1, A0) and activates one
output (O0, … , O9). The active output is the one which corresponds to the input
number. For example, If you input the number 3 it activates O3.
The BCD data is applied to inputs A3, A2, A1, A0. One output is asserted for each BCD code.
“O0 = 0” when the BCD code for 0 is applied at the inputs. All other decoder outputs are not
asserted (logic 1). Remember the outputs are active low.
“O1 = 0” when the BCD code for 1 is applied at the inputs.
“O2 = 0” when the BCD code for 2 is applied at the inputs.
Here are the remaining responses for BCD code for 3 … to … 9.
Four bit numbers larger than 9 do not assert any output. They are not valid BCD numbers.
The decoder response can be shown in a table.
1010
1011
BCD
1100
BCD
0
1
A0
1
0
A1
1101
1
0
A2
1110
0
1
A3
“9”
“0”
“1”
“2”
“3”
“4”
“5”
“6”
“7”
“8”
#
1111
O0
O1
O2
O3
O4
O5
O6
O7
O8
O9
1 of 10 Decoder
Slide #2
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
ONE!
A3 A2 A1 A0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
1
0
1
0
0
0
1
0
1
0
1
1
0
0
1
1
1
1
0
0
0
1
0
0
1
O0 O1 O2 O3 O4 O5 O6
0 1
1 1
1 1 1
1 0
1 1
1 1 1
1 1
0 1
1 1 1
1 1
1 0
1 1 1
1 1
1 1
0 1 1
1 1
1 1
1 0 1
1 1
1 1
1 1 0
1 1
1 1
1 1 1
1 1
1 1
1 1 1
1 1
1 1
1 1 1
O7
1
1
1
1
1
1
1
0
1
1
O8
1
1
1
1
1
1
1
1
0
1
O9
1
1
1
1
1
1
1
1
1
0
Lab 7 : 1 of 8 Decoder :
The 1 of 8 decoder receives 3 bit data at its inputs (A2, A1, A0) and activates one
output (O0, … , O7). It is similar in operation to the 1 of 10 decoder. What makes it
different is that it has “ENABLE” inputs (E1, E2, E3).
The ENABLE inputs will be described later. For now they will be asserted and overlooked.
“O0 = 0” when the 3 bit code for 0 is applied at the inputs. All other decoder outputs are not
asserted (logic 1). Remember the outputs are active low.
“O1 = 0” when the 3 bit code for 1 is applied at the inputs.
Here are the remaining responses for 3 bit code for 2 … to … 7.
The decoder response can be shown in a table.
The ENABLE inputs provide a means to enable the decoder to decode 3 bit numbers or else disable
the decoder from decoding. All 3 inputs must be asserted (E1=E2=0 and E3=1) in order for the
decoder to decode the 3 bit number applied to the inputs.
If any of the 3 enables is not asserted then all outputs =1 regardless of the 3 bit number applied to
the inputs.
3 Bit
0
1
A0
0
1
A1
“0”
“1”
“2”
“3”
“4”
“5”
“6”
“7”
0
1
A2
5V
Slide #3
E1
E2
E3
O0
O1
O2
O3
O4
O5
O6
O7
1 of 8 Decoder
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1
0
A2 A1 A0 O0 O1 O2 O3 O4 O5 O6
0
0
0
0 1
1 1
1 1 1
0
0
1
1 0
1 1
1 1 1
0
1
0
1 1
0 1
1 1 1
0
1
1
1 1
1 0
1 1 1
1
0
0
1 1
1 1
0 1 1
1
0
1
1 1
1 1
1 0 1
1
1
0
1 1
1 1
1 1 0
1
1
1
1 1
1 1
1 1 1
X X X
1 1 1 1 1 1 1
O7
1
1
1
1
1
1
1
0
1
IF E1 =1 or E2=1 or E3=0
X = Don’t care … immaterial … 1 or 0!
IF
E1 =0
&
E2=0
&
E3=1
Lab 7 : 1 of 10 Encoder :
The 1 of 10 priority encoder will generate a BCD data code at its outputs (O3, O2, O1,
O0) when an input is asserted. The BCD data generated at the output corresponds to the
input number which is activated. It is a reverse decoder.
The encoder will generate a BCD 1 when input A1 asserted.
The encoder will generate a BCD 2 when input A2 asserted.
Here are the remaining responses for when inputs A3 … to … A9 are asserted.
There is no A0 input. The encoder generates the BCD code for 0 when no inputs are activated.
This encoder is called a priority encoder. A9 has the highest priority and A1 the lowest. All this
means is that the encoder will generate the code for the highest priority input if 2 (or more) inputs
are asserted at same time.
The encoder response can be shown in a table.
A1
1
X
X
X
X
X
X
X
X
0
A2 A3 A4
1
1 1
X
X X
X
X X
X
X X
X
X X
X
X X
X
X 0
X
0 1
0
1 1
1
1 1
Slide #4
A5
1
X
X
X
X
0
1
1
1
1
A6
1
X
X
X
0
1
1
1
1
1
A7
1
X
X
0
1
1
1
1
1
1
A8
1
X
0
1
1
1
1
1
1
1
BCD Data
O3
O2
O1 O0
A9
1
0
0
0
0 BCD
Activate
A1 0
0
1
0
0
1
BCD
Activate
A2 9
1
1
0 Activate
0
0
BCD
Activate A3
A3 8
1
0
1
1
1
BCD
Activate
Do not A4 7
1
0
1
1
0 BCD
AND
Activate
A5 6
activate
1
0
1
0
1
BCD
Activate
A6 5
any input!
1
0
1 Activate
0
0
BCD
A7
Activate
A7 4
1
0
0
1
1
BCD
Activate
A8 3
1
0
0
1
0
BCD
Activate
A9 2
1
0
0
0
1 BCD
1
X = Don’t care … immaterial … 1 or 0!
0
1
0
1
1
0
0
1
0
1
0
1
1
0
0
1
0
1
A1
A2
A3
A4
A5
A6
A7
A8
A9
O0
O1
O2
O3
1 of 10 Encoder
1
0
0
1
0
1
1
0
The code for BCD 7 is
BCD 0
1
2
4
3
5
6
7
8
9
generated
because A7 has
a higher priority than A3.
Lab 7 : SPST Keypad System :
The 1 of 10 priority encoder is typically used to generate BCD data from an SPST
keypad (single pole single throw). The system generates the BCD code for the key that
is pressed.
The SPST keypad consist of 10 switches mounted in a plastic panel. The schematic symbol is circled.
Let’s see how the system works if someone holds down button 3.
S3 closes and grounds A3.
A1, A2, A4, … , A9 stay at logic 1 because of the pull-up resistors.
The encoder outputs the data code for 3.
S0
5V
1
2
3
4
5
6
7
8
9
0
Slide #5
S1
1
S2
A1
1
S3
A2
0
S4
A3
1
S5
A4
1
S6
A5
1
S7
A6
1
S8
A7
1
S9
A8
1
A9
O0
1
O1
1
O2
0
O3
0
1 of 10
Encoder
3
Lab 7 : Control Signal Generator :
A counter and a 1 of 4 decoder with active low outputs are combined to create a system
that can generate a control waveforms.
The analysis begins by drawing the waveforms for the Mod 8 counter. Q0, Q1, Q2
To draw the control waveform it is easy if you remember that the 2 bit data in must be 2 and the
Enable must be asserted (active high). Thus output O2 = 0 when A1=1, A0=0 and Enable=1.
Draw the control waveform. It is 0 during this time interval only.
The control waveform is 1 for all other time intervals.
CLK
Test yourself:
Q0
En.
Try to figure
out when the
Q1
A0
Control
Waveform
Q2
A1
would be low if
O1 were used
in place of O2. Control Wave
Proceed after
you have made
your decision.
Slide #6
O1=0 when
>Clk
Q0
Q1
O1
Q2
Mod 8 Counter
1
0
1
Enable
A0
A1
O0
O1
O2
O3
1 of 4 Decoder
En=1, A0=1, A1=0
0 Control
Waveform