Pspice Workshop

advertisement
Nurul Arfah Che Mustapha
nurularfah@yahoo.com
Workshop’s Objectives
2. PSpice Introduction
3. Introduction to PSpice tutorial
4. PSpice Tutorial
1.
Workshop’s
Objectives
Workshop’s Objectives
1. To educate & introduce PSpice in basic level
2. To familiarized with the PSpice environment:
 Design components
 Analysis types
 Output Display
3. To able student use PSpice for circuit design &
simulations
4. Most important:

to gather as much info & tips to use this tools
Introduction to
PSpice
Spice Circuit Simulation
Spice = Simulation Program for
Integrated Circuit Emphasis
1.
2.
3.
4.
5.
Developed at UC Berkeley in the ‘60’s
Common SPICEs include HSPICE, PSPICE, LTSpice and
B2SPICE.
It takes a circuit netlist and performs mathematical simulation
of the circuit's behavior.
A netlist describes the components in the circuit and how they
are connected.
Netlists are rather non-intuitive, and difficult to create, debug, and
modify.
PSpice Introduction
1.
PSPICE uses a schematic capture program to
generate the netlist, so you simply have to draw your
circuit in order to simulate it.
2.
The PSpice simulator itself uses “netlists” (text files that
contain the circuit description) as input.
3. Can perform DC level, AC frequency response, bias
point and transient time domain simulations.
4. Allows simulation of circuits without building
physical prototypes.
5. Its like your breadboard, without touching the real
one.
Basic Steps for Simulation
Circuit Design : Component parts, sources, ground
2. Simulation : Analysis Types (time, voltage, frequency
based?)
3. Output Results : Know your design & your intended
results!!
4. Display the Results : Parameters that you want from
the output, e.g: gain Av, slopes, bandwidth, etc
1.
Short cut key:












R = Rotate parts
I = Zoomed-in
O = Zoomed-out
W = Wire
P = to Place Parts @ find components
Ctrl + X = Cut
Ctrl + V = Paste
Esc = to end current task
F11 = to RUN the simulation
G = GND
N = to Name your wire
Insert = Add Trace (simulation o/p)
Additional reminder:
1.
2.
3.
4.
5.
Mega in PSpice = ‘meg’
PSpice accepts (m = e-3)
Its not a case-sensitive : ‘m’ as well as ‘M’ denote
“milli” (1e-3)
Unit can be omitted: e.g: Change the resistor value to
1k
Change the resistor name to R_load (no spaces
allowed!)
Introduction to
PSpice Tutorial
Introduction to PSpice Tutorial
1.
2.
3.
4.
5.
Opening PSpice
Drawing the circuit
Probe
Analysis Menu
Libraries & Types of Sources
Introduction to PSpice Tutorial
1.
2.
3.
4.
5.
Opening PSpice
Drawing the circuit
Probe
Analysis Menu
Libraries & Types of Sources
1. Opening PSpice
 Orcad 16.0 > OrCAD Capture CIS > New > Project >
Name : RC ckt > Analog or Mixed A/D > Create a Blank
Project
1. Opening PSpice
 Orcad Family Release 9.2 Lite Edition > Capture CIS
Lite Edition > New Project > Analog or Mixed A/D >
Create a blank project
PSpice Schematics Editor (V 16.0)
PSpice Schematics Editor (V 9.0)
Introduction to PSpice Tutorial
1.
2.
3.
4.
5.
Opening PSpice
Drawing the circuit
Probe
Analysis Menu
Libraries & Types of Sources
2. Drawing the Circuit
a) Getting the Parts
b) Placing the Parts
c) Connecting the circuit
d) Changing the Name of the Part
e) Changing the Value of the Part
f) Making Sure You Have a GND
g) Voltage and Current Bubbles
h) Saving
i) Printing
2. Drawing the Circuit
a) Getting the Parts
Click on the board
2. Press ‘P’ or
3. Click on the second icon from menu list.
1.
2. Drawing the Circuit
b) Placing the Parts
Libraries
Component
ANALOG
R
SOURCE
VDC
CAPSYM
GND
V1
0Vdc
R1
R2
R3
1k
1k
1k
2. Drawing the Circuit
c) Connecting the circuit
 Press ‘W’ or
 click the third icon from menu list
V1
0Vdc
R1
R2
R3
1k
1k
1k
2. Drawing the Circuit
d) Changing the Name of the Part
1.
Double click on V1, change the name to Vsource .
2. Drawing the Circuit
e) Changing the Value of the Part
Double click Voltage Source value, change to 15.
2. Double click Resistor value, change to:
1.
Parts
Value
VSource
15
R1
1k
R2
1.5k
R3
6.8k
R1
R2
R3
1k
1.5k
6.8k
VSource
15Vdc
2. Drawing the Circuit
f) Making Sure You Have a GND
Make sure you have GND in circuit.
2. The name must always be zero, ‘0’.
3. Unsure where to put it?
-place it near the negative side of your voltage source.
1.
R1
R2
R3
1k
1.5k
6.8k
VSource
15Vdc
2. Drawing the Circuit
g) Voltage and current marker
 Place the voltage and current marker.
R1
R2
R3
1k
1.5k
6.8k
V
VSource
15Vdc
I
V
V
I
2. Drawing the Circuit
h) Simulation
1.
PSpice > New Simulation Profile ..or..

Click on the icon
2. Name the simulation: RSeries
3. Click Create.
2. Drawing the Circuit
h) Simulation
4. Set the following value in simulation setting:
2. Drawing the Circuit
i) Running a simulation
1.
Click PSpice > Run ..or.. Press ‘F11’.. or.. Press the
triangle button.
2. Drawing the Circuit
j) Understand the circuit
2. Drawing the Circuit
k) Another way to view results
1.
Click on the Bias Current and Bias Voltage
2. Drawing the Circuit
k) Another way to view results
Introduction to PSpice Tutorial
1.
2.
3.
4.
5.
Opening PSpice
Drawing the circuit
Probe
Analysis Menu
Libraries & Types of Sources
3) Probe
a) Before you do the probe
b) To start the Probe
c) Graphing
d) Adding/deleting Traces
e) Doing Math
f) Labelling
g) Finding Points
h) Saving
3) Probe
a) Before you do the probe:
 You have to have your circuit properly drawn & 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.
 You have a ground on your circuit.
 Make sure that you have done the Analysis Setup
3) Probe
b) To start the Probe
 Click on the simulation run button or F11.
 It will check, to make sure you don't have any errors.
 If you do have errors, correct them.
 Then a new window will pop up. Here is where you can
do your graphs.
R1
1k
VSource
15Vdc
R2
1.5k
R3
6.8k
3) Probe
c) Graphing
 If you don't have any errors, you should get a window
with a black background to pop up (even with errors,
it will be OrCAD PSpice A/D Demo).
3) Probe
c) Graphing
 If you did have errors, in the bottom, left hand side, it
will say what your errors were (these may be difficult
to understand, so go To "View - Output File").
3) Probe
d) Adding/deleting Traces
 PSpice will automatically put some traces in. You will
probably want 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 push Delete.
3) Probe
e) Doing Maths

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.

There are many functions here that may or may not be
useful.

If you want to know how to use them, you can use PSpice's
Help Menu.

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.
3) Probe
f) Labelling
 Click on Text Label on top tool bar.
 Type in what you want to write. Click OK
 You can move this around by single clicking and
dragging.
3) Probe
g) 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).
Introduction to PSpice Tutorial
1.
2.
3.
4.
5.
Opening PSpice
Drawing the circuit
Probe
Analysis Menu
Libraries & Types of Sources
4) Analysis Menu
a) Time Domain /Transient Analysis
b) DC Sweep Analysis
c) AC Sweep/ Noise Analysis
d) Bias Point Analysis
4) Analysis Menu
Transient Analysis
R1
Vin
Vout
{Rv al}
V1 = -5
V2 = 5
TD = 0
TR = 0.1u
TF = 0.1u
PW = 25u
PER = 50u
Vin
C1
1n
0PARAMETERS:
Rv al
5.0V
0V
-5.0V
0s
50us
V(Vout)
Time
100us
4) Analysis Menu
DC Sweep Analysis
The DC sweep allows you to do various different
sweeps of your circuit to see how it responds to
various conditions. For all the possible sweeps:
1.





Voltage
Current
Temperature
Parameter
Global
2. You need to specify a start value, an end value, and
the number of points you wish to calculate.
4) Analysis Menu
5.0V
DC Sweep Analysis
2.5V
0V
0V
2.5V
5.0V
V(Vout)
V_Vin
Vin
5Vdc
4) Analysis Menu
DC Sweep Analysis
Temperature
Id
Vds
1.2Vdc
M1
Mbreakn
Vgs
1.2Vdc
L = 0.13um
W = 1.3um
0
1.000uA
0.875uA
0 C
100 C
0.750uA
50 C
0.625uA
0.500uA
150mV
200mV
ID(M1)
250mV
V_Vgs
300mV
350mV
4) Analysis Menu
AC Sweep/Noise Analysis
It allows you to plot magnitude versus frequency for
different inputs in your circuit.
2. In the AC sweep menu you have the choice of three types
of analysis:
1.



Linear
Octave
Decade
These three choices describe the X-axis scaling which will
be produced in probe.
4. For example, if you choose decade then a sample of your
X-axis might be 10Hz, 1kHz, 100kHz, 10MHz, etc....
5. Therefore if you want to see how your circuit reacts over a
very large range of frequencies choose the decade option.
3.
4) Analysis Menu
AC Sweep/Noise Analysis
50
4) Analysis Menu
AC Sweep/ Noise Analysis

To display a gain, |Av|:
PSpice > Markers > Advance >
dB Magnitude of Voltage

To display a phase :
f-3dB = 57.597 kHz
Av = 29.948 dB
0
-50
SEL>>
-100
DB(V(VOUT))
-0d
PSpice > Markers > Advance >
Phase of Voltage
GAIN = 0.5
-50d
(1.8102M,-87.172)
-100d
E3
d
+
-
d
Vin
+
-
-150d
E
1Vac
0Vdc
Phase Margin
INP
5.3936 G
0
0 0Vdc
Vcm
10Hz 100Hz
10KHz
P(V(VOUT))
E4
d
+
-
+
-
INN
E
0
0 GAIN = 0.5
1.0MHz
Frequency
100MHz
10GHz
4) Analysis Menu
Bias Point Analysis
 Analysis type: Bias Point > Output Files
Introduction to PSpice Tutorial
1.
2.
3.
4.
5.
Opening PSpice
Drawing the circuit
Probe
Analysis Menu
Libraries & Types of Sources
5) Libraries & Types of Sources:
5) Libraries
10 Basic Libraries :
Analog, Source, Design
Cache, Op Amp, Eval, Gate,
Special, Breakout etc
1.
5) Types of Sources: Voltage sources
Place Part (P) > add Library > Source > Open
a)
VPULSE
V1 = -5
V2 = 5
TD = 0
TR = 0.1u
TF = 0.1u
PW = 25u
PER = 50u
Vpulse
5.0V
0V
-5.0V
0s
20us
40us
60us
V(Vin)
Time
8.0V
b)
VDC
Vdc
6.0V
5Vdc
4.0V
2.0V
0s
50us
V(Vin)
100us
5) Types of Sources: Voltage source
c)
VPWL
5.0V
VPWL
2.5V
0V
0s
2.0us
4.0us
6.0us 7.5us
V(Vin)
Time
d)
VSIN
5.0V
Vsin
VOFF = 0
VAMPL = 5
FREQ = 100k
0V
-5.0V
0s
5us
10us
V(Vin)
Time
15us
20us
5) Types of Sources: Current sources
Idc
0Adc
I1 =
I2 =
TD =
TR =
TF =
PW =
PER =
Ipulse
Isin
IOFF =
IAMPL =
FREQ =
Iac
1Aac
0Adc
Ipwl
5) Types of Sources: Negative Source (Ground)
0
Finish…
PSpice
Tutorial
Tutorial 1: RC Circuit DC Sweep Analysis
R1
Vin
Vout
1k
V
Vin
5Vdc
C1
1n
0
5.0V
2.5V
0V
0V
2.5V
V(Vout)
V_Vin
5.0V
Tutorial 2: Using Netlist to simulate
Open PSpice AD Lite > File > New > Text File
2. Write down the netlist file:
1.
EXERCISE1.CIR
*
Vpulse
1 0 PULSE(1 0 1ns 1ns 1ns 0.5us 1us)
Rres 1 2 50ohm
Cpulse
2 0 1nf
.TRAN 10ns 1us
.probe
.end
3. Save as EXERCISE1.CIR, run the circuit.
Tutorial 2: Understand the
coding/netlist
EXERCISE1.CIR
*
Vpulse
1
Rres
1
Cpulse
2
.TRAN 10ns 1us
.probe
.end
0
2
0
PULSE(1 0 1ns 1ns 1ns 0.5us 1us)
50ohm
1nf
Rres
1
2
50
V1 = 1
V2 = 0
TD = 1ns
TR = 1ns
TF = 1ns
PW = 0.5us
PER = 1us
VPulse
Cpulse
1n
0
Tutorial 2: Using Netlist to simulate
Open PSpice AD Lite > File > New > Text File
2. Write down the netlist file:
1.
EXERCISE1.CIR
*
Vpulse
1 0 PULSE(1 0 1ns 1ns 1ns 0.5us 1us)
Rres 1 2 50ohm
Cpulse
2 0 1nf
.TRAN 10ns 1us
.probe
.end
3. Save as EXERCISE1.CIR, run the circuit.
Tutorial 2: Using Netlist to simulate
4. Trace > Add Trace ..or.. Press ‘Insert’ button
Tutorial 2: Using Netlist to simulate
5. Select V(2) > OK
Tutorial 2: Using Netlist to simulate
6. Plot > Add Plot to Window >
Tutorial 2: Using Netlist to simulate
7. Press Insert ..or.. Add Trace > Select V(1)
Tutorial 3: RC Circuit
5.0V
R1
Vin
V1 = -5
V2 = 5
TD = 0
TR = 0
TF = 0
PW = 25u
PER = 50u
Vout
{Rv al}
0V
SEL>>
-6.0V
V1
V(Vin)
C1
1n5.0V
0V
0
-5.0V
0s
50us
V(Vout)
Time
100us
6.0V
(25.253u,4.0025)
(52.394u,4.0025)
4.0V
0V
(27.494u,-4.0025)
(50.153u,-4.0025)
-4.0V
-6.0V
0s
20us
40us
60us
V(Vout)
Time
80us
100us
Tutorial 4: RC Circuit Parameter Sweep
 Place Part > Special > PARAM > New Row > Name:
Rval > Value : 1k > display
 Double click R1 value > change to {Rval}
 Transient > parameter sweep > Global Parameter >
Name: Rval > Sweep from 1k to 5k increment 1k
5.0V
R1
Vin
Vout
{Rv al}
V1 = -5
V2 = 5
TD = 0
TR = 0.1u
TF = 0.1u
PW = 25u
PER = 50u
Vin
C1
1n
0V
-5.0V
0
0s
50us
V(Vout)
Time
100us
5.0V
1k
5k
0V
5k
1k
-5.0V
0s
20us
V(Vout)
40us
60us
Time
80us
100us
Tutorial 5: RC Circuit Vsin supply input
5.0V
R1
Vin
Vout
{Rv al}
Vsin
VOFF = 0
VAMPL = 5
FREQ = 20k
C1 0V
1n
0
-5.0V
0s
V(Vout)
20us
V(Vin)
40us
60us
Time
80us
100us
Tutorial 6: RLC Circuit AC Sweep
Vout
1
Iac
1Aac
0Adc
R1
{Rv al}
2
0
L1
10nH
C1
10p
60
50
40
30
400MHz
440MHz
DB(V(Vout))
480MHz
520MHz
Frequency
560MHz
600MHz
Tutorial 7: RLC circuit
Another way to display the gain
 To display a gain, |Av|: PSpice > Markers > Advance > dB
Magnitude of Voltage
 To display a phase : PSpice > Markers > Advance >
Phase of Voltage
Vout
1
Iac
1Aac
0Adc
R1
{Rv al}
2
0
L1
10nH
VDB
C1
10p
Tutorial 8: CMOS Inverter
Vdd
Vdd
Vdd
V1
V1
5Vdc
5Vdc
MbreakP
0
Vout
V1 = 0
V2 =V 5
TD = 0
TR = 0.1u
TF = 0.1u
PW = 25u
PER = 50u
M2
0
Vin
Vpulse
Vout
V
0
M1
V
MbreakN
0
5.0V
2.5V
SEL>>
0V
V(VIN)
5.0V
2.5V
0V
0s
20us
40us
60us
V(VOUT)
Time
80us
100us
Tutorial 9: CMOS Inverter
Using Hierarchical Block
 Save all > New Schematic > Schematic Name : Inverter
>New Page (right click) > Page name : Inverter
 Rename Schematic  Internal,
 Rename PAGE1  Internal
Tutorial 9: contd..
 Make sure both of your page is correct
Tutorial 9: contd..
 Save the design > right click on schematic: inverter >
make as a root
Tutorial 9: contd..
 In Page: Internal > Place Hierarchical Port connector
to input and output inverter > Name: Vi, Vo > save
Tutorial 9: contd..
Tutorial 9: contd..
 In Page: Inverter > Place hierarchical Block >
internal
Vinput
V1 = 0
V2 = 5
TD = 0
TR = 0.1u
TF = 0.1u
PW = 25u
PER = 50u
Vi
Vpulse
internal
0
Vo
Voutput
5.0V
2.5V
SEL>>
0V
V(Vinput)
5.0V
2.5V
0V
0s
40us
80us
120us
V(Voutput)
Time
160us
200us
Tutorial 10: Integrator Op Amp
C1
1u
-
0
4
0.7Vdc
1Aac
0Adc
C1
OS1
4
0
V-
3
1u
-
OUT
+ 7
U2
OS2
V+
6
OUT
Iac
0
+ 7
U2
Vout
5
OS2
V+
V2
+
0.7Vdc
+
V1
1
0.7Vdc
6
V1
1
OS1
1k
uA741
2
-
3
uA741
2
-
V-
R1
Vin
+
-
Vout
5
V2
+
0.7Vdc
-
0
0
120
100
80
60
1.0Hz
10Hz
ABS(DB(V(Vout)/V(Vin)))
100Hz
Frequency
1.0KHz
10KHz
Download