Exp 1
Exp 1
The objective of this course is to learn the fundamentals of computer aided circuit simulation using PSpice.
This experiment introduces the fundamentals of PSpice and concentrates on analysis of some DC circuits.
Introduction
SPICE is a powerful general purpose analog circuit simulator that is used to verify circuit designs and to
predict the circuit behavior. This is of particular importance for integrated circuits. It was for this reason
that SPICE was originally developed at the Electronics Research Laboratory of the University of California,
Berkeley (1975), as its name implies
Simulation Program for Integrated Circuits Emphasis
The EEE110 Lab uses the student version of the PSpice program extensively to simulate and predict the
behavior of experimental circuits. Simulation is very important as it allows a potential circuit to be tested
for errors before it is actually built, thus saving time and cost.
A SPICE input file, called source file (“filename.cir”) , consists of three parts.
1. Data statements : description of the components and the interconnections.
2. Control statements: tells SPICE what type of analysis to perform on the circuit.
3. Output statements : specifies what outputs are to be printed or plotted.
Although these statements may appear in any order, it is recommended that they be given in the above
sequence. Two other statements are required, the title statement and the end statement. The title statement
is the first line and can contain any information, while the end statement is always .END
Page 1 of 11
TITLE STATEMENT
ELEMENT STATEMENTS
.
.
COMMAND (CONTROL) STATEMENTS
OUTPUT STATEMENTS
.END
1.1. Resistors
Although PSpice allows for sophisticated temperature-dependent resistor models, we will begin with the
simple, constant-value resistor. The first letter of the name for a resistor must be "R.".
The resistor is not an active device, so the polarity of its connection has no effect on the values of the
voltages and currents reported in the solution. However, the current through a resistor is reported as that
which flows from the node on the left to the node on the right in the source code line in which the resistor
is entered.
Examples:
Rname +node -node value comment
Rabc 31 0 14k ; reported current from 31 to 0
Rabc 0 31 14k ; reported current changes sign
rshnt 12 15 99m ; 0.099 ohm resistor
Rbig 19 41 10MEG ; 10 meg-ohm resistor
An alternative to this type of notation, which is in fact, the default for PSpice output data, is "textual
scientific notation." This notation is written by typing an "E" followed by a signed or unsigned integer
indicating the power of ten. Some examples of this notation are shown below:
656,000 = 6.56E5
-0.0000135 = -1.35E-5
Page 2 of 11
The name is followed by the positive node designation, then the negative node designation, then an optional
tag: "DC" followed by the value of the voltage. The tag "DC" (or "dc") is optional because it is the default.
Later, when we begin modeling AC circuits and voltage sources that produce pulses and other waveforms,
we will be required to designate the type of source or it will default back to DC.
Examples:
Vname +node -node type value comment
Va 4 2 DC 16.0V; "V" after "16.0" is optional
vs qe qc dc 24m ; "QE" is +node & "qc" is -node
VWX 23 14 18k ; "dc" not really needed
vwx 14 23 DC -1.8E4 ; same as above
One of the interesting uses of ideal independent voltage sources is that of an ammeter. We can take
advantage of the fact that PSpice saves and reports the value of current entering the positive terminal of an
independent voltage source. If we do not actually require a voltage source to be in the branch where we
want to measure the current, we simply set the voltage source to a zero value. It still calculates the current
in the branch.
Example:
Page 3 of 11
Example: .DC V1 0 20 2
Often, we do not actually want to run a sweep over many values of a parameter. We can circumvent the
sweep by setting its Start and Stop values identical (and the Step is non-zero) so that it can only run one
value.
Example: .DC Vs 20 20 1
Since the starting value equals the stopping value, the analysis will only run for one case, i.e., for Vs at 20
volts.
3. Output statements
These statements will instruct PSpice what output to generate. If you do not specify an output statement,
PSpice will always calculate the DC operating points.
3.1. .Print Command
One of the many "dot commands" in PSpice is the .PRINT command. It has many uses, but we will
concentrate here on using it for printing DC voltages and currents. The .PRINT command can be repeated
as often as necessary in an analysis. You can list as many items on a line as you wish.
However, we must keep in mind that the .PRINT command was designed to work with a DC or an AC
sweep. Usually, a DC sweep is made by changing the values of a source; although we will later learn to
sweep over other circuit parameters.
Remember that in this experiment we will use DC sweep statement only to enable the .PRINT command.
The .PRINT command will not work unless there is a sweep going on. Note: What you enter in the .DC
statement overrides any voltage value you may have placed in the part listing for the source.
Printing DC Voltages
In addition to printing the node voltages you can print the voltage between any pair of nodes
Printing DC Currents
To print currents, you type the letter "I" with the element name in parentheses. Note that the reported current
is that which flows into the element from the node listed on the left in the *.CIR file, through the element,
and out the node listed on the right in the *.CIR file. If you want to change the sign of the reported current
in a resistor, then swap the two nodes for that resistor.
Page 4 of 11
3.3. .Probe Command
Probe is a graphics post-processor/waveform analyzer for PSpice. The simulation results cannot be used
directly by Probe. First, the results have to be processed by the .PROBE command, which writes the
processed data on a file, PROBE.DAT, for use by Probe.
Probe statements
.PROBE
.PROBE V(5) V(4,3) I(R2)
In the first form, where no output variable is specified, the .PROBE command writes all the node voltages
and all the element currents into the PROBE.DAT file. In the second form, where the output variables are
specified, PSpice writes only the specified output variables to the PROBE.DAT file. Once the results of the
simulation are processed by the .PROBE command, the results are available for graphical displays and can
be further manipulated through expressions.
Circuit Example 1
Steps:
1. Open MicroSim Design Manager by following the path start>programs>MicroSim Eval 8 or as
appropriate in your PC.
Schematics
PSpice A/D
TextEdit
2. Click the TextEdit button to open MicroSim Text Editor. Here write down the following Netlist
Example_1a Exmpl01a.CIR
Vs 1 0 DC 20.0V ; note the node placements
Ra 1 2 5.0k
Rb 2 0 4.0k
Rc 3 0 1.0k
Is 3 2 DC 2.0mA ; note the node placements
.END
Page 5 of 11
3. Save the file with a name Exmpl01a.cir
4. Click PSpice A/D button to open the PSpice Analog/Digital Simulator
5. Open your Exmpl01a.cir file by clicking file and then open. If there is no error in the netlist then it
will automatically complete the simulation and will give the message “simulation completed
successfully”.
6. To examine the result click file and then Examine Output
Example_1b Exmpl01b.CIR
Vs 1 0 DC 20.0V ; note the node placements
Ra 1 2 5.0k
Rb 2 0 4.0k
Rc 3 0 1.0k
Is 3 2 DC 2.0mA ; note the node placements
.DC Vs 20 20 1 ; this enables the .print commands
.PRINT DC V(1,2) I(Ra)
.PRINT DC V(2) I(Rb)
.PRINT DC V(3) I(Rc)
.END
With a little bit of effort, we can get PSpice to do most of the work, most of the time. Note that using
.PRINT has suppressed the default printing of all the node voltages. Be sure that you include everything
you need in the .PRINT statements
Practice Problem 1
Page 6 of 11
Part 2: Introduction to Schematic
In this part you will learn to use the PSpice circuit simulation with the schematic capture front end,
Schematics. Click Schematic button in the MicroSim Design Manager window to get the following
schematic window.
Page 7 of 11
3. Connecting the Circuit
• Now you'll have to connect the parts with wires.
• Go up to the tool bar and
o select "Draw Wire" or
o "Ctrl+W" or
o go to "Draw" and select "Wire".
• With the pencil looking pointer, click on one end of a part, when you move your mouse around,
you should see dotted lines appear. Attach the other end of your wire to the next part in the circuit.
• Repeat this until your circuit is completely wired.
• If you want to make a node (to make a wire go more then one place), click somewhere on the wire
and then click to the part (or the other wire). Or you can go from the part to the wire.
• To get rid of the pencil, right click or press “Esc”.
• If you end up with extra dots near your parts, you probably have an extra wire, select this short
wire (it will turn red), then press "Delete".
• If the wire doesn't go the way you want (it doesn't look the way you want), you can make extra
bends in it by clicking in different places on the way (each click will form a corner).
• If you double click on the part itself, you can select VALUE and change it in this box.
Page 8 of 11
• To add voltage or current bubbles, go to the right side of the top tool bar and select "Voltage/Level
Marker" (Ctrl+M) or "Current Marker" . To get either of these, go to "Markers" and either
"Voltage/Level Marker" or "Current Marker".
B. Analysis
• Open the analysis menu by clicking the button. Enable the appropriate analysis options and the
press close.
• Click on the Simulate button on the tool bar (or Analysis, Simulate, or F11).
C. Probe
1. Before you do the Probe
• You have to have your circuit properly drawn and saved.
• There must not be any floating parts on your page (i.e. unattached devices).
• You should make sure that all parts have the values that you want.
• There are no extra wires.
• It is very important that you have a ground on your circuit.
• Make sure that you have done the Analysis Setup and that only the things you want are enabled.
3. Graphing
• If you don't have any errors, you should get a window with a black background to pop up
• If you did have errors, go To "View - Output File" to check the errors.
4. Adding/Deleting Traces
• PSpice will automatically put some traces in.
• To change them go to Trace - Add Trace or on the toolbar. Then select all the traces you want.
• To delete traces, select them on the bottom of the graph and press “Delete”.
5. Doing Math
• In Add Traces, there are functions that can be performed, these will add/subtract (or whatever you
chose) the lines together.
• Select the first output then either on your keyboard or on the right side, click the function that you
wish to perform.
• It is interesting to note that you can plot the phase of a value by using IP(xx), where xx is the
name of the source you wish to see the phase for.
Page 9 of 11
6. Finding Points
• There are Cursor buttons that allow you to find the maximum or minimum or just a point on the
line. These are located on the toolbar (to the right).
• Select which curve you want to look at and then select "Toggle Cursor" .
• Then you can find the max, min, the slope, or the relative max or min ( is find relative max).
7. Saving
• To save your probe you need to go into the tools menu and click display, this will open up a menu
which will allow you to name the probe file and choose where to save it. You can also open
previously saved plots from here as well.
Circuit Example 2
• Using the steps explained above draw and simulate the following circuit. This is the same circuit
that we used for our example 1.
• In Analysis Setup window only enable “Bias Point Detail” option.
Page 10 of 11
• To examine the node voltages and current through each part go to Analysis menu in the Schematic
window and then Display results on Schematic.
• You can also generate the netlist from the schematic by using the Create Netlist option from
Analysis menu. To see the created netlist use Examine Netlist option from Analysis menu.
* Schematics Netlist *
Practice Problem 2
Page 11 of 11