Multisim Electronics Workbench Tutorial-Hardware Description Language-Handout, Exercises of Verilog and VHDL

This is tutorial of Multisim Electronics Workbench. It has description and usage of tools. This tutorial was provided by Prof. Subhash Malik at Ankit Institute of Technology and Science. It includes: Multisim, Electronic, Workbench, Tutorial, Professional, Software, Version, Oscilloscope, Components, Plotter, Logic, Analyzer, Simulation

Typology: Exercises

2011/2012

Uploaded on 08/26/2012

parvani
parvani 🇮🇳

4.6

(5)

73 documents

1 / 24

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Multisim Electronics Workbench
Tutorial
Multisim Electronics Workbench is available in several different versions including a
professional version, a demo version, a student version, and a textbook version. The
professional version is available in the labs on the CECS network and has all of the
Workbench features. The demo version may be downloaded from the Workbench
website at http://www.electronicsworkbench.com/html/eduproda.html. The
demo version is limited in that the user is unable to save or print results. A more fully
featured student suite version (limited to 100 components) is available for home use from
Prentice-Hall for about $80 dollars. Finally, the textbook version is packaged with
certain text books including the book currently being used in EE 210/215. It has some
limited features such as the user may have only 50 components but this version can read
and simulate larger files created on the professional version. This tutorial focuses on the
features in the textbook version.
Figure 1 shows the opening screen of Workbench. To use the program you choose a set
of components from the Parts Bin toolbar located on the left side of the screen and place
them on the screen. The components are connected by using the cursor to drag "wires"
between the parts. When the circuit is complete, you choose some type of measuring
instrument from the Instruments toolbar on the right side of the screen. For example, you
might connect an oscilloscope to the output of your circuit. This done, you can simulate
your circuit and observe the output on the instruments you connected.
Figure 1
The Multisim opening screen
Figure 2 lists the commonly used icons from the toolbars. Note that on the textbook
version some icons are grayed out since they are not available on this version (for
example there is no spectrum analyzer).
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18

Partial preview of the text

Download Multisim Electronics Workbench Tutorial-Hardware Description Language-Handout and more Exercises Verilog and VHDL in PDF only on Docsity!

Multisim Electronics Workbench Tutorial

Multisim Electronics Workbench is available in several different versions including a professional version, a demo version, a student version, and a textbook version. The professional version is available in the labs on the CECS network and has all of the Workbench features. The demo version may be downloaded from the Workbench website at http://www.electronicsworkbench.com/html/eduproda.html. The demo version is limited in that the user is unable to save or print results. A more fully featured student suite version (limited to 100 components) is available for home use from Prentice-Hall for about $80 dollars. Finally, the textbook version is packaged with certain text books including the book currently being used in EE 210/215. It has some limited features such as the user may have only 50 components but this version can read and simulate larger files created on the professional version. This tutorial focuses on the features in the textbook version.

Figure 1 shows the opening screen of Workbench. To use the program you choose a set of components from the Parts Bin toolbar located on the left side of the screen and place them on the screen. The components are connected by using the cursor to drag "wires" between the parts. When the circuit is complete, you choose some type of measuring instrument from the Instruments toolbar on the right side of the screen. For example, you might connect an oscilloscope to the output of your circuit. This done, you can simulate your circuit and observe the output on the instruments you connected.

Figure 1 The Multisim opening screen

Figure 2 lists the commonly used icons from the toolbars. Note that on the textbook version some icons are grayed out since they are not available on this version (for example there is no spectrum analyzer).

Parts Bin Instruments Source components. Includes dependent and independent sources and grounds

Multimeter. Amps, volts, or Ohms.

Basic components. Resistors, capacitors, inductors and variations

Function generator. Sine, square, and triangular waveforms Diodes. Includes LED's and bridge networks

Wattmeter.

Bipolar and MOS transistors Oscilloscope (2-Channel)

Analog components. Includes op amps and other amplifiers

Bode plotter. Does both magnitude and phase TTL. A wide selection of 74 and 74LS packages

Logic Analyzer

CMOS. 4xxx and 74HC components Mode and Simulation Miscellaneous digital including VHDL and Verilog

Component mode button. Click this to add components Mixed analog/digital including converters and 555 timer

Component editor to modify component parameters. Indicators. voltmeter and ammeter, indicator lamps, and displays

Instruments. Click this to add an instrument.

Miscellaneous components including a vacuum tube and a motor

Simulate button. Alternatively, push F5 to toggle start/stop and F6 to pause. Control system components such as summers, multipliers, etc.

Analysis. Transient, AC, DC, and Fourier included. RF components VHDL and Verilog simulation.

Electromechanical including a coil, transformer, and a relay.

Report. Click this to generate a report.

Figure 2 The principle icons on the three main tool bars of Workbench.

With the battery in place the next item to chose will be the voltage dependent current source. Choose this from the Source Components in the Parts Bin. A voltage dependent current source has a value in mhos or amps/volt. Set this value to 0.001 mhos. The circuit also has a ground on either side of the dependent source. Select a ground symbol from the Source Components and place them on the diagram. Your circuit should look something like that shown in Figure E3.

There are four resistors to be added to the circuit and we are done with the sources menu. You can close the source menu and open the Basic Components menu on the Parts Bin tool bar. Note that there are two types of resistors in the parts bin. One type is a "real world" resistor that has a value that you can purchase. The second type is a "virtual" resistor that is idealized and can have any value you choose to assign to it. Choose a 1KΩ resistor and place it on the circuit diagram between the battery and dependent source. Similary choose a 2KΩ resistor and place it immediately to the left of the dependent source. You can rotate a resistor by right clicking on it and choosing one of the rotation options. Choose another 1KΩ and 2KΩ resistor and place them to the right of the dependent source. Rotate the resistors as needed so that your circuit looks like that shown in Figure E4.

Figure E1- A battery and a voltage dependent current source have been placed.

Figure E1- The circuit with all of the components in place. Note that resistors can be rotated by right clicking on them and choosing one of the rotation options.

With the components in place you are ready to connect the wires. Workbench has no wire mode. You connect wires by moving the cursor to a component wire end, click on it, go to a second component and click on its wire end. Workbench will then fill in a wire between those two components. If you get a wire wrong, simply click on the wire and push delete to get rid of it.

It may be tempting to place components close enough together so that their terminals touch and thereby avoid having to connect them together with a wire. But this doesn't work in Workbench. Components must be connected together by wires.

On occasion you may want to connect the end of one wire to a component. You cannot begin a new wire from an old one unless you place a junction on the wire first. You can do this from the Place menu at the top of the screen.

Sometimes Workbench does not choose a very good path between two points and the wire makes the circuit appear cluttered or unnecessarily complicated or the wire path passes through text. You can choose the path for any wire by clicking on intermediate points on the screen to form corners or junctions. You do this by first clicking on a component wire end, clicking on one or more intermediate points, and finally clicking on the component wire end of the second component. The wire path will then go from the first component through each intermediate point to the second component. After connecting the wires in the example your circuit should look like that shown in Figure E5.

V 10V

I 0.001Mho

R

1.0kohm R 2.0kohm

R 1.0kohm

R

2.0kohm

Figure E1- The complete circuit with all of the components and wires in place.

Example 2 An RC network using the oscilloscope and Bode plotter In this example we use the oscilloscope and the Bode plotter in an RC circuit that has an AC source. The circuit which we will construct is shown in Figure E2-1.

Figure E2- The complete circuit showing the oscilloscope and Bode plotter.

Begin by placing a 10KΩ resistor, a 1.0uF capacitor, a 100Ω resistor, an AC voltage source, and an analog ground as shown in Figure E2-2. Use the cursor to draw in the connecting wires. If you are unfamiliar with placing components and connecting wires refer to Example 1.

R 10kohm

R 100ohm

C 1.0uF

V 10V 1000Hz 0Deg

Figure E2- The basic RC circuit with all components in place. Note that you will have to change the default value of the AC voltage source to 10 Volts by double clicking on the source and setting the value on the pop-up menu.

For this circuit we will take the input to be the 10 volt AC source and the output to be the voltage across the series combination of C1 and R2. Select the oscilloscope from the Instruments toolbar and connect the A channel to the top of V1 and the B channel to the top of C1. It's not necessary to connect the oscilloscope ground. Your circuit should look like that shown in Figure E2-3. Double click on the oscilloscope to open the oscilloscope control window and set the values as shown in the figure.

Figure E2- The circuit with the oscilloscope connected. The time base is set to 200μsec/div. Set channel A to 10 V/Div and channel B to 200 mv/Div. Set the y-position of channel A to +1.4 volts and the y-position of channel B to -1.6 volts.

Push the F5 function key to run the simulation (or push the rocker switch at the top right of the Workbench screen). The oscilloscope display will look like that shown in Figure E2-4.

Figure E2- The oscilloscope showing the simulation.

The oscilloscope display has two arrows in red and blue near the top of the display. Use the cursor to move the red arrow to a peak of the channel A display and move the blue arrow to the peak in the channel B display. The display will then show the difference in time as T2-T1 about equal to 160 μsec. Note that the input voltage source is at 1KHz so the phase shift between the two is (160/1000)x360o^ = 57.6o.

Note that the oscilloscope has a Save button. This allows you to save the data collected and displayed by the scope into an ascii file. The file can then be read by other program such as Matlab or Excel for reports or graphs. When you click on Save, you are

Double click on the Bode plotter to get the control and output screen for the instrument. By tradition, a Bode plot is logarithmic plot of gain magnitude and phase vs. frequency. On Workbench you can alter the vertical and horizontal scales to be either linear or logarithmic. For this example we will leave the traditional log plot in place. Change the horizontal frequency scale so that the starting frequency (in window marked I) is at 10Hz and the ending frequency (in the window marked F) is at 100KHz. Run the simulation to get the Bode plot similar to that shown in Figure E2-6 below.

Figure E2- The Bode plot simulation showing the magnitude function. Note that you can move the red arrow horizontally and read out values in the window. The window above shows that the gain is at -20.442DB at a frequency of 165.059Hz.

Click on the Phase button to see the phase curve. If you move the horizontal arrow to 1000Hz you will see the display shown in Figure E2-7.

Figure E2- The phase curve with the marker set to about 1KHz. The phase is -55.207o^ which agrees with the phase measurement taken on the oscilloscope.

Like the oscilloscope, the Bode plotter also has a Save option which allows you to save the data taken by the plotter as an ascii file. The first part of the Bode data file is shown in Figure E2-8. You can read the data file directly into Excel and make a prettier plot or you can strip off the header information and read the data into Matlab.

Bode data for

column 1 Frequency (Hz) column 2 Gain (dB) column 3 Gain (Linear) column 4 Phase (Deg) trace name: Bode Result

Frequency Gain (dB) Gain Phase

1.00000e+001 -1.46954e+000 8.44351e-001 -3.20393e+ 1.02329e+001 -1.52790e+000 8.38697e-001 -3.26306e+ 1.04713e+001 -1.58818e+000 8.32897e-001 -3.32275e+ 1.07152e+001 -1.65042e+000 8.26950e-001 -3.38295e+ 1.09648e+001 -1.71465e+000 8.20857e-001 -3.44365e+ 1.12202e+001 -1.78090e+000 8.14620e-001 -3.50483e+ 1.14815e+001 -1.84921e+000 8.08239e-001 -3.56645e+ 1.17490e+001 -1.91960e+000 8.01715e-001 -3.62850e+ 1.20226e+001 -1.99211e+000 7.95050e-001 -3.69093e+ 1.23027e+001 -2.06676e+000 7.88246e-001 -3.75374e+ ... Figure E2- The first portion of the text file created by the Bode plotter. Click on the Save button to create this file.

To get the Matlab plot, open the Bode plot data file in a word processor such as Word or Notepad, strip off all of the information above the raw data appearing in the 4 columns, and save the resulting file in a txt format. In Matlab you can plot the magnitude data using the following commands: s = load('BodeData.txt'); semilogx(s(:,1),s(:,2));

Figure E3- Choose SimulateAnalysisAC Analysis and set up the frequency parameters as shown.

Next choose the Output variables tab from the top of the menu, select node 3 from the left side of the page and click on the arrow to move it to the right side.

Figure E3- The output variables screen for AC Analysis. Select node from the left and click on the "Plot during simulation" button to move it to the right.

Click on Simulate to complete the AC Analysis simulation. The results will appear in a new window called "Analysis Graphs" as shown in Figure E3-5. Note that the Bode plot which we did before also appears in this window under its own tab. The AC analysis and the Bode plot both show the same information but they are plotted with different scales. The Bode plot has a logarithmic frequency scale and we chose a linear frequency scale for the AC analysis.

Figure E3- The AC Analysis. Note that this graph provides the same information as does the Bode plotter but the scales are different.

Transient Analysis In some books the term "Transient Analysis" refers to the step and impulse response of a given circuit. For Workbench the term simply means the analysis of the circuit beginning at time 0 and running for a user specified time. The input is not limited to a step or impulse.

To do a transient analysis choose Simulate → Analysis → Transient from the menu. This

will produce an options screen similar to that shown in Figure E3-6. Change the end time (TSTOP) to 0.01 seconds. Click on the Output variables tab and verify that node 3 is the output variable. Click on the simulate button to get the results of the simulation. This is shown in Figure E3-7. Since we have an AC source as the input the transient analysis shows the sinusoidal start up at the output. The transient start up rapidly dies away within a couple of cycles and settles to the steady state response of the circuit.

To get a step response we would need to change the input voltage source to a Pulse Voltage Source and set the frequency and duty cycle such that the circuit settles out during each cycle. For this particular example, delete the AC Voltage source by clicking on it one time and pushing delete. Select a Pulse Voltage Source from the Parts Bin and connect it in place of the AC source. Double click on the pulse source and set the voltage pulse to go from 0 to 1 volt, set the delay time to 0, the rise and fall times to 1 nsec, and pulse width to 10 msec with a period of 20 msec. Choose simulate to see the results shown in Figure E3-8.

Example 4 Combinational Logic – A 2 to 4 decoder with enable For this example we will simulate a 2-line to 4-line decoder with mechanical switches as input devices and LED's as out put displays. The decoder logic will be made from 74LS TTL parts. The completed circuit is shown in Figure E4-1.

Figure E4- A 2-line to 4-line decoder with an enable. The red LED's indicate the state of the output.

Begin by placing the TTL parts on the diagram first. Select the TTL icon from the Parts Bin and choose the 74LS series. The 3-input nand gates are of type 74LS10 and there are three gates per package so you will need two packages. For the inverters use the 74LS part which has 6 gates per package and will need only three gates. Note that you can rearrange the text that goes with each package to allow for a neater configuration. In Figure E4-1 I have moved the UXX package designations onto the gates themselves. The pin numbers shown would be used if you were actually building this circuit but since this is just a simulation example the pin numbers for an individual gate are of no importance. Be sure to right click on the two bottom most inverters and rotate each counter- clockwise. Your circuit should look something like that shown in Figure E4-2.

Figure E4- Place the 3-input together using two packages of 74LS10 type. Use one package of 74LS04 type for the inverters. Right click on the bottom most inverters and rotate them counter-clockwise.

Next we place the LED's on the board. These are on the Diodes menu in the Parts Bin. You have a choice of several colors. I have rotated the LEDs clockwise and moved their names around to tighten the configuration. After placing the first LED you can copy it and paste it for the others or you can select another LED from the in use list at the top center of the Workbench page. Add in four 330Ω resistors as shown in Figure E4-3.

Figure E4- Place four LEDs and four 330Ω resistors on the board as show.

Finally we need to add the switches and the power supplies. Workbench has switches in two places. The switches we will use are located on the Basic menu and they are single pole double throw (SPDT) switches. (There are some momentary contact switches on the Electromechanical menu also.) Add three of the switches to the circuit and flip each horizontally as shown in Figure E4-4. Add in the digital power supply in three places for convenience.

Example 5 Sequential Logic – D-Type and JK Flip Flops For this example we will simulate a circuit containing a D-Type and a JK flip-flop and make use of the function generator as a clock driver. The final circuit is shown in Figure E5-1.

Figure E5- A D-Type and JK flip-flop.

Begin by adding the two flip-flops to the diagram. These are both on the TTL XXLS series menu in the Parts Bin. For both the 74LS74 and the 74LS76 there are two independent flip-flops per package so you choose just one section from each package. After placing the flip-flops, choose a function generator and an oscilloscope and place them as shown in Figure E5-2.

Figure E5- In this diagram we have chosen one section from the 74LS74 and one section from the 74LS76 flip flop packages. These are in the TTL Parts Bin. The function generator and the oscilloscope are chosen from the Instruments menu on the right.

This circuit is all digital. We will add three 5 volt Vcc power sources and three digital grounds to the circuit from the Sources menu in the Parts Bin. Connect the wiring to the diagram as shown in Figure E5-1. Be sure to connect the clear and preset terminals of the flip-flops to +5. Note that the center terminal of the function generator is grounded and the negative terminal is not used. The function generator is specified as having an amplitude, a frequency, a duty cycle, and an offset. The output wave is assumed to be centered vertically around 0 so that, for a square wave, an amplitude setting of 2.5 volts and offset setting of 2.5 volts produces a 5 volt square wave that goes from 0 volts to 5 volts. The negative terminal of the function generator puts out a signal of the opposite polarity and is not used in this simulation. Set up the function generator and the

oscilloscope to look like those shown in Figure E5-3. (Double click on the function generator or the oscilloscope to get the set up screens.)

Figure E5- Set up the function generator and the oscilloscope as shown above.

Click on the simulate button in the top right corner or push function key F5. The simulation shows the JK flip-flop running at one half of the clock frequency.

Figure E5- A simulation of the flip-flop circuit.