Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LT Spice

Status
Not open for further replies.
So now that i know it works i can take the r and the voltage source out and just save the diode?

There is no "diode" to save. We borrowed the generic symbol from the LTC supplied symbol library, placed an instance of it in a schematic, and them we altered just the attributes in the instance to cause it to call the text file containing the subcircuit description in the .INCLUDE statement. You can save the .ASC file containing the diode instance. You can also duplicate (copy) the instance from this schematic page to a new schematic.
 
I don't understand. Lets say i want to place this diode in a schematic for a regulator or something. I don't need the resistor or voltage source.
 
I don't understand. Lets say i want to place this diode in a schematic for a regulator or something. I don't need the resistor or voltage source.

Open the schematic (.asc) file I sent you inside LTSpice. Also, inside the same session of LTSpice, create a new schematic (or open another existing schematic) that you want to add an instance of the Zener to. Now you can go back and forth between the schematics just by clicking on their respective tabs.

Open the one I sent. Using Edit/Duplicate (or F6), drag a box around the Zener. Click on the other schematic's tab. Drag and drop the Zener where you want it. Don't forget to duplicate the .INCLUDE directive, too.

Alternatively, place a new instance of the generic Zener symbol in the new schematic. Then change the two attributes D>X, and D>PD3Z284C24, and add the .INCLUDE directive.
 
Last edited:
For MrCecil's benefit. I just tried the .INCLUDE file with NO extension, with a .TXT extension, a .FOO extension; ALL WORKED!

I tried that myself. I changed the .sub file extension for a MAX961 from .sub to .txt. You can see the error message in the attached file. That is what I was trying to get to the OP, who has acknowledged saving the file as a text file.

BOGUS?

I'm not interested in a pissing contest on this forum. If you have a personal problem with me for some reason, send me a PM so we might be able to work out any issues.
 

Attachments

  • MAX961 as Text Vice Sub file.jpg
    MAX961 as Text Vice Sub file.jpg
    115.1 KB · Views: 688
Sorry guys my fault. I'm making it harder than it is. I opened an existing schematic and stuck a diode in where i need the new one. Changed the attributes, put the test file in the sub folder as a .sub, added the .include sub and away it went.
 
I tried that myself. I changed the .sub file extension for a MAX961 from .sub to .txt. You can see the error message in the attached file. That is what I was trying to get to the OP, who has acknowledged saving the file as a text file.

So where is the .INCLUDE statement?
 
hi guys,
I have been following this thread [as a LTS user] and I find what Mike has said about the extension types and includes works OK for me.

I would also recommend that any Wanabee starting to use LTS, should start their own folder within the LTSpice folder, I named mine 'MyWork'.

For trying and debugging downloaded LTS examples, keep the downloaded set of files in its own folder and run it.
Once you are confident with the files, copy the files into the correct/associated folders in the LTS folder.
Create sub folders for different topics within the 'MyWork' folder.
 
hi ronv,
Its possible to make a quick copy/paste from one drawing to another.

A copy can be made to either a New Schematic or an Existing Schematic

Ref Fig00,
Have the two file Tabs on view

Ref Fig01,
Do a single left mouse click on the copy Icon on the top menu bar, the cursor should change to the copy Icon.

Left click on component you want to copy
or press down and hold down the left mouse button and 'lasso' the section you want to copy and release the left mouse button.

You will have a 'floating' image of the component or section copied, just ignore it for now.

Ref Fig02,
Single left click the mouse on the 'new tab', mine is called ' Draft18.asc', this will display the new window.
The floating image will now appear on the 'Draft18.asc' window
If the floating image appears too big, roll the mouse finger wheel to change its size.

A single left mouse click will Paste the floating image to the 'new' window, which can now be edited in the normal way.

When copying a component, dont forget to copy any 'includes' text for that component

When I copy in this way, I group the components and associated text before I do a copy with the 'lasso'
 

Attachments

  • Fig00.gif
    Fig00.gif
    5.6 KB · Views: 480
  • Fig01.gif
    Fig01.gif
    2.9 KB · Views: 500
  • Fig02.gif
    Fig02.gif
    4.8 KB · Views: 488
So where is the .INCLUDE statement?

None was necessary. As I explained to the OP in my post #11, to which you took great exception, I found a way around that hoop because I found I didn't always remember placing it on the schematic...bothersome for me.

The generic symbols of LTS have only three symbol attribute (SYMATTR) lines in a specific order. When the .asy file is edited to include the two missing attributes in the correct order AND the .subckt line of the .sub file of the device matches the spice order of the symbol file, the device will work just like any LTS created component without the necessity of an include statement.

To be through, I left the sub file for the MAX961 with the .txt extension, added the .include MAX961.txt statement to the schematic and ran it. The results were the same as you can see in the attachment below. The error message indicates to me that LTS is looking for a .sub file in the SUB directory not a .txt file.

After changing the SUB file with a .sub extension and eliminating the .include statement, I ran it at 10Mhz vice 100Mhz to save some time. The results are also posted below.
 

Attachments

  • MAX961 as Text Vice Sub file plus Inc.jpg
    MAX961 as Text Vice Sub file plus Inc.jpg
    122.8 KB · Views: 587
  • MAX961 at 10Mhz.jpg
    MAX961 at 10Mhz.jpg
    183.2 KB · Views: 550
hi guys,
I have been following this thread [as a LTS user] and I find what Mike has said about the extension types and includes works OK for me.

Hi Eric,

Well, I can't get the model out of the SUB directory without the proper extension of the model saved. That narrows it down to the .sub extension as I save all added models with that extension in the SUB directory.

I did some further experimenting this afternoon, and used the generic DIP8 symbol in place of the MAX961 symbol, added the name attribute and tested it with the .include statement in place with different extensions. In the SUB folder, I copied the MAX961.sub file and "saved as" it with the .txt extension giving two models to test. The first and second test I tried both files in the .include statement and both worked because both files were pointed at individually.

Then I deleted the .txt file and tried it. The .include with the .sub extension worked, but when I changed the extension to .txt the error message clearly stated that MAX961.txt not found.

Then I reversed the process and converted the .sub model to the .txt extension. The .txt file in the SUB folder worked fine with the .include statement, but the .sub .include statement gave the error message. Then I tried it with no extension in the .include statement and it gave the same error message.

Conclusion: The extension matters and is not "totally bogus".

Here are the 5 symbol attributes from the symbol (DIP8) I edited to produce the .inc statement free MAX961 symbol:

SYMATTR Value MAX961
SYMATTR Prefix X
SYMATTR SpiceModel MAX961.sub
SYMATTR Value2 MAX961
SYMATTR Description Low Power Ultra-Fast Dual Comparator W/ Hysteresis

The third line is the file pointer to the model file (.sub). If one were to edit that line to .txt or .wrd or .bus or nothing at all, the .sub file must be saved with that extension, or lack of, to be found; the path to the file is required. That is what I found with my experimenting two months ago when I dug into finding a method to make .inc free symbols, and that is what I found today.

I checked the version of LTS I'm running. It's 4.08o with the date 13 July, 2010. I synced the prog with LT 2 days ago. I don't think it is LTS, but rather something you and others may be doing outside of LTS like adding the path in some other manner so the model file can be found…or not…insufficient data on this end to derive a conclusion.

Cheers,
Merv
 
I checked the version of LTS I'm running. It's 4.08o with the date 13 July, 2010. I synced the prog with LT 2 days ago. I don't think it is LTS, but rather something you and others may be doing outside of LTS like adding the path in some other manner so the model file can be found…or not…insufficient data on this end to derive a conclusion.

hi Merv,
I will check thru my procedures, if I can find anything useful I will post.

Regards
 
There must be a dozen ways to do this, but i think i found one i like. i created two new folders one in lib\sub and one in lib\sym. I called them both new. save the model in lib\sub\new\Part#.sub (text file asci). Modify a similar symbol by changing attributes to prefix=X Spice model = new\Part#.sub . Value = Part #.
New shows up in the regular spice componet menu and you don't need an include.
Has anyone else tried this. Seems to work.
PS. I just can't unzip files from this site. Don't know why, but all the parts vendors work fine.
 
There must be a dozen ways to do this, but i think i found one i like. i created two new folders one in lib\sub and one in lib\sym. I called them both new. save the model in lib\sub\new\Part#.sub (text file asci). Modify a similar symbol by changing attributes to prefix=X Spice model = new\Part#.sub . Value = Part #.
New shows up in the regular spice componet menu and you don't need an include.
Has anyone else tried this. Seems to work.
PS. I just can't unzip files from this site. Don't know why, but all the parts vendors work fine.

Yes, I did that a few months ago and sent you a link for the full proceedure a day or two ago.... Kinda nice to not have to remember the .inc statement don'tchathink. However, I think you should look at my post #30 and the 5 symbol attributes (SYMATTR) needed for a bullet-proof .asy file...or not.
 
Merv,
I'm a computer illiterate so i guess i didn't recognize it from your post. I did print it out but couldn't make sense of it. I'll look again.
SYMATTR = symbol attributes???? This is my problem. I found this one on line with pictures. :=)
But yes, I do like it, it's just like any other part and it's in the library.
Now if I could just find a cheap replacement for the LT1013. (> 30v supply, no latch up and drives to ground)
 
Procedure

I have been working on adding spice models and have finally documented "a" way that seems to work. As I said earlier I would try it as a beginner. I have added some op amps, a zener, and a regulator using this method. I am now struggling with a darlington. There are a couple of things still troubling me about this.
1= some others say the subcircuit should be saved as a .lib not a .sub file. Also in the attribute window I have seen / and \ used. Maybe it doesn't matter. In any case if a few could review it I would feel like I kept up my end of the bargin.
Thanks again to all who helped.
 

Attachments

  • Adding Models to LTSpice.doc
    227.5 KB · Views: 3,509
I have been working on adding spice models and have finally documented "a" way that seems to work. As I said earlier I would try it as a beginner. I have added some op amps, a zener, and a regulator using this method. I am now struggling with a darlington. There are a couple of things still troubling me about this.
1= some others say the subcircuit should be saved as a .lib not a .sub file. Also in the attribute window I have seen / and \ used. Maybe it doesn't matter. In any case if a few could review it I would feel like I kept up my end of the bargin.
Thanks again to all who helped.

Whatchagonnado when the spice order of the model doesn't match up with the SYM file chosen? All the procedure you have presented in your attachment REQUIRES an absolute match in the SYM file and the spice order. It will work only if the model follows the same dedicated format of spice order used by LT. Otherwise, one is bound for grief.

Try rereading, again, the method I have already presented months ago, the one to which I gave you the link last week, to obtain a bullet-proof method of getting a SPICE model to work as any other modeled LT device.

From you "method":

Note that 324.sub is the file name not the file type. The file type is still ANSI Text.

The third symbol attribute of the SYM file POINTS to the complete FILENAME including the extension in the SUB directory. The file type is of little importance given the file was opened and saved with a TEXT EDITOR, the same editor I recommended in my write up. The full FILENAME along with any additional path within the SUB directory, including the extension, is the important item and that pointer in the SYM file must match EXACTLY that in the SUB file, regardless of the extension used.

Think you got it licked?

So here is a challenge to you. Try getting an AD8611 to work using your procedure. See if you can figure out why the heck it won't work. Then get it to work just like any LTS model without an include statement. I'll give you a tip of the tam if you do and modify your procedure appropriately.

Do you feel up to the challenge? It took me about a half hour to get it fixed and working. Can you do it in a day? BTW, the model is on AD's website. I downloaded the complete folder and save it for access to all their models. It saves time in the long run.
 
No thank you. I am so old I don't by green bananas so I don't want to waste a lot of time. I could not understand your procedure but I'm sure you can picture it in great detail because you know it well.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top