0% found this document useful (0 votes)
354 views

Lab 08

- The document describes an electronics lab experiment involving comparators, decoders, encoders, multiplexers, and demultiplexers. - Students will use 7485 comparators and 74138 decoders to compare and decode binary input values and observe the outputs on LEDs. - The lab also introduces Quartus II's Library of Parameterized Modules (LPM) which allows customizing components like adders and decoders instead of using pre-defined ICs. Students will use the LPM to design an 8-bit adder with carry inputs and outputs.

Uploaded by

salloum18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
354 views

Lab 08

- The document describes an electronics lab experiment involving comparators, decoders, encoders, multiplexers, and demultiplexers. - Students will use 7485 comparators and 74138 decoders to compare and decode binary input values and observe the outputs on LEDs. - The lab also introduces Quartus II's Library of Parameterized Modules (LPM) which allows customizing components like adders and decoders instead of using pre-defined ICs. Students will use the LPM to design an 8-bit adder with carry inputs and outputs.

Uploaded by

salloum18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

EET 1131 Lab #8 - Page 1 Revised 3/10/2014

Name________________________________
EET 1131 Lab #8
Comparators, Decoders, Encoders, MUXes, DEMUXes

Equipment and Components
ETS-7000 Digital-Analog Training System
Integrated Circuits: 7485, 74138, 74148
Quartus II software and Altera DE2-115 board
Multisim simulation software

Unused Pins
In the circuits that we build today and throughout the rest of this course, you will sometimes have unused
input pins or unused output pins on a digital chip.
For proper operation, an unused input pin should be tied to its inactive level. Tie the pin low
if it is active-high. Tie the pin high if it is active-low.
But an unused output pin should be left floating, and should never be tied high or lowtying
output pins high or low can burn out the chip.

Part 1. Comparators

1. Shown below are the 7485 magnitude comparators pin diagram and logic symbol.

7485 pin diagram 7485 logic symbol


2. Use the 7485s logic symbol to answer the following questions:

How many input pins does a 7485 have? _______________

How many output pins does a 7485 have? _______________

3. Wire a 7485 chip on the breadboard. Make the following connections:
Tie A<Bin LOW.
Tie A=Bin HIGH.
Tie A>Bin LOW.

EET 1131 Lab #8 - Page 2 Revised 3/10/2014
Connect the chips A inputs to the trainers data switches SW7 through SW4, with SW7 as
the most significant bit (MSB) and SW4 the least significant bit (LSB).
Connect the chips B inputs to the trainers data switches SW3 through SW0, with SW3 as
the MSB and SW0 the LSB.
Connect A<Bout to LED 2.
Connect A=Bout to LED 1.
Connect A>Bout to LED 0.

4. Test the following combinations. Fill in the tables Output columns, and verify that the chip is
producing the correct results.

Inputs Outputs
A4 A3 A2 A1 B4 B3 B2 B1 A<B A=B A>B
0 0 0 0 0 0 0 0
0 1 0 1 1 0 0 0
0 1 1 0 0 1 1 0
1 0 0 1 0 1 1 1
0 1 1 1 1 0 1 0
0 0 0 1 0 0 0 1
0 0 1 0 0 0 1 0
1 1 1 0 0 0 1 0

5. Now use the chip to compare the following pairs of decimal numbers. Fill in all input and output
columns in the table:
A = 2, B = 6
A = 5, B = 1
A = 8, B = 11
A = 12, B = 12

Inputs Outputs
A4 A3 A2 A1 B4 B3 B2 B1 A<B A=B A>B





6. When youre finished, ask me to check your work.

Circuit works? ________ DIP inserted correctly? ________ Using power bus? ________
Wire colors? ___________ Wire lengths? ___________ Wire ends trimmed? ___________
DIP accessible? ___________


EET 1131 Lab #8 - Page 3 Revised 3/10/2014
Part 2. Decoders
1. The glossary on pages 369-370 of your textbook defines the word decoder. Copy this definition
below and make sure you understand what it means.

A decoder is




74138 Decoder
2. Using http://www.ti.com or a copy of the TTL Data Book, find the datasheet for the 74138 (or
74LS138).
3. Using a straight edge, copy the 74138s pin diagram and logic symbol in the space below. Be
sure to include each pins name and number. Also be sure to include any markings that
indicate active-low inputs or outputs.

74138 pin diagram 74138 logic symbol

















4. Use the logic symbol to answer these questions:

How many input pins does a 74138 have? _______________

Which one of the following statements is true?
___ All of the 74138s inputs are active-high.
___ All of the 74138s inputs are active-low.
___ Some of the 74138s inputs are active-high, and some are active-low.

How many output pins does a 74138 have? _______________

Which one of the following statements is true?
___ All of the 74138s outputs are active-high.
___ All of the 74138s outputs are active-low.
___ Some of the 74138s outputs are active-high, and some are active-low.

EET 1131 Lab #8 - Page 4 Revised 3/10/2014
Wire a 74138 chip on the breadboard, connecting data switches 7, 6, and 5 to the chips C, B, and
A input pins (in that order).

Also, connect an LED to each of the output pins. Be sure to match the numbers of the LEDs and
the output pins. In other words, connect output Y0 to LED 0, and connect output Y1 to LED 1,
and so on.

To enable the chip, connect its active-high enable input to +5 V, and connect its active-low
enable inputs to ground.

Use the data switches and LEDs to fill in the following function table. Write 0 for LOW and 1
for HIGH. Ive completed part of the table for you.

Inputs Outputs
C B A Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
0 0 0 1 1 1 1 1 1 1 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

5. When youre finished, ask me to check your circuit.

Table correct? ________ DIP inserted correctly? ________ Using power bus? ________
Wire colors? ___________ Wire lengths? ___________ Wire ends trimmed? ___________
DIP accessible? ___________

6. Next, to investigate the operation of the chips enable inputs, connect its G1 pin to ground instead
of +5 V. Use the data switches and LEDs to examine the outputs for different combinations of
inputs A, B, and C. What do you find?






7. Now connect the G1 pin back to +5 V, and make sure that the chip works as it did before. Then
connect the G2A pin to +5 V. Use the data switches and LEDs to examine the outputs for
different combinations of inputs A, B, and C. What do you find?





EET 1131 Lab #8 - Page 5 Revised 3/10/2014
Part 3. Quartus IIs Library of Parameterized Modules (LPM)
As youve learned, there are two general ways to enter a design in Quartus II:
By drawing a block diagram (or schematic diagram), which is saved in a .bdf file.
By typing VHDL code, which is saved in a .vhd file.

Also, when using the block diagram/schematic method, you have a couple of choices:
You can place and connect individual gates, which have names like NOT and AND2:



You can place and connect simulated versions of 74XX chips, such as a 7483 adder or a
74138 decoder. Quartus II calls these objects macro-functions. They have names like
7483 and 74138:

Next youll learn about a third kind of object you can place on a block diagram: adders, decoders,
and other components that are customized to have exactly the features you want, even if theres
no 74XX chip with these features. These customizable components are stored in a collection that
Quartus II calls the Library of Parameterized Modules, and most of them have names beginning
with lpm, such as lpm_add_sub or lpm_decode.

Heres why the LPM is valuable to Quartus II users. Suppose youre building a circuit that needs
a 3-line-to-8-line decoder with active-high inputs, active-high outputs, and two active-high enable
inputs. Theres no 74XX chip that matches this description. So you could either build your own
decoder out of individual logic gates, or start with a 74138 and then surround it with a bunch of
gates to make it behave the way you want. Either way, thats a lot of work. But by using Quartus
IIs lpm_decode, you can custom-design your own decoder to have the features you want.

(The following steps are a modified version of Example 728 on page 299 of the textbook.)

1. Use Quartus IIs New Project Wizard to create a new project called lab8_lpm_add_sub.
Remember to use this same name for your projects working directory, and be sure to
create this working directory on your flash drive, not on the computers hard drive.

2. Create a new block diagram/schematic file, and save it as lab8_lpm_add_sub.bdf.

3. Right-click in the blank workspace and select Insert > Symbol. For the name, type
lpm_add_sub. This will bring up the symbol for an LPM_ADD_SUB component.
Make sure that Launch MegaWizard Plug-In is checked, and press the OK button.

4. The MegaWizard Plug-In Manager will open, and from its title bar you can see that its
starting you on page 2c of the Wizard. Select the VHDL radio button, and make sure

EET 1131 Lab #8 - Page 6 Revised 3/10/2014
that the output file name listed below is located inside your project directory. Then click
Next.

5. On page 3 of the Wizard, well use the default settings (Match project/default is
checked, data-bus width is 8 bits, and Addition only). Click Next.

6. On page 4 of the Wizard, well use the default settings (No, both values vary and
Unsigned). Click Next.

7. On page 5 of the Wizard, select Create a carry input and Create a carry output. Then
click Next.

8. On page 6, well use the default setting (No pipelining). Click Next.

9. Page 7 displays the simulation libraries that will be used. Click Next.

10. Page 8 displays the output files that will be created. Click Finish.

11. Place your custom-designed adder on the workspace.

12. Place three inputs and two outputs. Connect them to your adder and give them the names
shown in the picture below: cin, a[7..0], b[7..0], result[7..0], and cout.


13. Notice two features of this diagram that you havent seen before. First, some of the
wires are thicker than normal. Second, some of the names end in [7..0]. Both of these
features indicate that the wires in question are busses, which carry many bits at a time
instead of a single bit. All three of our busses in this design are 8-bit busses. Thats why
the names show a range of numbers from 7 (most-significant bit) to 0 (least-significant).

14. Right-click on one of your thick purple wires, and notice that Bus Line is selected. On
the other hand, right-click on one of your thin purple wires, and notice that Node Line is
selected. A node line carries a single bit, while a bus line carries many bits.

15. The inputs and outputs in this design serve the following functions:
a[7..0]: the first 8-bit number that were adding.
b[7..0]: the second 8-bit number that were adding.
cin: the carry-in bit.
result[7..0]: the result of our addition.
cout: the carry-out bit.

16. Save your bdf file and compile your design. You should get no errors.


EET 1131 Lab #8 - Page 7 Revised 3/10/2014
17. Create a new vector waveform file, and save it as lab8_lpm_add_sub.vwf.

18. Using Edit > Set End Time, set your end time to 12 s.

19. Using Edit > Grid Size, set your grid size to 1 s.

20. Double-click in the Name column of your waveform file and add the name of each of
your inputs and outputs. You dont need to include the bit numbers as part of the names.
For example, you can just type a instead of a[7..0].

21. Now we want to set up the input waveforms to test the adder by giving it various
combinations of numbers. After you complete the next few steps, your vector
waveform file will look like this:



22. In this picture, the values of a and b are shown as hex numbers. For example, in the first
column Ive set a to hexadecimal 02 (which is 0000 0010 in binary), and Ive set b to hex
07 (which is 0000 0111 in binary). How do I know that these are hexadecimal numbers?
Because of the H in the column right after the names. You have your choice of
displaying values in hex, or in binary, or in some other form. In your own waveform file,
youll probably see Bs instead of Hs, which means that your values are displayed in
binary. To change this, right-click a name (such as a) and select Properties.

23. The dialog box shown below will open. In the Radix drop-down box, select
Hexadecimal instead of Binary, and then click OK.


24. Next, how do you set the waveforms to specific values, as Ive done in the picture above?
For example, how did I make cin go high from 3 s to 5 s? Heres how. In your own

EET 1131 Lab #8 - Page 8 Revised 3/10/2014
waveform file you should have a constant LOW for cin. Use your mouse to select the
portion of cins waveform from 3 s to 5 s. Then do one of the following:
o Select Edit > Value > Arbitrary Value in the menus.
o Or press the toolbar button that looks like this: .
o Or press Ctrl+Alt+B on the keyboard.

25. The dialog box shown below will open. Change the Numeric or named value to 1.
Then click OK, and you should see that cin is now HIGH from 3 s to 5 s.


26. In the same way, set the values of all of your inputs so that your vector waveform file
looks like the picture on the previous page.

27. Save your vector waveform file and simulate your design. Your simulation results should
look like this:



28. When youre satisfied that your results match mine, and you understand why these results
are correct, call me over to check your work.
_______________



EET 1131 Lab #8 - Page 9 Revised 3/10/2014
Part 4. Encoders
1. The glossary on pages 369-370 of your textbook defines the word encoder. Copy this
definition below and make sure you understand what it means.

An encoder is




74148 Priority Encoder
2. Using www.ti.com or the TTL Data Book, find the datasheet for the 74148.
3. Using a straight edge, copy the 74148s pin diagram in the space below. Include each pins
name and number. Ive also given you the logic symbol from Multisim. Write pin numbers
on the logic symbol. (The pin names on the logic symbol are slightly different from the
names on your pin diagram, but you should be able to match them up.)

74148 pin diagram 74148 logic symbol


4. On a pin diagram like this one, its important not to confuse a pins name with its number.
For example, notice that pin number 1 is named 4.

On this chip, what is the name of pin number 3? ________

On this chip, what is the number of the pin whose name is 3? ________

5. Use the logic symbol to answer these questions:

How many input pins does a 74148 have? _______________

Which one of the following statements is true?
___ All of the 74148s inputs are active-high.
___ All of the 74148s inputs are active-low.
___ Some of the 74148s inputs are active-high, and some are active-low.

How many output pins does a 74148 have? _______________

Which one of the following statements is true?
___ All of the 74148s outputs are active-high.
___ All of the 74148s outputs are active-low.
___ Some of the 74148s outputs are active-high, and some are active-low.

EET 1131 Lab #8 - Page 10 Revised 3/10/2014

6. Wire a 74148 chip on the breadboard, connecting data switches to the chips input pins. Be
sure to match the numbers of the switches and the input pins. In other words, connect input
pin D0 to switch SW0, and connect input pin D1 to switch SW1, and so on.

Enable the chip by connecting its enable input either to +5 V or to ground, depending
on whether the enable input is active-high or active-low.

Using three LEDs to test the output levels, fill in the following function table for the input
combinations Ive listed below. Notice that in each of the tables rows, one switch is set
LOW and all of the others are set HIGH.

Inputs Outputs
D7 D6 D5 D4 D3 D2 D1 D0 A2 A1 A0
1 1 1 1 1 1 1 0
1 1 1 1 1 1 0 1
1 1 1 1 1 0 1 1
1 1 1 1 0 1 1 1
1 1 1 0 1 1 1 1
1 1 0 1 1 1 1 1
1 0 1 1 1 1 1 1
0 1 1 1 1 1 1 1

7. When youre finished, ask me to check your circuit.

Table correct? ________ DIP inserted correctly? ________ Using power bus? ________

Wire colors? ___________ Wire lengths? ___________ Wire ends trimmed? ___________

DIP accessible? ___________

EET 1131 Lab #8 - Page 11 Revised 3/10/2014
8. Based on the data in your table, briefly describe how the 74148 operates. In your description,
include some discussion of the chips active levels (active-low or active-high).












9. Now lets look at a few other input combinations that involve setting more than one switch
LOW at the same time. Try the settings in the table below, and record the output levels.

Inputs Outputs
D7 D6 D5 D4 D3 D2 D1 D0 A2 A1 A0
0 1 0 1 1 0 1 1
1 1 0 1 1 0 1 1
1 1 1 1 0 0 0 1
0 0 0 0 0 0 0 0

10. Based on the data in this table, what additional information can you give about the 74148 that
you couldnt tell from the earlier table? Your answer should include discussion of the term
priority encoder. What does that term mean?




EET 1131 Lab #8 - Page 12 Revised 3/10/2014
Part 5. Multiplexers and Demultiplexers
1. The glossary on pages 369-370 of your textbook defines the words multiplexer and
demultiplexer. Copy these definitions below and make sure you understand what they mean.

A multiplexer is




A demultiplexer is





74151 Multiplexer
2. Using http://www.ti.com or a copy of the TTL Data Book, find the datasheet for the 74151.
3. Using a straight edge, copy the 74151s pin diagram and logic symbol in the space below. Be
sure to include each pins name and number. Also be sure to include any markings that indicate
active-low inputs or outputs.

74151 pin diagram 74151 logic symbol

















4. Use the 74151s logic symbol to answer the following questions:

How many input pins does a 74151 have? _______________

Which one of the following statements is true?
___ All of the 74151s inputs are active-high.
___ All of the 74151s inputs are active-low.
___ Some of the 74151s inputs are active-high, and some are active-low.

How many output pins does a 74151 have? _______________


EET 1131 Lab #8 - Page 13 Revised 3/10/2014
Which one of the following statements is true?
___ All of the 74151s outputs are active-high.
___ All of the 74151s outputs are active-low.
___ Some of the 74151s outputs are active-high, and some are active-low.



Mutliplexer/Demultiplexer Circuit
5. Study the schematic diagram on the following page. It shows a circuit containing three ICs:
a 7493 counter (which well study in a few weeks)
a 74151 multiplexer (MUX)
a 74138 demultiplexer (DEMUX)
The circuit also contains:
a square wave generator
seven switches (three to control the MUX, and four to control the DEMUX)
eight LEDs.
Heres how the circuit works:
The square wave generator produces a 12 Hz square wave that drives the counter.
The counter then produces:
o a 6 Hz square wave at its QA output
o a 3 Hz square wave at its QB output
o a 1.5 Hz square wave at its QC output
o a 0.75 Hz square wave at its QD output.
The five square waves of different frequencies become the MUXs data inputs. Switches
SW 1, SW 2, and SW 3 then select one of these five square waves, which is passed
through the MUX to its output pin and sent to the DEMUX.
Switch SW 7 enables or disables the DEMUX.
If the DEMUX is enabled, then Switches SW 4, SW 5, and SW 6 select one of the
DEMUXs outputs, sending the square wave to one of the LEDs.
For example, suppose switches SW 1, SW 2, and SW 3 are all switched OFF. Then the MUX
will select the 12 Hz waveform and send it to the DEMUX. Suppose also that switches SW 4,
SW 5, SW 6, and SW 7 are all switched OFF. Then the DEMUX is enabled and sends the
waveform to LED 0, which will blink at a rate of 12 Hz. The other LEDs will stay lit constantly.

6. To test your understanding of the circuit, fill in the blanks below. Suppose the switches are set
as follows:

SW 1: OFF SW 2: ON SW 3: ON
SW 4: ON SW 5: OFF SW 6: ON SW 7: OFF

Then LED _______ will blink at a rate of _______ Hz.

7. Now suppose you want to make LED 1 flash at a rate of 6 Hz. How should you set the switches?
(For each switch, write ON or OFF)

SW 1: _______ SW 2: _______ SW 3: _______

SW 4: _______ SW 5: _______ SW 6: _______ SW 7: _______


EET 1131 Lab #8 - Page 14 Revised 3/10/2014
8. Build the circuit in Multisim. Multisim does not run at real-time speed, so the LEDs wont
flash at the expected frequencies (12 Hz, 6 Hz, 3 Hz, 1.5 Hz, or 0.75 Hz). But they will flash
faster or slower depending on the settings of switches 1, 2, and 3.

9. Test your Multisim circuit by checking all possible switch combinations. When youre sure that
it works correctly, ask me to check it.
______________

EET 1131 Lab #8 - Page 15 Revised 3/10/2014

EET 1131 Lab #8 - Page 16 Revised 3/10/2014
10. In Quartus II, create a new project named Lab8Circuit1. Create a block diagram/schematic file
that implements the circuit shown above, with the following changes:

a. Replace each of the LEDs shown above with an output pin in Quartus. Name these
output pins LED0, LED1, and so on.

b. Replace each of the switches shown above with an input pin in Quartus (and in Quartus
you wont need the VCCs and grounds that you connected to the switches in Multisim).
Name these input pins SW1, SW2, and so on.

c. Replace the 12 Hz Clock Voltage shown above (and the ground connected to it) with an
input pin and six frequency dividers, wired together as in the project named BlinkingLED
in Lab #4. But for the last frequency divider, instead of using the divide-by-16 output
(named DV 16), use the output that will give you an output frequency close to 12 Hz if
the input pin is connected to a 50 MHz source. Name the input pin Clock.

11. Assign input and output pin numbers so that:
a. the output pins named LED0, LED1, and so on are connected to LEDs on the DE2-115
board.

b. the input pins named SW1, SW2, and so on are connected to switches on the DE2-115
board.

c. the input pin named Clock is connected to the Cyclone chips 50 MHz clock source, as in
your Lab #4 project named BlinkingLED.

12. Compile your design and download it to the Cyclone chip on the DE2-115 board.

13. Test your circuit by checking all possible switch combinations. When youre sure that it works
correctly, ask me to check it.
Circuit works? ________

14. Close your Quartus II project.


Questions
1. On the 74151 chip, why is pin 7 tied to ground?



2. On the 74151 chip, why are pins 12, 13, and 14 tied to ground?



3. On the 74138 chip, why is pin 5 tied to ground?



4. On the 7493 chip, why is pin 10 tied to ground?


EET 1131 Lab #8 - Page 17 Revised 3/10/2014
Part 6. Review Questions
Match each type of chip with its function by filling in each blank with the correct number.

1. Decoder
2. Demultiplexer
3. Encoder
4. Multiplexer
_____ Accepts an active level on one of its inputs
representing a digit and converts it to a coded output.

_____ Allows information from several sources to be
routed onto a single line for transmission over that line
to a common destination.

_____ Detects the presence of a specified combination
of bits on its inputs and indicates the presence of that
combination by a specified output level.

_____ Takes digital information from one line and
distributes it to a given number of output lines.



Match each chip number with its description by filling in each blank with the correct letter.

A. 74150
B. 74138
C. 74LS280
D. 74283
E. 74139
F. 7485
G. 74154
H. 74147
I. 74153
J. 7442
K. 74151
L. 74157
M. 74148

_____ 8-line to 1-line data selector/multiplexer

_____ 4-line to 16-line decoder/demultiplexer

_____ 4-bit magnitude comparator

_____ 16-line to 1-line data selector/multiplexer

_____ 8-line to 3-line priority encoder

_____ Dual 2-line to 4-line decoder/demultiplexer

_____ 9-bit odd/even parity generator/checker

_____ Dual 4-line to 1-line data selector/multiplexer

_____ 4-line BCD to 10-line decimal decoder

_____ 4-bit binary full adder with fast carry

_____ 10-line to 4-line priority encoder

_____ Quad 2-line to 1-line data selector/multiplexer

_____ 3-line to 8-line decoder/demultiplexer

You might also like