Adding a permanent component to LTspice

Loading
From LTwiki-Wiki for LTspice
Revision as of 21:37, 20 September 2011 by Lewispaul (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A good tutorial for adding new components

See Components_Library for parts ready to be added to LTspice. Also please note this procedure allows for portable components as well. You simply add the subcircuits and symbols created below to the schematic folder you wish to make portable. You do not have to remove your permanent components either. LTspice uses a hierarchy of search for symbols and subcircuits.


Adding LM339 as a Comparator

This technique allows you to add a frequently used part to the menu of LTspice. In this way you don't have to use include statements, etc. These parts should not be overwritten during an LTspice update.

1) Start with an existing .asy file if possible. Here we can use LT1017.asy:


Version 4
SymbolType CELL
LINE Normal -32 -32 32 0
LINE Normal -32 32 32 0
LINE Normal -32 -32 -32 32
LINE Normal -28 -16 -20 -16
LINE Normal -28 16 -20 16
LINE Normal -24 20 -24 12
LINE Normal 0 -32 0 -16
LINE Normal 0 32 0 16
LINE Normal 4 -20 12 -20
LINE Normal 8 -24 8 -16
LINE Normal 4 20 12 20
WINDOW 0 16 -32 Left 0
WINDOW 3 16 32 Left 0
SYMATTR Value LT1017
SYMATTR Prefix X
SYMATTR SpiceModel LTC1.lib
SYMATTR Value2 LT1017
SYMATTR Description µPower Dual Comparator(1 of 2)
PIN -32 16 NONE 0
PINATTR PinName In+
PINATTR SpiceOrder 1
PIN -32 -16 NONE 0
PINATTR PinName In-
PINATTR SpiceOrder 2
PIN 0 -32 NONE 0
PINATTR PinName V+
PINATTR SpiceOrder 3
PIN 0 32 NONE 0
PINATTR PinName V-
PINATTR SpiceOrder 4
PIN 32 0 NONE 0
PINATTR PinName OUT
PINATTR SpiceOrder 5

2) Edit the lines above as shown:

WAS:

SYMATTR Value LT1017
SYMATTR Prefix X
SYMATTR SpiceModel LTC1.lib
SYMATTR Value2 LT1017
SYMATTR Description µPower Dual Comparator(1 of 2)

NOW:

SYMATTR Value LM339
SYMATTR Prefix X
SYMATTR SpiceModel LM339.sub
SYMATTR Value2 LM339
SYMATTR Description Quad Single Supply 3V/5V Comparator LM339

3) Save this file as LM339.asy under \lib\sym\Comparators LM339.asy

4) Put LM339.sub file, put in \lib\sub

5) When LTspice opens again, LM339 should be available as a component under 'Comparators'.

Note: Additionally look at LM339_DIP14.asy You may add this as well, if you want all four comparators.

An Example using LM339 LM339_test.asc A screenshot of the LM339 test file

blog comments powered by Disqus