Connect with us

Need help with LTSPICE library

Discussion in 'CAD' started by Joe, Aug 14, 2003.

Scroll to continue with content
  1. Joe

    Joe Guest

    I have been using LTSPICE for a few weeks now and it is a great help in
    figuring out how a circuit will work before breadboarding it. I am a
    hobbyist and I work mostly with discretes and 555 timers along with some
    cmos counters. Pretty simple stuff.
    I have been reading the help file and also looked at some of the .lib files
    trying to figure out how to create some of my own components. I would like
    to add a cmos 556 to the library and possibly a few opamps that I am
    familiar with (eg, 741) , but don't know where to start.
    Is anyone familiar enough with creating custom components in this simulator
    to be able to steer me in the right direction??

    TIA,

    Joe
     
  2. Joe

    Joe Guest

    Thanks for the advice, already been there, done that. Problem is, there's so
    many different models and whats the difference between HSPICE, and PSPICE ?.
    I guess I need to know which model type is compatible with LTSPICE

    .. I thought I would be able to create one from one of the existing models
    already in LTSPICE. They have a schematic for the 741 opamp in the
    'educational' folder and it has pinouts. I dont find a .sub file for it tho.
    I was able to read the .sub files for most of the models they have in there,
    but I don't know what language it is written in. Are all spice models
    compatible with all the simulators??

    I downloaded a model for the LM741 opamp from the national semiconductor
    site, but now don't know what to do with it. It looks a lot different then
    the models I have been able to read in the LTSPICE folder.

    I also found what looks like it may be a model of the 556 timer, but I have
    to dl 'circuitmaker' student version. That simulator seems to have the most
    models and is a freebie. I am just wondering if anyone uses it here, and if
    maybe that would be the best route to go? I like using LTSPICE, but I guess
    I need more information then what they give us in the help files unless
    someone here is knowledgeable about creating new models for it. Or modifying
    the existing models with the right parameters to get where I need to be.

    Thank you again for the reply,

    Joe
     
  3. The Spice2, Spice3 format is understood by just about all simulators, so
    a basic model usually runs in all. However, PSpice and HSpice have some
    extra stuff that might cause problems if their extensions are used.
    See above. There is the a standard html Berkley manual in my SuperSpice
    install.
    This prompted me to address my own SuperSpice 555 model. It had some
    convergence problems. My latest update:

    2 Implemented a new 555 Timer .subckt model with much better convergence
    properties. The Example LM555.sss has been updated. This example now has
    a 555 set to Astable mode, driving a 555 set to Monostable mode, but
    with its control voltage modulated to form a PWM.

    It runs fine in SS with this example, and should run ok in any of the
    XSpice based simulators, e.g., EWB, Circuit Maker, Visual Spice, Tina,
    TopSpice. However, there seems to be an issue in LTSpice, it runs at a
    snails pace.

    Ah... just played with LTSpice a bit while writing this... quite
    strange. It wants a default of abstol=10p, then it zooms off at about
    twice the speed. I modified the basic xspice engine default to 10p from
    1p, so I dont have this in my .options line. I found 10p to be a bettter
    defualt for most circuits.

    Kevin Aylward

    http://www.anasoft.co.uk
    SuperSpice, a very affordable Mixed-Mode
    Windows Simulator with Schematic Capture,
    Waveform Display, FFT's and Filter Design.
    **********
     
  4. Hello Joe,
    here is the fastest route to your models in LTSPICE.

    First you should create two new folders for your own models.
    For the SPICE model:
    C:\Programme\Ltc\SwCADIII\lib\sub\Private
    For the symbols:
    C:\Programme\Ltc\SwCADIII\lib\sym\Private

    The let's start here at National.
    http://www.national.com/appinfo/amps/0,2175,815,00.html
    Download the LM741.mod into the new folder "Private" of LTSPICE
    C:\Programme\Ltc\SwCADIII\lib\sub\Private
    We have then C:\Programme\Ltc\SwCADIII\lib\sub\Private\lm741.mod .
    This is the Spice model file. Don't care about the extension .mod .
    I recommend to make a National library file.
    So please copy the contentents of all models from National into
    one file Nat.lib. That's the same way LT has done it with its Ltc.lib.
    You will then have your library file
    C:\Programme\Ltc\SwCADIII\lib\sub\Private\Nat.lib .


    Part of the lm741.mod file:

    *//////////////////////////////////////////////////////////
    *LM741 OPERATIONAL AMPLIFIER MACRO-MODEL
    *//////////////////////////////////////////////////////////
    *
    * connections: non-inverting input
    * | inverting input
    * | | positive power supply
    * | | | negative power supply
    * | | | | output
    * | | | | |
    * | | | | |
    ..SUBCKT LM741/NS 1 2 99 50 28
    *
    *Features:
    *Improved performance over industry standards
    .....

    The order of the functional pins is important for the coming symbol.
    You are in luck here. Nearly all models of different vendors use
    the same order. That means you can use an already existing symbol
    from Linear Technolgoy.


    1. Start LTSPICE

    2. Start your Windows explorer and show the directory contents of
    C:\Programme\Ltc\SwCADIII\lib\sym\Opamps
    Drag the symbol file Lt1013.asy to the LTSPICE program(window).
    The symbol editor of LTSPICE now shows the symbol.

    3. Make a new symbol by copying it. Still in the symbol editor press
    File->Save
    Change LT1013.asy to Lm741.asy
    Click up and down to the new folder
    C:\Programme\Ltc\SwCADIII\lib\sym\Private
    Save the Lm741.asy here.

    4. Now Edit->Attributes->Edit Attributes
    Replace the text Ltc.lib" with Private\Nat.lib or if you don't
    want the library file then simply use Private\lm741.mod .

    5. Replace both LT1013 with LM741/NS . This must be exactly the name
    in the model file; see the line from that file above.
    .SUBCKT LM741/NS 1 2 99 50 28

    Finally your window looks like this:

    Prefix X
    SpiceModel Private\Nat.lib
    Value LM741/NS
    Value2 LM741/NS
    Specline
    Specline2
    Descripion Whatever text you like

    Press OK
    File Save

    6. Close LTSPICE !

    7. Restart LTSPICE
    File-> New Schematic

    8. Click on Component or Edit->Component
    You should see your folder {private], click on it.
    Now you see your symbol lm741 .
    Click on it and place it to your schematic.

    That's all you need.

    Have fun with LTSPICE.

    You should prefer PSPICE models, because LTSPICE is most compatible to that.

    This is the user's group of LTSPICE.
    http://groups.yahoo.com/group/LTspice

    Best Regards
    Helmut
     
  5. Standard Spice manual http://www.anasoft.co.uk/Spice3F5Manual.html

    Kevin Aylward

    http://www.anasoft.co.uk
    SuperSpice, a very affordable Mixed-Mode
    Windows Simulator with Schematic Capture,
    Waveform Display, FFT's and Filter Design.
     
  6. [snipped comprehensive step-by-step procedure]

    Nice one, Helmut!

    I wish I had such a clear and succinct guide for CircuitMaker <g>.
     
  7. Hello Joe,
    this is just SPICE syntax. Kevin has already given you a link to a
    SPICE manual. Take a look into it.
    Every node of your circuit has a unique number. You are free to
    number it except number 0 which is the common node. Every circuit
    needs a DC path in some way to node 0. That's wy SPICE will fail
    normally if you have no GND symbol on your schematic.
    If you use a schematic then LTSPICE number the nodes for you.
    You can see it after a simulalation run with
    View-> SPICE netlist
    Spice interpreters these days allows also names insted of numbers.
    Example: R100 23 34 1k
    R101 inp rc 2k
    The physical pins of your device has nothing to do with the pin order
    in the sub-circuit. Somebody just started to use the order
    non-inv. invert. pos.supp. ...... . All the other people
    have followed for compatibility reason.


    Best Regards
    Helmut
     
  8. Joe

    Joe Guest


    Thank you Kevin, I downloaded the spice manual and I have started reading
    it. The 741 subckt has a lot of R's and C's in it, and they are numbered
    (ieR1, R2, etc.). Is R always a resistor, and C always a capacitor? These
    occur at the beginning of each line in the model definition. If so, it looks
    like this model is broken down to a bunch of resistors, caps , current and
    voltage sources. Is that basically how these devices are modelled?

    Joe
     
  9. Joe

    Joe Guest

    Thanks for explaining that. I am sure I will have many more questions as I
    delve into the spice manual, and now that I know how to look at the spice
    netlist. Is this the best forum for questions or should I post to the
    LTSPICE group on yahoo?, or both?

    Joe

    PS I am having fun with this, actually, now that it is starting to make
    sense:))
     
  10. Hello Joe,
    I would post general SPICE questions into this group and very
    LTSPICE specific questions to the LTSPICE-YAHOO group.
    The LTSPICE-Yahoo group is a forum to share files too.
    That can't be done with this group here.

    The advantage of the sci.electronics.cad group is that you
    reach people using different SPICE programs. None of the SPICE
    implementations is best in all features.

    Many people interested in LTSPICE read in both groups anyway.

    Best Regards
    Helmut


    This is the user's group of LTSPICE.
    http://groups.yahoo.com/group/LTspice
     
  11. Yes and Yes.
    Yes.

    As I have prior noted, in SuperSpice, you can draw a schematic for the
    model, and have the ".subckt" model text automatically generated. This
    way you dont need to know anything about the spice syntax at all. I use
    this method to make all my bigger models like PWM, current mode
    controllers etc. Its much easier to probe debug the schematic version
    than a text version.

    Kevin Aylward

    http://www.anasoft.co.uk
    SuperSpice, a very affordable Mixed-Mode
    Windows Simulator with Schematic Capture,
    Waveform Display, FFT's and Filter Design.
     
  12. Joe

    Joe Guest

    Ok, staying with the LM741 model. There is a transistor level schematic of
    the LM 741 in the 'educational' folder of the LTSPICE directory. When I run
    it, and look at the spice net list, I get a .asc file which I can then print
    with notepad. I did that, but it doesnt look anything like the model I
    downloaded from National. There are a lot of nodes and the pins are
    different in the netlist. I am not sure how I could convert it to a .subckt
    and then just use it as a model as I did with the national version. Looking
    in the spice manual, I can see that it is related, but I seem to be missing
    something that links the net list, and circuit description with the models
    and subcircuits.

    It seems like it would be a lot easier to do it that way, but I am not sure
    if the spice net list is the same as a .subckt in LTSPICE.

    Joe
     
  13. Joe,
    The LT741 schematic isn't so much a macro model of 741, but the actual
    transistor-level schematic of the IC. If you want to run it as the model
    of a 741, the easiest way is to call it as schematic in a hierarchical
    circuit. See the appropriate sections of the help to see how to do this.

    --Mike
     
  14. I think its worth pointing out that in general, one does not want to
    remove ".model" lines. Unless its a default model, there is no way that
    an arbitrary simulator is going to include the correct model. It needs
    to be specified in the ".subckt"

    Kevin Aylward

    http://www.anasoft.co.uk
    SuperSpice, a very affordable Mixed-Mode
    Windows Simulator with Schematic Capture,
    Waveform Display, FFT's and Filter Design.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-