Adding a permanent component to LTspice

From LTwiki-Wiki for LTspice
Revision as of 17:11, 8 August 2009 by Analogspiceman (talk | contribs)

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 LTC1441.asy:


Version 4
SymbolType CELL
LINE Normal -32 32 32 64
LINE Normal -32 96 32 64
LINE Normal -32 32 -32 96
LINE Normal -28 48 -20 48
LINE Normal -28 80 -20 80
LINE Normal -24 84 -24 76
LINE Normal 0 32 0 48
LINE Normal 0 96 0 80
LINE Normal 4 44 12 44
LINE Normal 8 40 8 48
LINE Normal 4 84 12 84
WINDOW 0 16 32 Left 0
WINDOW 3 16 96 Left 0
SYMATTR Value LTC1441
SYMATTR Prefix X
SYMATTR SpiceModel LTC.lib
SYMATTR Value2 LTC1441
SYMATTR Description Dual Ultralow Power Comparator with Reference
PIN 32 64 NONE 0
PINATTR PinName OUT
PINATTR SpiceOrder 1
PIN 0 96 NONE 0
PINATTR PinName V-
PINATTR SpiceOrder 2
PIN -32 80 NONE 0

2) Edit the lines above as shown:

WAS:

SYMATTR Value LTC1441
SYMATTR Prefix X
SYMATTR SpiceModel LTC.lib
SYMATTR Value2 LTC1441
SYMATTR Description Dual Ultralow Power Comparator with Reference

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.