How to make a crisp square wave in LTSpice?

Feb 29, 2008 11 Replies

Hi - this seems like a simple thing... but I can't figure it out. I made a voltage source in LTSpice, set it to: PULSE(0V 5V 0 0ms 0ms



500ms 1000ms 2). However, rise and fall times seem to be about 50ms when driving a 1K load. I don't know how to make sense of this. Messing around with it, it seems to adjust the rise and fall times to have some sort of relationship with the period of the square wave. I just want a perfect square wave with infinite slew rate. Anybody know what I'm doing wrong?

Thanks!


-Michael


It seems that if you set the rise and fall times too slow, they default to something silly. So set them to 1n and all is well.

That's not an LTSpice problem specifically...you're giving it regularly spaced time samples of a square wave, and it's drawing straight lines between points. A 'crisp square wave' requires infinite time resolution. For plots, one justs adds points for the tops and bottoms of the cliffs, but SPICE won't like it if you try to make a voltage have two different values at the same time.

Cheers,

Phil Hobbs

I think you meant too fast, not too slow. Anyways - that was correct. Apparently if you set rise and fall times to 0 then it defaults to something like 5% of the period. I set it to 1us and now it works perfectly. It seems like a warning should be generated for this... I mean it is not exactly obvious. At least to me.

-Michael

Hi Phil - that was one of my first thoughts as well, but it didn't work. Anyways - Paul was dead on. Setting rise and fall times to something very small but greater than zero fixed the problem.

-Michael

"Michael" schrieb im Newsbeitrag news: snipped-for-privacy@28g2000hsw.googlegroups.com...

Hello Michael,

If you specify 0 for Trise or Tfall, LTspice will use a value of 10% of Ton or Toff whichever is smaller.

You have to specify a small number for Trise and Tfall.

PULSE(0 5 0 1n 1n 500m 1)

Best regards, Helmut

It's going to be a long, long, LONG list enumerating all the things that are not obvious to you.

Hi Phil - that was one of my first thoughts as well, but it didn't work. Anyways - Paul was dead on. Setting rise and fall times to something very small but greater than zero fixed the problem.

-Michael

It's a common sense, where in the world can any one find a rising time of ZERO?

Ah... I know, in the bastard mind who went to war in Iraq.

I played about with it a bit and found that .1p works but not .01p. What is the actual time resolution?

Hello Paul,

There is a limit in the ratio of about 1e12 between rise/fall time and the time span specified in .TRAN. I don't know the progam code, but that's my experience.

I never had a problem with that. A simulation over 1 sec with picosecond rise times would be nonsense at all in my opinion.

Best regards, Helmut

It would give you time for a movie followed by dinner and drinks ;-)

...Jim Thompson

| James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | | http://www.analog-innovations.com | 1962 | America: Land of the Free, Because of the Brave

There are both pulse sources and piecewise linear sources. Use whichever works best for you.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required