# Transient analysis of square wave using PSPICE

I need to do a transient analysis of my BJT cascode amplifier. I was asked to use VPULSE as the source. I need to set VPULSE for +-10mV, 50% duty cycle square wave at 128 kHz with rise time and fall time of 10 ns.

In PSPICE, I had set the VPULSE's attribute as

  V1=-0.01
V2 = 0.01
TR = 10ns
TF = 10ns
PW = 3.90625u
PER = 7.8125u


The transient analysis setting is

 Print Step = 10ns
Final time = 9us
No print delay = 100ns


I would like to know how can I set my 50% duty cycle and is my analysis setting correct?

My simulation result shown above.

• Thanks. How can I set 50% of duty cycle? Oct 3 '18 at 14:28
• You can't "set" it, you have to calculate all the values by hand. I converted my comment into an answer BTW. That plot is not the output of the vpulse source so not relevant here. Also, the error you made is very small, you cannot see that 10ns error you made in such a plot. Your duty cycle is 50.128% and that's so close to 50% that it is hard to see in a plot. Oct 3 '18 at 14:29
• my bad. I had changed the picture Oct 3 '18 at 14:35

What I do:

128 kHz = 7.8125us so your PER is correct.

Then I make PW = PER/2 but subtract half of the the total of the transition times: TR + TF = 20 ns => half of that = 10 ns.

So PW = 3.90625 us - 10 ns = 3.89625 us.

So make PW = 3.89625u and then you would have 128 kHz with a perfect 50% duty cycle.

Well, your pulse width is not quite right for a square wave, but it is close. If you want a square wave you have to account for the rise/fall times, so $$PW = \frac{\text{PER}}{2} - TR$$ assuming that $$\TR\$$ and $$\TF\$$ are equal, and where the variable names are the names used by SPICE (all caps, no subscripts).

Note that some simulators will require that you set the maximum timestep equal to the $$\TF/TR\$$ if you really want those rise/fall times.