Difference between revisions of "Adding a permanent component to LTspice"

From LTwiki-Wiki for LTspice
m
(Add DISQUS for comments)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
[http://www.zen22142.zen.co.uk/ltspice/addnewparts.htm 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 ==
 
== 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.
 
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:
+
1) Start with an existing .asy file if possible.  Here we can use LT1017.asy:
  
 
----
 
----
Line 9: Line 15:
 
Version 4
 
Version 4
 
SymbolType CELL
 
SymbolType CELL
LINE Normal -32 32 32 64
+
LINE Normal -32 -32 32 0
LINE Normal -32 96 32 64
+
LINE Normal -32 32 32 0
LINE Normal -32 32 -32 96
+
LINE Normal -32 -32 -32 32
LINE Normal -28 48 -20 48
+
LINE Normal -28 -16 -20 -16
LINE Normal -28 80 -20 80
+
LINE Normal -28 16 -20 16
LINE Normal -24 84 -24 76
+
LINE Normal -24 20 -24 12
LINE Normal 0 32 0 48
+
LINE Normal 0 -32 0 -16
LINE Normal 0 96 0 80
+
LINE Normal 0 32 0 16
LINE Normal 4 44 12 44
+
LINE Normal 4 -20 12 -20
LINE Normal 8 40 8 48
+
LINE Normal 8 -24 8 -16
LINE Normal 4 84 12 84
+
LINE Normal 4 20 12 20
WINDOW 0 16 32 Left 0
+
WINDOW 0 16 -32 Left 0
WINDOW 3 16 96 Left 0
+
WINDOW 3 16 32 Left 0
SYMATTR Value LTC1441
+
SYMATTR Value LT1017
 
SYMATTR Prefix X
 
SYMATTR Prefix X
SYMATTR SpiceModel LTC.lib
+
SYMATTR SpiceModel LTC1.lib
SYMATTR Value2 LTC1441
+
SYMATTR Value2 LT1017
SYMATTR Description Dual Ultralow Power Comparator with Reference
+
SYMATTR Description µPower Dual Comparator(1 of 2)
PIN 32 64 NONE 0
+
PIN -32 16 NONE 0
PINATTR PinName OUT
+
PINATTR PinName In+
 
PINATTR SpiceOrder 1
 
PINATTR SpiceOrder 1
PIN 0 96 NONE 0
+
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 PinName V-
PINATTR SpiceOrder 2
+
PINATTR SpiceOrder 4
PIN -32 80 NONE 0
+
PIN 32 0 NONE 0
 +
PINATTR PinName OUT
 +
PINATTR SpiceOrder 5
 
</PRE>
 
</PRE>
 
----
 
----
Line 39: Line 53:
 
2) Edit the lines above as shown:
 
2) Edit the lines above as shown:
  
 +
<PRE>
 
WAS:
 
WAS:
<PRE>
+
 
SYMATTR Value LTC1441
+
SYMATTR Value LT1017
 
SYMATTR Prefix X
 
SYMATTR Prefix X
SYMATTR SpiceModel LTC.lib
+
SYMATTR SpiceModel LTC1.lib
SYMATTR Value2 LTC1441
+
SYMATTR Value2 LT1017
SYMATTR Description Dual Ultralow Power Comparator with Reference
+
SYMATTR Description µPower Dual Comparator(1 of 2)
  
 
NOW:
 
NOW:
Line 53: Line 68:
 
SYMATTR SpiceModel LM339.sub
 
SYMATTR SpiceModel LM339.sub
 
SYMATTR Value2 LM339
 
SYMATTR Value2 LM339
SYMATTR Description Quad Single Supply 3V/5V Comparator LM339
+
SYMATTR Description Quad Single Supply 3V/5V Comparator LM339
 
</PRE>
 
</PRE>
 
3) Save this file as LM339.asy under \lib\sym\Comparators  [http://alternateenergies.com/LTwiki/files/LM339.asy LM339.asy]
 
3) Save this file as LM339.asy under \lib\sym\Comparators  [http://alternateenergies.com/LTwiki/files/LM339.asy LM339.asy]
Line 62: Line 77:
  
 
Note: Additionally look at [http://alternateenergies.com/LTwiki/files/LM339_DIP14.asy LM339_DIP14.asy]  You may add this as well, if you want all four comparators.
 
Note: Additionally look at [http://alternateenergies.com/LTwiki/files/LM339_DIP14.asy LM339_DIP14.asy]  You may add this as well, if you want all four comparators.
 +
 +
An Example using LM339 [http://alternateenergies.com/LTwiki/files/LM339_test.asc LM339_test.asc]
 +
[http://alternateenergies.com/LTwiki/files/LM339_LTspice.png A screenshot of the LM339 test file]
 +
 +
{{#widget:DISQUS
 +
|id=ltwiki
 +
|uniqid={{PAGENAME}}
 +
|url={{fullurl:{{PAGENAME}}}}
 +
}}

Latest revision as of 21:37, 20 September 2011

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