LTSPICE square wave

Jan 18, 2016 44 Replies

Oh! That's even better. I wasn't aware of that! Thanks Joerg!

Jeroen Belleman

V_initial = -5 V_on = 5

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal Consultant ElectroOptical Innovations LLC Optics, Electro-optics, Photonics, Analog Electronics 160 North State Road #203 Briarcliff Manor NY 10510 hobbs at electrooptical dot net http://electrooptical.net

Ok will try

----Android NewsGroup Reader---- http://usenet.sinaapp.com/

I can't get that to work.

Version 4 SHEET 1 880 680 WIRE 80 64 48 64 WIRE 112 64 80 64 WIRE 288 64 176 64 WIRE 448 64 288 64 WIRE 48 112 48 64 WIRE 448 112 448 64 WIRE 176 128 176 64 WIRE 288 128 288 64 WIRE 48 240 48 192 WIRE 176 240 176 192 WIRE 288 240 288 208 WIRE 448 240 448 192 FLAG 48 240 0 FLAG 176 240 0 FLAG 288 240 0 FLAG 448 240 0 FLAG 80 64 VX SYMBOL ind 272 112 R0 WINDOW 0 49 30 Left 2 WINDOW 3 57 72 Left 2 SYMATTR InstName L1 SYMATTR Value 1 SYMBOL cap 160 128 R0 SYMATTR InstName C1 SYMATTR Value 1 SYMBOL voltage 48 96 R0 WINDOW 0 -79 76 Left 2 WINDOW 3 -214 117 Left 2 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V1 SYMATTR Value PULSE(10 1 2 20) SYMBOL current 448 112 R0 WINDOW 0 44 56 Left 2 WINDOW 3 9 94 Left 2 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName I1 SYMATTR Value PULSE(1 0 1) TEXT -128 113 Left 2 !.tran 25

I tried setting the value of C1 to

{v(vx)}

and

v(vx)

and Spice complains. What am I doing wrong? Does it work for resistors and not caps?

My old DOS simulator, ECA, would let you do anything.

John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

Caps need the charge specified, not C. But I had trouble getting that to work myself and we had a discussion about it here. Cranking up the time machine ... ah, here it is ... I believe you answered your own question early last year :-)

formatting link

Regards, Joerg http://www.analogconsultants.com/

add component - voltage

right click - advanced

functions - pulse

describe one full cycle and leave Ncycles blank.

All repetative AC waveforms in simulation will have an effective DC offset that is determined by the polarity of the first 180 degrees. The longer the simulation, the less this has influence. Settling time can be halved, strangely, by starting a waveform at ~90degrees, despite the non-intuitive start at a non-zero value.

RL

The q=x*expression is a special case hack for capacitors, not a general case. The only input voltage available is 'x', the voltage across the cap itself, not some other node voltage.

I tried making a resistor value depend on a voltage and Spice wouldn't let me do that. A behavioral current source could be forced to pretend to be a programmed resistor, but that's not as nice as saying that r equals (Vnn)

I can see that changing the value of a cap in real time has charge and COE issues, but a resistor doesn't.

John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

In your example you have Q=X*V(ZZ) so the capacitance is dependent on the external node voltage ZZ.

Don't use a current source, use the plain resistor.

Here is a resistor value depending in a voltage:

Version 4 SHEET 1 1036 680 WIRE 800 48 672 48 WIRE 800 64 800 48 WIRE -16 80 -16 32 WIRE 672 80 672 48 WIRE -16 192 -16 160 WIRE 672 192 672 160 WIRE 800 192 800 144 FLAG 800 192 0 FLAG -16 192 0 FLAG -16 32 X FLAG 672 192 0 SYMBOL voltage -16 64 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V1 SYMATTR Value PULSE(0.01 1 0 100m 100m 400m 1) SYMBOL res 784 48 R0 SYMATTR InstName R1 SYMATTR Value R=(V(X)) SYMBOL current 672 80 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName I1 SYMATTR Value 1 TEXT -42 280 Left 2 !.tran 3

Regards, Joerg http://www.analogconsultants.com/

Well, I do too much to remember it all.

Oh, what I kept trying was to set the value of R to V(x) or to {v(x)}, but the proper syntax is R=(v(x)).

LT Spice is vague about syntax. "Help" on R doesn't mention making it depend on something else.

That syntax doesn't work for capacitors or inductors or, as far as I can tell, anything but resistors.

John Larkin Highland Technology, Inc lunatic fringe electronics

Same here. Sometimes it takes me a long time to find something back where I am sure I simulated something similar in the last five years or so. Maybe it was stored in the brain cells that Anchor Steam wiped :-)

My most recent favorite but from tap during a long bike ride:

formatting link

Those are the not well documented traits of LTSpice. But very useful, also when modeling non-electrical phenomena.

It does but you have to formulate if for charge, not capacitance.

Regards, Joerg http://www.analogconsultants.com/

Computers are good for remembering things. If I do five things per day for 50 years, I can't remember it all myself. Some people have total recall, and it's reported to be terrible.

Most serious beer fand like hops. We don't.

Have you tried the Guinness Blonde? Tasty but not hoppy.

The two cases, R and C (or rather q) are specials.

I can always hack BV and BI to do most anything, it's just more work.

John Larkin Highland Technology, Inc lunatic fringe electronics

As Jeorg pointed out in his excellent example and since you didn't want to incur debt by thanking him for teaching you something, you parrot his help as if it was your own discovery, cheater.

He owes me at least two beers.

John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

It was actually the other way around. John taught me about ten months ago how to do this with capacitors.

Yes, I sure do. And I still have that wooden beer token if San Franciscan inflation hasn't eaten its value yet.

Regards, Joerg http://www.analogconsultants.com/

A cheap momentary diversion as opposed to a lifelong breadbasket offered in return. John Fields

It's like those Forever Stamps, a good long-term investment.

I feared that the beer craze was a fad, but it seems to have legs.

JF should drink more beer. It might cheer him up. Unless he's a mean drunk.

John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

Sometimes I can help him, sometimes he can help me. We have fun, we don't keep score, and nobody has to order engraved thank-you cards.

Next time you're in SF, have a beer with us and we'll show you how it's done.

formatting link

formatting link

John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

--- More edicts from the peanut gallery?

What a surprise...

Beer just bloats me when, using it, I've achieved my desired level of intoxication, which certainly doesn't cheer me up. I find a better head in a nice bottle of wine and, occasionally, in either Grappa or in a tasty Brandy.

Your mileage seems to have been spent on a different road.

John Fields

Wow, so you and Joerg are in cahoots? John Fields

I am in "cahoots" with some decent fraction of the people on this planet. Helpful, cheerful, generous, productive people are always welcome allies.

J and I have met, had beer, had fun. Zeitgeist, with its picnic tables under the freeway overpass, has real ambiance. Sometimes drawings stick to the tables, but that can be managed.

I've met several sed folks, and swapped private emails and parts and stuff with many more.

Generosity is its own reward. No need to demand thanks, or to keep score. I think most engineers at heart really enjoy making things work. Re the joke about the three guys on the guillotine.

John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

Join the Discussion

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

Didn't find your answer?

Ask the community — no account required