ACOE161 Multisim Tutorial

advertisement
ACOE161 – Digital Design for Computers
Tutorial:
Instructor:
NI Multisim
Christos Markides
Semester:
Date:
Spring 2014
16 February 2014
Multisim is the schematic capture and simulation application of National Instruments Circuit Design
Suite, a suite of EDA (Electronics Design Automation) tools that assists you in carrying out the major
steps in the circuit design flow. Multisim is designed for schematic entry, simulation, and feeding to
downstage steps, such as PCB layout.
Multisim’s user interface consists of the following basic elements:
Menus are where you find commands for all functions. For details, see Multisim Menus.
The Standard toolbar contains buttons for commonly-performed functions, as described in Standard
Toolbar.
Page 1 of 15
The Simulation toolbar contains buttons for starting, stopping , and other simulation functions, as
described in Simulation Toolbar.
The Instruments toolbar contains buttons for each instrument, as described in Introduction to the
Multisim Instruments.
The Component toolbar contains buttons that let you select components from the Multisim databases
for placement in your schematic. See Components Toolbar.
The Circuit Window (or workspace) is where you build your circuit designs.
The Design Toolbox lets you navigate through the different types of files in a project (schematics,
PCBs, reports), view a schematic’s hierarchy and show or hide different layers. For details, see
Design Toolbox.
The Spreadsheet View allows fast advanced viewing and editing of parameters including component
details such as footprints, RefDes, attributes and design constraints. Users can change parameters for
some or all components in one step and perform a number of other functions. For details, see The
Spreadsheet View.
Standard Toolbar
The Standard toolbar contains buttons for commonly performed functions. Its buttons are described
below:
Page 2 of 15
Simulation Toolbar
The Simulation toolbar contains buttons used during simulation.
Introduction to the Multisim Instruments
Multisim provides a number of virtual instruments that you use to measure the behaviour of your
circuits. These instruments are set, used and read just like their real-world equivalents. They look just
like the instruments you’ve seen and used in a lab. Using virtual instruments is the easiest way to
examine your circuit’s behavior and show the results of a simulation. In addition to the standard
instruments that come with Multisim, you can create your own custom instruments using LabVIEW, a
graphical development environment for creating flexible and scalable test, measurement, and control
applications.
Virtual instruments have two views: the instrument icon you attach to your circuit, and the instrument
face, where you set the instrument’s controls. You can show or hide the face by double-clicking on the
instrument's icon. The instrument faces are always drawn on top of the main workspace so that they
are not hidden. You can place the instrument faces wherever you wish on your desktop. When you
save your circuit, the instrument face locations and hide/show status are stored with the circuit. As
well, any data contained in the instruments is saved, up to some maximum size (see Saving
Simulation Data with Instruments).
The instrument’s icon indicates how the instrument is connected into the circuit. Once the instrument
is connected to the circuit, a black dot appears inside the terminal input/output indicators on the
instrument face.
Page 3 of 15
Components Toolbar
The buttons in the Components toolbar are described below. Each button will launch the place
component browser (Select a Component browser) with the group specified on the button preselected. For details, see Using the place component browser.
Page 4 of 15
Main Toolbar
The buttons in the Main toolbar are described below:
Instruments Toolbar
The buttons in the Instruments toolbar are described below:
Page 5 of 15
Opening and Saving a File
To launch Multisim:
1. Select Start > All Programs > National Instruments > Circuit Design Suite 10.0 > Multisim.
A blank file opens on the workspace called "Circuit1".
To save the file with a new name:
1. Select File/Save As to display a standard Windows Save dialog.
2. Navigate to the location where you wish the file to reside, enter the filename, and click the Save
button.
To ensure that you will suffer from accidental loss of data save your files frequently and prior to
running the simulation.
To open an existing file:
1. Select File/Open, navigate to the location where the file resides, highlight the file, and click on the
Open button.
Placing Components
To place a component in the Circuit Window (virtual breadboard – white space with dots) simply select
the Component family from the Components toolbar:
You will find that most components used in Digital Logic for Computer is under TTL
(Integrated Circuits) and logic gates, Sources
any logic gate or IC in the circuit.
, Basic
and Diode
for the ICs
. Use the TTL to place
To place any logic gate or an IC simply click on the TTL icon. The standard families (STD) contain
only the logic gates (not the ICs), whereas other families with the _IC ending in their name contain the
IC with the VCC and GND included. In some exercises only the logic gates are required, in others you
are requested to use the ICs. The following window appears to select the family and the component
you wish to place (see List of ICs on the course website on E-Learning), finally click OK to place
the component in the circuit window:
Page 6 of 15
On the Circuit Window the following toolbar appears indicating a choice of A, B, C or D gates to
choose from. Click on A, for example, and place the logic gate in the centre of the Circuit Window.
You can add more logic gates by selecting B, C, and D. Click Cancel to
return to the Select a Component window to select or add more
components from other families.
Your window now appears similar to the figure below:
In order to find out more information regarding the component
you can click on the component and press F1 (on your
keyboard). The help file will appear with information regarding
the logic gate, the function, and the truth table.
The next step is to add input to the logic gate. An instrument component called Word Generator
is
used in order to create the truth table. Click on the Word Generator and place the instrument on the
left of the logic gate. The Word Generator can generate 32-bit patterns or words. The Word Generator
must now be configured in order to create the truth table for the logic gate. Double-click on the Word
Generator in order to set the properties of the instrument:
Set the properties of the Word Generator to the following settings: Controls -> Cycle, Display ->
Binary, and Frequency -> 50 Hz. On the right hand side of the window type the truth table similar to
the figure below (left). Right click on the line at the end of the truth table (highlighted in blue colour)
and select Set Break Point similar to the figure below (right). This will stop the simulation at the end of
the truth table.
The next step is to monitor the output of the logic gate in order to compare how the output changes
with the different values of input. An instrument component called Logic Analyzer
is used in order
to monitor input and output. Click on the Logic Analyzer and place the instrument on the right of the
logic gate. The Logic Analyzer can monitor up to 15 different inputs. The Logic Analyzer must now be
configured in order to monitor the inputs and the output of the logic gate. Double-click on the Logic
Analyzer in order to set the properties of the instrument. Click on the Clock [Set ..] button and
configure the Logic Analyzer as illustrated in the figure below:
Page 7 of 15
Set the properties of the Logic Analyzer to the following settings: Clock Setup -> Clock Rate: 100Hz.
This will force the Logic Analyzer to read data twice as fast as the input from the Word Generator. The
buttons Reset and Reverse clear the window and change the background from black to white
respectively [This will help you to save on printer ink!].
The next step is to connect the wires between the inputs and the output. To connect wires simply click
on one of the input pins of the logic gate and connect it to the Word Generator. Similarly connect the
input connection wires to the Logic Analyzer in order to monitor input as well. Finally connect the
output of the logic gate to the Logic Analyzer. Change the properties of the wires to different colours to
help you distinguish between inputs and outputs (right-click on the wire and click set colour or
properties to change the name).
Page 8 of 15
Double-click to open the Logic Analyzer window in order to monitor the input and output and click on
the Run Simulation button. You can stop the simulation using the Stop button.
The following should now appear on your computer screen. Use the Reverse button on the Logic
Analyzer to switch the colour of the background from black to white.
The Logic Analyzer shows the High (1) and Low (0) inputs as they change over time (blue and red
lines). Also the output appears a farther down (black line), thus outlining the behaviour of the logic
gate.
Finally you can copy/paste your circuit in any application by using the Capture Screen Area (copy to
. Draw a rectangle around your circuit and click the Copy button. It is now possible
clipboard) tool
to paste your selection to another application.
NOTE: IN YOUR LABS YOU SHOULD ALWAYS DISPLAY THE INPUTS AND OUTPUTS ON THE
LOGIC ANALYZER DISPLAY. THIS WILL HELP YOU COMPLETE THE TRUTH TABLES!
Page 9 of 15
In some cases the Logic Analyzer screen extends to the right and as a result a proper screenshot of
all the inputs and the outputs is not possible, even if the Logic Analyzer occupies the entire screen.
The Logic Analyzer component provides a control in order to increase or decrease the Clocks/Division
thus making it possible to contract or expand the graphic display. Increase the value of the
Clocks/Division from 1 to a higher value and the Logic Analyzer screen will contract (shifting values to
the left) as shown below.
Placing IC Components
So far logic gates have been used individually as stand-alone components in Multisim. Usually logic
gates are embedded in Integrated Circuits (ICs) and are more useful in terms of digital applications.
To place IC components in Multisim place click on the TTL icon. The following window appears to
select the family and the component you wish to place (see List of ICs on the course website on ELearning). From the Family select any of the _IC set of families. From the component list select the
appropriate component click OK to place the component in the circuit window:
Page 10 of 15
The IC appears on the breadboard as shown below. The IC does not require any voltage sources or
ground to be connected, instead a word generator and a logic analyzer could be used to provide input
and monitor the output respectively. In this case simply connect the input and output pins as described
in the previous section.
In the Word Generator you can use the Hex Display in order to represent the binary values as
illustrated in the table below:
Decimal
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Binary
0
1
10
11
100
101
110
111
1000
1001
1010
1011
1100
1101
1110
1111
HEX
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
Instead of entering the combinations of the truth table one-byone, the following values hexadecimal values could be entered
in the Word Generator to represent the different combinations:
For example a two-input truth table:
Binary
HEX
00
0
01
1
10
2
11
3
Then for three-input truth table:
Binary
000
001
010
011
100
101
110
111
HEX
0
1
2
3
4
5
6
7
In some logic circuits more than two variables (A and B) are required in order to simulate a logic
circuit. For example a logic circuit could use three variables/inputs (A, B, and C), or four (A, B, C, and
D). The Word Generator provides an option that the truth table can be constructed automatically. Click
Set on the Word Generator and the following window appears. Select Up Counter and click Accept.
Immediately the truth table is populated with hexadecimal values starting from 0. Click on binary and
the truth table is automatically generated, as illustrated below.
Page 11 of 15
Using the correct pins for the Word Generator is extremely important in generating the correct results
for the Pre-Lab and Lab reports. The following figure illustrates the correct assignment of
inputs/variables. For two variables/inputs the assignment is: Pin 0: Input B, Pin 1: Input A. For three
variables/inputs: Pin 0: Input C, Pin 1: Input B, Pin 2: Input A. For four variable/inputs: Pin 0: Input D,
Pin 1: Input C, Pin 2: Input B, and Pin 3: Input A.
Page 12 of 15
Breadboard
Multisim provides a wide range of modules and components that could be used to model any digital or
analogue circuit. The IDL - Digital Lab 800 could be modelled using Multisim as illustrated below:
The components illustrated above can be found in:
No.
Image
1.
2.
3.
4.
LED7
R7
100Ω
GND
VCC
5V
5.
J1
Place Component
Component Family
Diode
LED
LED_red
Basic
Resistor
100
Source
Power_Sources
DGND (Ground)
Source
Power_Sources
Basic
Switch
Basic
Switch
Instruments
Toolbar
Function Generator
TTL
74LS_IC
J3
6.
Type
Key = A
Push Button 1
VCC
(configured to 5V)
DSWPK_8
8 item dip switch
PB_DPST
(Push button trigger
configured to A and B
respectively)
XFG2
7.
U1
8.
1A VCC
1B 4B
1Y 4A
2A 4Y
2B 3B
2Y 3A
GND 3Y
74LS08N
74LS08N
Page 13 of 15
Flip-Flops
Edge detection circuits are used to detect the transition of the Enable from logic 0 to logic 1 (positive
edge) or from logic 1 to logic 0 (negative edge). The operation of the edge detection circuits shown
below is based on the fact that there is a time delay between the change of the input of a gate and the
change at the output. This delay is in the order of a few nanoseconds. The Enable in this case is
called the Clock (CLK).
Positive Edge Detection
Negative Edge Detection
EN
EN'
EN
EN'
EN
EN
EN
EN
EN
EN
EN
EN
EN'
EN'
Another way to ensure that the S and R inputs can not be at logic 1 simultaneously is to cross connect
the Q and Q’ outputs with the S and R inputs through AND gates. The latch obtained is called the JK
latch. In the J and K inputs are both 1 then the Q output will change state (Toggle) for as long as the
Enable 1, thus the output will be unstable. This problem is avoided by ensuring that the Enable is at
logic 1 only for a very short time, using edge detection circuits.
The JK edge triggered flip flop can be obtained by inserting an edge detection circuit at the Enable
(CLK) input of a JK latch. This ensures that the outputs of the flip flop will change only when the CLK
changes (0 to 1 for +ve edge or 1 to 0 for -ve edge).
Positive Edge JK Flip Flop
Negative Edge JK Flip Flop
J
J
S
Q
Q
CLK
S
Q
Q
R
Q
Q
CLK
R
Q
Q
K
K
Logic Symbol
J
Q
CLK
K
Q
CLK J
K
QN+1
X
X
0
0
Q
0
1
0
1
0
1
1
Function
CLK J
K
X
X
0
0
0
1
1
1
0
Q’
1
1
Logic Symbol
J
Q
CLK
K
Q
QN+1
Function
[See lecture notes for completing the tables above]
Page 14 of 15
For example the 74LS113D – Dual JK Negative Edge-Triggered Flip-Flop according to the Data Sheet
specifications:
Logic Symbol
Truth Table
VCC: Pin 14, GND: Pin 7
The 74LS113D flip-flop can be simulated in Multisim as illustrated below. A Word Generator is used
and a Logic Analyzer for inputs and outputs of the JK flip-flop respectively. In this case the IC requires
VCC (5V) on the Preset Switch in order to simulate that the Set value is set to logic 1. The inputs JK
are simulated using the Word Generator and the clock (CLK) is set from the Function Generator.
XLA1
T
R
31
1
15
VCC
X
5V
X
VCC
X
4
~1PR
O
3
O
K
O
16
1J
1
2
J
1Q
5
~1Q
6
1CLK
1K
Q
NOT_Q
F
C Q T
CLK
0
U1A
74LS113D
XWG1
XFG1
Function Generator
GND
GND
The settings for each of the components are:
Word Generator
Function Generator
Logic Analyzer
Page 15 of 15
Download