How to make a crisp square wave in LTSpice?

M

Michael

Jan 1, 1970
0
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
 
P

Paul Burke

Jan 1, 1970
0
Michael said:
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?

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.
 
P

Phil Hobbs

Jan 1, 1970
0
Michael said:
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

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
 
M

Michael

Jan 1, 1970
0
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.

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
 
M

Michael

Jan 1, 1970
0
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

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
 
H

Helmut Sennewald

Jan 1, 1970
0
Michael said:
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

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
 
F

Fred Bloggs

Jan 1, 1970
0
Michael said:
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

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

MooseFET

Jan 1, 1970
0
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

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.
 
P

Paul Burke

Jan 1, 1970
0
Helmut said:
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)

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

Helmut Sennewald

Jan 1, 1970
0
Paul Burke said:
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
 
J

Jim Thompson

Jan 1, 1970
0
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
 
J

JosephKK

Jan 1, 1970
0
Phil said:
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

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