¿ªÔÆÌåÓý

using LTSPICE symbols for representation of spice netlist of OPAMP


 

Hello, In ltspice there are many modles and I like to use the standart symbols to represent the model.
When I create model from a netlist at worst I use a recrangle with pins? and at best I try to draw opamp by myselse and? the result genrally is not looking good.
Is there a way to plug somehow the attached CIR file to standart LTSPICE symbol.
(in AD797 they also have extra decompensation pin)
What could be done ??
Thanks.
?
/g/LTspice/files/Temp/ad797.cir


 

Yes, you can take a standard symbol, edit the attributes, and save it as a "new" *.asy file. Easy peasy.


 

On Fri, Feb 21, 2025 at 09:03 AM, john23 wrote:
Is there a way to plug somehow the attached CIR file to standart LTSPICE symbol.
(in AD797 they also have extra decompensation pin)
What could be done ??
No you can't use the normal op-amp symbol directly, because of that extra pin.? The normal op-amp symbol is "opamp2", and it works for the majority of op-amps.? But not this one.
?
Here is something to consider doing.? Make a copy of the opamp2 symbol.? Then edit that symbol (in LTspice's symbol editor) to add the extra decompensation pin, and save the symbol with a new name, in your own symbol library.
?
Alternatively, start searching through the vast numbers of Analog Devices op-amps that come with LTspice, until you find another one that has an extra pin but still looks like an op-amp.? Make yourself a copy of that one.
?
If you know that you will never use the decompensation pin, there is another alternative:? Wrap a 5-pin subcircuit around the Analog Devices AD797 model, and don't bring that extra pin out to the outer subcircuit.? Now you have a 5-pin subcircuit, which CAN be used with the built-in "opamp2" symbol.
?
.SUBCKT MyAD797 In+ In- V+ V- Out
X? In+ In- V+ V- Out Decomp? AD797
.LIB AD797.cir
.ENDS MyAD797
?
Andy
?


 

Also, there is this:
?
If you can draw a schematic, then you can draw a symbol.? Don't be afraid to make a brand new symbol.? Taking the "easy way out" by only auto-generating symbols, demonstrates laziness.? Don't be "that person" who is too lazy to try to do better.
?
Andy
?
?


 

Hello Andy , very intresting Idea .Indeed I will keep the decomp pin open.
I am used to start with the netlist and generating a symbol automatickly.
How do I involve the opamp2 symbol into the symbol menu window shown below?
?
/g/LTspice/photo/294510/3888971?p=Created%2C%2C%2C20%2C2%2C0%2C0
?


 

On Fri, Feb 21, 2025 at 10:30 AM, john23 wrote:
How do I involve the opamp2 symbol into the symbol menu window shown below?
?
I'm sorry, but that question does not make sense.
?
The photo does not show a symbol menu.? It is a photo of your auto-generated symbol.? If you want to not use the auto-generated symbol, then do not add it to your schematic.? If it is on your schematic already, delete it from the schematic.
?
Add the opamp2 symbol to your schematic.? Edit the name next to it, from "opamp2", to the name you use for your "wrapper" subcircuit (the one that "wraps around" the actual AD797).? I used "MyAD797" in the example I showed previously.? Also get the netlist of that "wrapper" subcircuit into your simulation - either paste it directly onto the schematic (as a SPICE Directive), or include it as an .INCluded file.
?
Andy
?


 

Hello Andy , I am trying to implement the method you reccomended.
I have added the OPAMP2 symbol and made the include command for the ad797.cir file.
then I tried to added the spice directive script? for a wrapper but I got and error.
It says U1:22 uknown circuit node.
Where did I go wrong?
Ltspice files and error massage are attached in the ZIP.?
.SUBCKT MyAD797 In+ In- V+ V- Out
X? In+ In- V+ V- Out Decomp? AD797
.LIB AD797.cir
.ENDS MyAD797
?
?
/g/LTspice/files/Temp/22_02_25.zip


 

john23,
?
Apparently, LTspice incorrectly processes the AD797 model file.? I don't understand why it did that, but here is how to fix it.
?
Change from this:
.SUBCKT MyAD797 In+ In- V+ V- Out
X? In+ In- V+ V- Out Decomp? AD797
.LIB AD797.cir
.ENDS MyAD797
to this:
.SUBCKT MyAD797 In+ In- V+ V- Out
X ?In+ In- V+ V- Out Decomp ?AD797
.ENDS MyAD797
.LIB AD797.cir
?
By the way, you uploaded the wrong schematic.? The schematic you simulated is not the one you uploaded.
?
Andy
?
?
?


 

Hello Andy,I did what you said it still gives a netlist bug which says pin mismatch.
Ltspice file and the errotr is attached.
Where did I go wrong?
?
/g/LTspice/files/Temp/ad797_cir.zip


 

Hello Andy,I managed to do it as shown in the attached file.
added the whole netlist as a directive and deleted the last pin number of the title.
Is it Ok?
?
Thanks.
?
/g/LTspice/files/Temp/op-amp%20AD797%20%281%29.asc


 
Edited

On Sun, Feb 23, 2025 at 12:42 PM, john23 wrote:
Hello Andy,I did what you said it still gives a netlist bug which says pin mismatch.
Ltspice file and the errotr is attached.
Where did I go wrong?
You did not follow what I said to do.
?
What was the point of creating a subcircuit named "MyAD797", if you did not even bother to use that subcircuit?
?
The subcircuit you created (as a "wrapper" around ADI's AD797 model) is named "MyAD797".? Therefore, change the name next to the opamp2 symbol, to that exact name.? You want your opamp2 symbol to call the MyAD797 subcircuit that you created.
?
I wrote that already in message 158621, did I not?? Carefully read those instructions again, and follow what I wrote.
?
Also, get rid of the command ".include ad797.cir" that you added to your schematic which should not be there.
?
Andy
?


 

On Sun, Feb 23, 2025 at 02:24 PM, john23 wrote:
Hello Andy,I managed to do it as shown in the attached file.
added the whole netlist as a directive and deleted the last pin number of the title.
Is it Ok?
That works too.
?
I was trying to make it work without modifying the original AD797 SPICE model.? Sometimes, IC manufacturers get really picky about altering their SPICE models, and I wanted to avoid that.? It does indeed make your simulation function - although the schematic looks awful when opened in LTspice, because it scales to fit the text.
?
When you downloaded the AD797 SPICE model, you agreed that you "may modify this SPICE Model to suit Your specific applications,", so apparently they do not mind you modifying it this way for your own use.? But you are prohibited from making this change to the model and then distributing a copy of the modified model to anyone else.? The change you made alters the function of the model.? That is prohibited by the License Agreement that you agreed to when you downloaded it from Analog Devices.
?
Also, remember that you did alter it, and if you come back to your simulation some 10 years from now, remember that it is a modified SPICE model.? It helps to add a Comment note to the schematic, saying that it's been altered.? 10 years from now, if you tried to update the AD797 model it contains, it won't work unless you modify it again.? That was another reason why I preferred to put a "wrapper" subcircuit around the original model instead of modifying it.
?
Andy
?


 

john23,
?
I uploaded AD797_Opamp2.zip to the Temp folder.? It shows the opamp2 symbol, applied to the "MyAD797" (wrapper) subcircuit.
?
Andy
?


 

Hello Andy,you define a subcircuit called MyAD797 with 5 pins.
inside the SUBCKT command you define X.
If I understand correctly X is an instance of AD797 subckt.
X has 6 pins
How does X connects to the MyAD797?
Thanks.
.SUBCKT MyAD797 In+ In- V+ V- Out
X ?In+ In- V+ V- Out Decomp ?AD797


 

On Mon, Feb 24, 2025 at 05:44 AM, john23 wrote:
Hello Andy,you define a subcircuit called MyAD797 with 5 pins.
inside the SUBCKT command you define X.
If I understand correctly X is an instance of AD797 subckt.
X has 6 pins
How does X connects to the MyAD797?
It just does!? The 5 listed pins connect to the MyAD797.? The 6th pin does not; it remains internal.
?
This is how subcircuits work.? The .SUBCKT command defines the name of the subcircuit and its external pins.? The contents of the subcircuit typically contain many more nodes than the few that are called out as pins on the .SUBCKT command.
?
It is not unusual for a subcircuit to have dozens or hundreds of nodes, but only a few of them are listed on the .SUBCKT command.? All the ones that are not listed on the .SUBCKT command are internal to the subcircuit and are effectively not seen by the external circuit when you call or use the subcircuit with its X-element instance.
?
Look at any op-amp's subcircuit and you will see what I mean.? Take the AD797's subcircuit.? It has internal nodenames 1, 2, 98, 31, 44, 47, 9, 22, 5, 4, ... and I could go on and on for several more.? But its .SUBCKT command lists only these six: 1, 2, 99, 50, 38, and 14.? The rest of the nodes are internal to its subcircuit.
?
Please read up about how .SUBCKTs work in SPICE.? LTspice's Help description is rather inadequate for that, I am afraid, and assumes that the reader has a basic understanding about SPICE subcircuits.
?
Andy
?