ECE 1250 Lab 6 Generate Voltages using a Function Generator and

advertisement
ECE 1250 Lab 6
Generate Voltages using a Function Generator and
Measure Voltages using an Oscilloscope
Building: Digital Circuit
Build an Electronic Candle
Overview: In Lab 6 you will:
• Build an electronic candle which consists of a shift register, XOR gate, and LED
• Measure voltages.
• Use the function generator in your myDAQ as a clock signal
• Observe voltage waveforms on the myDAQ oscilloscope
This lab demonstrates digital logic. In this circuit, a binary 1 is represented by +5 V, and
a binary 0 is represented by 0 V. (Note that you must use the Digital power supply of
+5 V and DGnd found at the end of the myDAQ screw terminal block in this experiment.
Using the analog power supply will damage the logic chips.)
The circuit consists of an 8-bit shift register (74HC164), an x-or gate chip (74HC86),
some resistors and an LED. This lab is a demonstration circuit only. No design is
required.
Equipment List:
• myDAQ board with cables. (You can hook them to the lab computers if you don’t
want to bring your laptop.)
• Multisim software.
• From previous labs:
o Protoboard & wire kit
o Resistors: 100 kΩ x 2
• Additional parts:
o 2 Resistors: 47 kΩ, 470 Ω
o 74HC86 Ex-Or gate IC
o 74HC164 8-bit serial-in parallel out shift register IC
o Dip switch module or other switch (optional but convenient)
Instructions & Reference Material:
• myDAQ as voltmeter
https://utah.instructure.com/courses/266578/assignments/1347122
• Multisim demos : See DVD in back of your book.
• Data Sheets:
74HC86 http://www.nxp.com/documents/data_sheet/74HC_HCT86.pdf
74HC164 http://www.nxp.com/documents/data_sheet/74HC_HCT164.pdf
UNIVERSITY OF UTAH DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
50 S. Central Campus Dr | Salt Lake City, UT 84112-9206 | Phone: (801) 581-6941 | Fax: (801) 581-5281 | www.ece.utah.edu
2
ECE 1250 LAB 6
I.
PreLab: (10 points)
Download and run the following Multisim file to simulate the circuit for the
electronic candle, as shown in Fig. 1:
https://utah.instructure.com/courses/266578/files/37145230
Note that you will need to flip switch S1 on and then off (by pressing the space
bar on your keyboard) to initialize the circuit. When you run the circuit, you
should see a more-or-less random square wave in red on the oscilloscope. That is
because the circuit generates pseudo-random numbers. In the lab, you will hook
this output signal to an LED, making it flicker at random, like a candle. A short
video of the LED is available at:
https://utah.instructure.com/courses/266578/files/37145228
Fig. 1 Multsim circuit for electronic candle with output shown on oscilloscope.
Until now, we have focused on constant voltages in a circuit. Now, however, we
are creating a circuit that processes 1's and 0's, (i.e., node voltages of 6 V and 0
V), and creates new patterns of 1's and 0's. Specifically, our circuit has a shift
register (74HC164) that can store a pattern of eight bits (i.e., 1's and 0's). When
we drive the clock input of this shift register with a square wave that jumps from
0 V to 6 V at a rate of about 100 times per second, the shift register repeatedly
shifts its store patterns of 1's and 0's to the right. One bit falls off the end of the
pattern and is lost each time the clock goes high and low. A new bit is shifted in
from the A input. Curiously, the bit that comes into the A input comes from an
exclusive-or logic gate (74HC86) that gets its inputs from two bits coming out of
UNIVERSITY OF UTAH DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
50 S. Central Campus Dr | Salt Lake City, UT 84112-9206 | Phone: (801) 581-6941 | Fax: (801) 581-5281 | www.ece.utah.edu
ECE 1250 LAB 6
3
the shift register. By picking the right inputs, this scheme of self-feedback results
in a seemingly random patterns of 1's and 0's being fed into the shift register.
The clock signal that makes everything happen comes from the function
generator, which is one of the virtual instruments in Multisim. The function
generator is a useful tool device that can output voltage waveforms of different
frequencies and shapes. In our case, we use a square wave, and 100 Hz works
well. Make sure the function generator is setup exactly as shown in Fig. 1.
Now run the simulation to see the pattern of 1's and 0's for the bit being fed into
the shift register at input A. To initialize the circuit, close the switch by pressing
the space bar. Then open the switch again. The oscilloscope should now show
1's and 0's as a plot of voltage versus time. Slow down the clock (function
generator) to 2 Hz to see the 1's and 0's for 0.5 seconds each on the oscilloscope.
Speed up the clock to see a longer record of 1's and 0's like that shown in Fig. 1.
By the way, this clock plays the same role as the clock in your computer, but at a
vastly slower rate!
Set up the oscilloscope as shown in Fig. 1 if it's settings get changed, but
experiment with the controls all you like. The oscilloscope is the essential tool of
electrical engineering. With it, you can analyze any kind of low-frequency
circuit. It makes a plot of voltage versus time, and has a number of controls for
adjusting how the waveform is displayed. The oscilloscope plots from left to
right so quickly you cannot see it. It follows the voltage of the waveform in real
time as it plots. Then it starts at the left and plots the voltage again. Each time
across the screen for the waveform is called one "trace." The oscilloscope
continues to plot the voltage in real time, (i.e., draw traces), as long as it is
running.
For a repetitive waveform like our square wave clock, unless the oscilloscope
starts a trace at just the right time, the traces will superimpose (because of the
persistence of our vision) and show a jumbled mess. For this reason, the
oscilloscope actually waits to start a trace until a particular "trigger" event occurs,
such as the up-going edge of the square wave. Setting up the trigger can be
tricky, but many scopes now have an "auto scale" button that usually does an
adequate job. If not, experiment with the triggering functions on the scope.
The scale values on the oscilloscope are like zoom functions for the horizontal
(time) and vertical (voltage) directions, causing the plot to shrink or expand in the
x or y direction. The oscilloscope is able to plot to voltage waveforms at once,
and it even has a convenient reference symbol on the left showing where 0 V is on
the vertical axis.
Capture a screen shot of the Multisim oscilloscope showing the random
waveform. Paste it in as Fig. 1 in the Lab 6 Worksheet file to be handed in. (See
worksheet for instructions on how to capture a screen shot of the oscilloscope.)
UNIVERSITY OF UTAH DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
50 S. Central Campus Dr | Salt Lake City, UT 84112-9206 | Phone: (801) 581-6941 | Fax: (801) 581-5281 | www.ece.utah.edu
4
ECE 1250 LAB 6
II.
Electronic Candle Circuit (90 points)
A. Fig. 2 shows a schematic diagram of the electronic candle circuit. Build the
circuit, as shown in Figs. 3 and 4, but without the myDAQ connection from
AO 0, (shown as the green wire in Fig. 3). Read the instructions in II.B
completely before connecting the myDAQ AO 0 wire to the circuit. Note the
connections from the myDAQ for the power supply (5 V and DGND) are not the
+15 V and –15 V we have used before.
For the switch in the upper left corner, you may substitute a wire that you use to
briefly connect pins 1 and 2 of the 74HC164 together. If you use the wire, you
may omit the switch and the green wire in the upper left corner of the breadboard.
Make sure you put the notch on each chip toward the top edge of the breadboard.
Pin numbers on the chips start at 1 at the upper left and count up in the counterclockwise direction as you go around the chip. (Fig. 3 shows the pin numbers.)
+5 V power is almost always the last pin on the upper right corner of the chip, and
reference (or gnd) is almost always the pin on the lower left corner of the chip.
Note: If you are wondering about the resistors connected to the exclusive-or gate
that drives the clock (CP) input of the shift-register, they help to quicken the rise
time of the clock signal. Without these, the shift-register "glitches" and produces
spurious outputs. Without them, the time for the candle pattern to repeat is
shorter.
Fig. 2 Schematic diagram of electronic candle circuit.
B. The electronic candle runs off a clock signal from the function generator built into
the myDAQ. Before you connect the clock to the 74HC164, you must set it up
to go from 0 V to 5 V. It's default of, say, +5 V to -5 V, can damage the IC's.
The clock signal for the circuit will come from your myDAQ analog outputs
AO 0 and AGND. To test the clock without connecting it to the 74HC86 IC,
remove the 47 kΩ resistor that AI 0+ from the myDAQ connects to.
UNIVERSITY OF UTAH DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
50 S. Central Campus Dr | Salt Lake City, UT 84112-9206 | Phone: (801) 581-6941 | Fax: (801) 581-5281 | www.ece.utah.edu
5
ECE 1250 LAB 6
Start your myDAQ Function Generator from the menu on your PC where you
start the DMM. Fig. 5 shows the proper settings for the function generator, which
are described here in words. Set the function generator clock signal to: square
wave, 10 Hz, amplitude 5 V, offset 2.5 V.
Fig. 3 Breadboard layout for electronic candle circuit.
To observe the clock signal from the myDAQ, you will use the oscilloscope built
into the myDAQ. Start your myDAQ Oscilloscope from the myDAQ menu
where you start your DMM function generator. Fig. 6 shows the proper settings
for the oscilloscope, which are also discussed below. To activate the myDAQ
oscilloscope, press its RUN button.
UNIVERSITY OF UTAH DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
50 S. Central Campus Dr | Salt Lake City, UT 84112-9206 | Phone: (801) 581-6941 | Fax: (801) 581-5281 | www.ece.utah.edu
6
ECE 1250 LAB 6
Fig. 4 Picture of electronic candle breadboard.
Set the Oscilloscope inputs to be AI 0 in Channel 0 Settings "Source" and AI 1 in
Channel 1 Settings "Source". Now connect the wires that act as the input probes
for the oscilloscope. That is, connect the AI 0+ input on the connector block on
the side of the actual myDAQ itself to your breadboard on the same row (row 22
left side in Fig. 4) as the clock from the function generator. Connect AI 0– to
reference on the breadboard. Also, connect one of the AGND's on the myDAQ to
reference on your breadboard. This completes the input for channel 1 of the
oscilloscope. (The oscilloscope inputs are shown as yellow and white wires in
Fig. 4.)
To setup the second channel of the oscilloscope, connect the AI 1+ input on the
connector block on the side of the actual myDAQ itself to your breadboard on the
same row (row 6 right side in Fig. 4) as the output of the electronic candle circuit.
Connect AI 1– to reference on the breadboard.
Display the clock waveform. (Press the RUN button on the oscilloscope, if you
didn't before.) Make sure the clock waveform goes from 0 V to 5 V. Note that
the oscilloscope lacks a reference indicator, but you can activate the cursors
(lower left of oscilloscope screen) to measure the min and max voltage of your
waveform.
UNIVERSITY OF UTAH DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
50 S. Central Campus Dr | Salt Lake City, UT 84112-9206 | Phone: (801) 581-6941 | Fax: (801) 581-5281 | www.ece.utah.edu
7
ECE 1250 LAB 6
Once you have the clock signal working and have checked it off with the TA,
reinsert the 47 kΩ resistor into the electronic candle circuit in row 22 of the
breadboard as shown in Fig. 3. Initialize your candle by shorting pins 1 and 2 of
the 74HC164 together (or toggle your switch, if you used one). You should see a
second, random square wave in blue on the oscilloscope screen, and your LED
should flash randomly, like a candle.
Troubleshooting tips (assuming your clock signal was working):
1) Check that +5 V is getting to the power pin (pin 14) on the upper right corner
of each chip.
2) Visually verify that the lower left pin (pin 7) on each chip is connected to
reference.
3) Verify that the clock signal is at pin 8 of the 74HC86.
4) Verify that the clock signal is at pin 8 of the 74HC164.
5) Verify that the XOR gate is working: if both inputs are 5 V or 0 V, its output
on pin 3 is 0 V; if one input is 5 V and the other is 0 V, its output on pin 3 is
5 V.
6) Verify that the signal at pin 3 of the 74HC86 is the same as on pin 2 of the
74HC164.
7) Verify that a random square wave is present at pin 2 of the 74HC164.
Fig. 5 myDAQ function generator settings for 0-5V square wave clock output.
Once your candle is working, try answering the following question both visually
and by calculation: for a clock frequency of 40 Hz, how long does it take for the
candle pattern to repeat? Hint: the pattern repeats every 127 bits.
UNIVERSITY OF UTAH DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
50 S. Central Campus Dr | Salt Lake City, UT 84112-9206 | Phone: (801) 581-6941 | Fax: (801) 581-5281 | www.ece.utah.edu
8
ECE 1250 LAB 6
Try changing the Frequency setting of the function generator to speed up or slow
down the candle. Find the speed you like best, and demonstrate to your TA that
the LED blinks apparently at random.
Capture a screen shot of the myDAQ oscilloscope showing the random waveform.
Paste it in as Fig. 2 in the Lab 6 Worksheet file to be handed in. (See worksheet
for instructions on how to capture a screen shot of the oscilloscope.)
Fig. 6 myDAQ oscillscoper settings for monitoring electronic candle circuit.
UNIVERSITY OF UTAH DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
50 S. Central Campus Dr | Salt Lake City, UT 84112-9206 | Phone: (801) 581-6941 | Fax: (801) 581-5281 | www.ece.utah.edu
Download