¿ªÔÆÌåÓý


Re: Using Op Amp as comparator

 

On Fri, May 2, 2025 at 05:29 PM, Macrohenry wrote:
Forgot to mention, in the transient analysis, the stop time is .002, so the graph displays two cycles.
I recommend not using numbers like ".002".? Leading decimal points are easily missed.? To my old eyes, it looked like you wrote "002" - until I squinted.
?
Instead, use one of these:
  • 0.002
  • 2m
  • 2msec
  • 2ms
  • 2e-3
?
Some companies who have documentation standards even insist that people never use numbers such as ".002".
?
(On the other hand, there are others who insist on omitting a leading "0" when there is one, thus encouraging people to write ".002", to the dismay of others who have greater sense.)
?
Andy
?


Re: Using Op Amp as comparator

 

On Fri, May 2, 2025 at 05:25 PM, Macrohenry wrote:
However, substituting the MAX9095 for Universal Op Amp 2 still outputs a straight line, regardless of what the negative power terminal is connected to.? I chose the MAX9095 from the comparator list.? That makes me think I shouldn't need to include a library.? Is that what might be missing?
(1)? You do not need to add a library file.? It is included when you use its symbol.
?
(2)? I just tried it, and it works great for me!
?
So, what did you do wrong, that makes your simulation fail?? Since you didn't show us (by uploading your *.ASC schematic), we can't tell.
?
I would caution you, that if you used the same +/- 12 V power supplies with it, that is likely to be a problem, and might be the problem.? That part is rated for an Absolute Maximum voltage of Vdd-Vss = 6 V, and applying Vdd-Vss = 24 V greatly exceeds that and probably "lets out the magic smoke" and the chip vaporizes.? Many SPICE simulations would work even with that, but this one might not because it is so far beyond spec.
?
Also, you must remember to include an output pull-up resistor.? The MAX9095 has open-drain outputs.? They do not pull themselves high; they only actively pull low.
?
Always read the datasheet.
?
Andy
?


Re: Using Op Amp as comparator

 

¿ªÔÆÌåÓý

The 9095 is a quad. Are you using all four units or what? Why not upload your .ASC, so we can see what you are doing?

On 2025-05-02 22:50, Macrohenry via groups.io wrote:
FWIW, the LT1017 comparator also works with simple substitution.? I have what I need for now, although I'm curious why the MAX9095 doesn't work.
--
Best wishes John Woodgate RAYLEIGH Essex OOO-Own Opinions Only If something is true: * as far as we know - it's science *for certain - it's mathematics *unquestionably - it's religion

Virus-free.


Re: Using Op Amp as comparator

 

FWIW, the LT1017 comparator also works with simple substitution.? I have what I need for now, although I'm curious why the MAX9095 doesn't work.


Re: Using Op Amp as comparator

 

Forgot to mention, in the transient analysis, the stop time is .002, so the graph displays two cycles.


Re: Using Op Amp as comparator

 

SUCCESS!? Thanks, guys, I got it working with Universal Op Amp 2.?? It's working as it should.
?
I'm using simple transient analysis.?? The whole circuit consist of? one op amp and three voltage sources:? Supply is += 12V, Sine is 6 V 1000 Hz, reference is 3 VDC.? Simple and clean as I know how to make things.
?
As hoped and expected, Universal Op Amp 2 outputs a square wave triggered at the intersections of the sine wave and DC reference voltage. Square wave is 0-12 V when the op amp negative power supply is grounded, and it's -12 to +12 V when the op amp negative power supply is -12 V.??
?
However, substituting the MAX9095 for Universal Op Amp 2 still outputs a straight line, regardless of what the negative power terminal is connected to.? I chose the MAX9095 from the comparator list.? That makes me think I shouldn't need to include a library.? Is that what might be missing?


Re: Vin vs. Load - YX logarithmic plot

 

¿ªÔÆÌåÓý

I find that in many cases, the plotted variable does reach very small values, which are of no significance or interest, but Autorange accommodates them, as it should, having no 'knowledge' of which values are significant. The same occasionally applies to initial very large values, such as inrush current.

On 2025-05-02 21:18, Bell, Dave via groups.io wrote:

¡°If I immediately right-click in the plot pane and select "Autorange Y-axis", it usually fixes that problem¡±

Begging the question of why that *¾±²õ²Ô¡¯³Ù* the Automatic default!

?

?

From: [email protected] <[email protected]> On Behalf Of Andy I via groups.io
Sent: Friday, May 02, 2025 10:51 AM
To: [email protected]
Subject: EXTERNAL: Re: [LTspice] Vin vs. Load - YX logarithmic plot

?

On Fri, May 2, 2025 at 10:30 AM, <rick_church@...> wrote:

The plot window will give you the chance to scale the axes logarithmically.? ...

I want to add this note:? Usually when I change the Y-axis from linear to log, LTspice scales the Y-axis so that it?covers too much range (too many decades), making it a less useful plot.? If I immediately right-click in the plot pane and select "Autorange Y-axis", it usually fixes that problem.

?

If the Y-axis waveform includes negative values, then it might still be scaled with too much range to be helpful.? In that case, right-click on the Y-axis and set a new value for the Bottom, so that the displayed plot does not cover so wide a range.

?

Andy

?

--
Best wishes John Woodgate RAYLEIGH Essex OOO-Own Opinions Only If something is true: * as far as we know - it's science *for certain - it's mathematics *unquestionably - it's religion

Virus-free.


Re: Vin vs. Load - YX logarithmic plot

 

¿ªÔÆÌåÓý

¡°If I immediately right-click in the plot pane and select "Autorange Y-axis", it usually fixes that problem¡±

Begging the question of why that *¾±²õ²Ô¡¯³Ù* the Automatic default!

?

?

From: [email protected] <[email protected]> On Behalf Of Andy I via groups.io
Sent: Friday, May 02, 2025 10:51 AM
To: [email protected]
Subject: EXTERNAL: Re: [LTspice] Vin vs. Load - YX logarithmic plot

?

On Fri, May 2, 2025 at 10:30 AM, <rick_church@...> wrote:

The plot window will give you the chance to scale the axes logarithmically.? ...

I want to add this note:? Usually when I change the Y-axis from linear to log, LTspice scales the Y-axis so that it?covers too much range (too many decades), making it a less useful plot.? If I immediately right-click in the plot pane and select "Autorange Y-axis", it usually fixes that problem.

?

If the Y-axis waveform includes negative values, then it might still be scaled with too much range to be helpful.? In that case, right-click on the Y-axis and set a new value for the Bottom, so that the displayed plot does not cover so wide a range.

?

Andy

?


Re: Possible g;itch in stepping parameters

 

On Fri, May 2, 2025 at 11:34 AM, <mhx@...> wrote:
E_ABMGATE ? ?YINT 0 VALUE { { IF(V(A) > { VTHRESH } ?& V(B) > { VTHRESH },{ VDD },{ VSS } ) } }
The above illustrates why '{{' instead of '{' could matter, ...
For the life of me, I can not understand the purpose of "{{", no matter how hard I try.
?
I get it if the formula was something like this: "... { { thing1 } + thing2 } ...".
?
I do not understand when the formula uses: "... { { thing1 } } ...".
?
What that seems to be saying is this:
  1. Evaluate "{ thing1 }" and replace "{ thing1 }" with its numerical value.? Let's say it evaluates to 4.72.
  2. Evaluate "{ 4.72 }" and replace it with its numerical value.
Huh?? What is the meaning of { 4.72 }?? Since 4.72 is already a number and is guaranteed to be a number and only a number, there is no purpose of trying to evaluate it a second time as if it were an expression and find its numerical value.? You already have it.? In fact it's kind of an error to try.? (Like pointer redirection applied too many times?)
?
Can someone explain to me the meaning or purpose of "{ { thing1 } }", as it relates to LTspice?
?
Re: text substitution - that is something I much prefer to avoid.? It is too much of a grey area, a "can of worms".? As I understand it, the .text directive did text substitution, but nothing else actually did.? But I might be wrong about it.
?
Andy
?
?


Re: .savestate directive no longer works

 

On Thu, May 1, 2025 at 02:52 PM, bwolfe58 wrote:
Now, when I try to run any transient simulation I get this error "argument not found"
This is a good catch. From the posting in EZ, I was able to reproduce the problem. It appears that if you have "Generate Expanded Listing" ON and you use .savestate, you will see this error message in the log, but there is no real error in simulation. In fact, the generate expanded listing from a standard netlist also produces a file simply containing just the text: "argument not found". That is the error¡ª the expanded listing doesn't produce anything; whereas, simulation and .savestate work properly.
?
This has been fixed and should appear in a future release (24.1.9). For now, if you do want an expanded listing, don't use savestate, and vice versa.
?
--
Michael Stokowski
LTspice Team
Analog Devices Inc.


Re: Possible g;itch in stepping parameters

 

On Fri, May 2, 2025 at 02:02 PM, <mhx@...> wrote:
is evaluated as if it had been written as (aa + bb) & V(B)
How can your be sure that that was the intention?
I think it is clear - to me at least - that it is the intention, and the only thing that makes sense.? If you started with
VTHRESH & V(B)
with or without curly braces anywhere in there, it seems clear that you want to get the logical AND of something called VTHRESH and the boolean version of voltage V(B).? ?Whether or not VTHRESH has an expression behind it, that should make no difference.? You can not evaluate the AND operation until you know what VTHRESH is, and that means evaluating its formula and turning it into a numerical value.? It makes no sense whatsoever to apply the AND operation to only a portion of what makes up VTHRESH.
?
Therefore, there is an implicit order of operations like this:
( VTHRESH ) & V(B)
no matter whether you wrote VTHRESH or {VTHRESH} and no matter if there was a formula that defines VTHRESH.? The AND operation can only be applied to VTHRESH, not to ESH while omitting VTHR.? ?:-)
?
Andy
?
?
?


Re: Using Op Amp as comparator

 

On Fri, May 2, 2025 at 01:55 PM, Macrohenry wrote:
When I use the Universal Op Amp or Universal Op Amp 1 as a comparator, the output chart changes from V to MV.? ...
Which op-amp did you use?
?
LTspice's "opamp" is an unbounded ideal op-amp.? In the absence of feedback, its outputs could become indefinitely large, either positive or negative.? Perhaps they reach only 1 MegV because of the input signal amplitude combined with the finite voltage gain.
?
Please read the information that comes up with LTspice's UniversalOpAmp1 when you select it.? It says this:
A linear, single pole op amp with no
internal nodes or output voltage range
limit. ...
It seems it is behaving exactly as expected.? It has nothing to limit its output voltage range, so it reaches a value determined by the input differential voltage and the open-loop voltage gain.
?
UniversalOpAmp1 is not a good choice.? I regret that Analog Devices left it there as a choice.? If I remember correctly, UniversalOpAmp2 was the only one that had been listed in the parts selector, and it was a better choice.? The others could be selected as an override, but #2 was the better one to start with.
?
For the life of me, I can't get the comparator to work.?
Use a better one!? Such as UniversalOpAmp2.
?
When I try the MAX9095 comparator, the display is not in MV, but the comparator output is a straight DC line.
Seems like it is not working.? Maybe you did something wrong.
?
Andy


Re: Using Op Amp as comparator

 

In message <[email protected]>, Macrohenry via groups.io <macrohenry@...> writes
When I use the Universal Op Amp or Universal Op Amp 1 as a
comparator, the output chart changes from V to MV.? Here are the
parameters:
?
Positive supply 12 V
Negative supply -12 V or GND
Reference voltage 3 VDC
Input Voltage 6 V 1000 Hz sine
?
For the life of me, I can't get the comparator to work.? When I try the
MAX9095 comparator, the display is not in MV, but the comparator output
is a straight DC line.
?
Why does LTspice change the chart to MV using the Universal Op Amps?
With the MAX9095, why doesn't the output change at the transitions when
the sine wave crosses the fixed voltage??? THANKS.
Universal Opamp and Opamp 1 don't respect the power rails so the O/P will scale appropriately to large voltages . Try Universal Opamp 2

The macromodels use voltage controlled current sources etc. Some manufacturers do this sort of thing with their models leading to some odd behaviours at times.

Brian
--
Brian Howie


Re: Using Op Amp as comparator

 

Your description sounds confusing. You say 6V 1000Hz Sine wave, suggesting to me that you are running a ".AC"? analysis which is a "small signal" AC analysis, so you wont get an "output" which is a 1000Hz square wave, the op-amp will approximate the output to be "0" would it not?? or 3V... If you want to simulate a "comparator" function and show it switching at 3V, then you can use a transient (.TR) analysis to do it at a specific speed, eg 1 or 2 cycles of a "sine wave" or a triangluar wave, Or you can see the precise DC (.DC) response using a input voltage varying from say 2.5 to 3.5 or bigger and the opamp output should change as it crosses the 3V reference level...?
?
?????
?
?


Re: Crystal oscillator oscillation startup

 

I do not see a crystal on the schematic photo you uploaded (/g/LTspice/photo/302220/3911530).
?
I wonder if that schematic is supposed to be just the on-chip part of a circuit, where you are supposed to connect a crystal externally, perhaps to the "Q1" and "Q2" pins.? But I think you have not done that.? Without a crystal connected, it might never oscillate.
?
The other two screenshots you uploaded show somewhat small time scales.? You may need to start with simulations lasting hundreds of seconds or more, until you get something to happen.? In one of the photos, a voltage or a current is still changing even at 10 seconds, so clearly the circuit has not stabilized yet.? This does not mean that it will start oscillating if allowed to run longer, but it is possible.? If waveforms are still changing up to the end of your simulation, you have not waited long enough.
?
In this case, I suspect that "waiting long enough" will not fix it.? I suspect the missing crystal is a critical deficiency.
?
Andy
?


Re: Crystal oscillator oscillation startup

 

On Fri, May 2, 2025 at 12:59 PM, Cheng Fei Phung wrote:
The upside-down issue is due to how mosfet_018.lib had been defined, please note that both PM and NM from this lib file had been verified previously.

In that photograph, which is a picture of a schematic drawn in a different program (not LTspice), it shows that the N-channel Source pins are lower down on the page.? ?That differs from how you drew them in LTspice.? In your schematic, the N-channel MOSFET Source pins are higher up.? They are indeed backwards (upside-down) compared to the schematic you tried to replicate.
?
In LTspice's version of the MOSFET symbol, the Source pin is the one horizontally adjacent to the Gate pin, for both N and P channel types.
?
With LTspice's version of the MOSFET symbols, one normally needs to rotate the P-channel symbols to make its Source pin higher up on the schematic - assuming that your schematic has the positive supply voltage up and the negative supply voltage down.? But the N-channel symbols should not be rotated.? They are already oriented correctly.
?
It is unfortunate that there are multiple "standards" for MOSFET symbols.
?
Andy
?


Re: Possible g;itch in stepping parameters

 

is evaluated as if it had been written as (aa + bb) & V(B)
How can your be sure that that was the intention?

-marcel


Using Op Amp as comparator

 

When I use the Universal Op Amp or Universal Op Amp 1 as a comparator, the output chart changes from V to MV.? Here are the parameters:
?
Positive supply 12 V
Negative supply -12 V or GND
Reference voltage 3 VDC
Input Voltage 6 V 1000 Hz sine
?
For the life of me, I can't get the comparator to work.? When I try the MAX9095 comparator, the display is not in MV, but the comparator output is a straight DC line.
?
Why does LTspice change the chart to MV using the Universal Op Amps? With the MAX9095, why doesn't the output change at the transitions when the sine wave crosses the fixed voltage??? THANKS.


Re: Vin vs. Load - YX logarithmic plot

 

On Fri, May 2, 2025 at 10:30 AM, <rick_church@...> wrote:
The plot window will give you the chance to scale the axes logarithmically.? ...
I want to add this note:? Usually when I change the Y-axis from linear to log, LTspice scales the Y-axis so that it?covers too much range (too many decades), making it a less useful plot.? If I immediately right-click in the plot pane and select "Autorange Y-axis", it usually fixes that problem.
?
If the Y-axis waveform includes negative values, then it might still be scaled with too much range to be helpful.? In that case, right-click on the Y-axis and set a new value for the Bottom, so that the displayed plot does not cover so wide a range.
?
Andy
?


Re: Crystal oscillator oscillation startup

 

Re: the upside-down N-channel MOSFETs -
?
It should also be noted that many MOSFETs are symmetrical, where Source and Drain are electrically interchangeable.
?
Even when that is true, I think it would be wise to draw the schematic correctly, so that the symbol's Source pin is actually used as a Source pin, and not used as a Drain pin.? The way you drew it, you used the Source as the Drain, and you used the Drain as the Source.? It might not alter its performance but the schematic is incorrect in that regard.
?
I do not think there is any reason why those FETs needed to be drawn upside-down.
?
Andy
?
?