Skip to main content
Added procedure for hierarchical block
Source Link
Peter Smith
  • 22.6k
  • 1
  • 30
  • 65

In your case, you are trying to create a hierarchical block; there is an excellent description at the link.

As links die, here is the procedure:

Make the schematic you desire to use as a hierarchical block and save it with a name <schematicname.asc>

Now label all nets that must have external visibility and save again.

Create a new symbol. The pins on this symbol must have the same name as the labels you attached.

Save this symbol as <schematicname.asy> (the names must be the same for the schematic and symbol).

If your schematic has external models or subcircuits, use the .include directive using full path names in the schematic before saving (so they do not have to be in a working directory).

You should now be able to instantiate your hierarchical block.

In your case, you are trying to create a hierarchical block; there is an excellent description at the link.

As links die, here is the procedure:

Make the schematic you desire to use as a hierarchical block and save it with a name <schematicname.asc>

Now label all nets that must have external visibility and save again.

Create a new symbol. The pins on this symbol must have the same name as the labels you attached.

Save this symbol as <schematicname.asy> (the names must be the same for the schematic and symbol).

If your schematic has external models or subcircuits, use the .include directive using full path names in the schematic before saving (so they do not have to be in a working directory).

You should now be able to instantiate your hierarchical block.

Added expanded explanation of adding SYMATTR values.
Source Link
Peter Smith
  • 22.6k
  • 1
  • 30
  • 65

First, make yourself a user directory under 'sym':

New directory

Before adding anything (I already did, but we will get to that).

Start LTSpice, start a new schematic and then select add component:

I get this view with my parts directory shown:

My directory now viewable in LTSpice

Close LTSpice for now.

For an opamp (which is what I did here), copy the OPAMP2.sym file from the sym\Opamps directory to your directory and rename it with the name you want (which is what I did in the first picture).

Now get the subcircuit file and save it in the lib\sub directory:

Model added to sub directory

Now open the asy file in your user directory in a text editor:

Here is part of the file:

SYMATTR Value ADA4666
SYMATTR Prefix X
SYMATTR Description Micropower Rail to Rail amplifier
SYMATTR SpiceModel ADA4666.cir

If there are no SYMATTR lines, then add them:

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 2
WINDOW 3 16 96 Left 2
SYMATTR Value ADA4666
SYMATTR Prefix X
SYMATTR Description Micropower Rail to Rail amplifier
SYMATTR SpiceModel ADA4666.cir
PIN -32 80 NONE 0
PINATTR PinName In+
PINATTR SpiceOrder 1
PIN -32 48 NONE 0
PINATTR PinName In-
PINATTR SpiceOrder 2
PIN 0 32 NONE 0
PINATTR PinName V+
PINATTR SpiceOrder 3
PIN 0 96 NONE 0
PINATTR PinName V-
PINATTR SpiceOrder 4
PIN 32 64 NONE 0
PINATTR PinName OUT
PINATTR SpiceOrder 5

Add any SYMATTR lines immediately before the PIN and PINATTR statements.

I changed the SYMATTR values to give a correct display name (Value), the Description field for what LTSpice shows in the selector window and the SpiceModel to the model I added in the sub folder.

Here it is:

New amplifier with description

I then place it:

ADA4666 placed

Right click on the part and you get this:

ADA4666 attributes

This can now be used in any schematic.

I went through this when I added the Wurth magnetics library a while back.

The keys are:

  1. Put the subcircuit in the sub folder

  2. Put the symbol file in a directory of your choosing

  3. Make sure the SYMMATR statements point at the subcircuit properly, and edit the name and description to get an accurate representation of what it is.

Note that the subcircuit must be complete in its own right.

First, make yourself a user directory under 'sym':

New directory

Before adding anything (I already did, but we will get to that).

Start LTSpice, start a new schematic and then select add component:

I get this view with my parts directory shown:

My directory now viewable in LTSpice

Close LTSpice for now.

For an opamp (which is what I did here), copy the OPAMP2.sym file from the sym\Opamps directory to your directory and rename it with the name you want (which is what I did in the first picture).

Now get the subcircuit file and save it in the lib\sub directory:

Model added to sub directory

Now open the asy file in your user directory in a text editor:

Here is part of the file:

SYMATTR Value ADA4666
SYMATTR Prefix X
SYMATTR Description Micropower Rail to Rail amplifier
SYMATTR SpiceModel ADA4666.cir

I changed the SYMATTR values to give a correct display name (Value), the Description field for what LTSpice shows in the selector window and the SpiceModel to the model I added in the sub folder.

Here it is:

New amplifier with description

I then place it:

ADA4666 placed

Right click on the part and you get this:

ADA4666 attributes

This can now be used in any schematic.

I went through this when I added the Wurth magnetics library a while back.

First, make yourself a user directory under 'sym':

New directory

Before adding anything (I already did, but we will get to that).

Start LTSpice, start a new schematic and then select add component:

I get this view with my parts directory shown:

My directory now viewable in LTSpice

Close LTSpice for now.

For an opamp (which is what I did here), copy the OPAMP2.sym file from the sym\Opamps directory to your directory and rename it with the name you want (which is what I did in the first picture).

Now get the subcircuit file and save it in the lib\sub directory:

Model added to sub directory

Now open the asy file in your user directory in a text editor:

Here is part of the file:

SYMATTR Value ADA4666
SYMATTR Prefix X
SYMATTR Description Micropower Rail to Rail amplifier
SYMATTR SpiceModel ADA4666.cir

If there are no SYMATTR lines, then add them:

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 2
WINDOW 3 16 96 Left 2
SYMATTR Value ADA4666
SYMATTR Prefix X
SYMATTR Description Micropower Rail to Rail amplifier
SYMATTR SpiceModel ADA4666.cir
PIN -32 80 NONE 0
PINATTR PinName In+
PINATTR SpiceOrder 1
PIN -32 48 NONE 0
PINATTR PinName In-
PINATTR SpiceOrder 2
PIN 0 32 NONE 0
PINATTR PinName V+
PINATTR SpiceOrder 3
PIN 0 96 NONE 0
PINATTR PinName V-
PINATTR SpiceOrder 4
PIN 32 64 NONE 0
PINATTR PinName OUT
PINATTR SpiceOrder 5

Add any SYMATTR lines immediately before the PIN and PINATTR statements.

I changed the SYMATTR values to give a correct display name (Value), the Description field for what LTSpice shows in the selector window and the SpiceModel to the model I added in the sub folder.

Here it is:

New amplifier with description

I then place it:

ADA4666 placed

Right click on the part and you get this:

ADA4666 attributes

This can now be used in any schematic.

I went through this when I added the Wurth magnetics library a while back.

The keys are:

  1. Put the subcircuit in the sub folder

  2. Put the symbol file in a directory of your choosing

  3. Make sure the SYMMATR statements point at the subcircuit properly, and edit the name and description to get an accurate representation of what it is.

Note that the subcircuit must be complete in its own right.

Source Link
Peter Smith
  • 22.6k
  • 1
  • 30
  • 65

First, make yourself a user directory under 'sym':

New directory

Before adding anything (I already did, but we will get to that).

Start LTSpice, start a new schematic and then select add component:

I get this view with my parts directory shown:

My directory now viewable in LTSpice

Close LTSpice for now.

For an opamp (which is what I did here), copy the OPAMP2.sym file from the sym\Opamps directory to your directory and rename it with the name you want (which is what I did in the first picture).

Now get the subcircuit file and save it in the lib\sub directory:

Model added to sub directory

Now open the asy file in your user directory in a text editor:

Here is part of the file:

SYMATTR Value ADA4666
SYMATTR Prefix X
SYMATTR Description Micropower Rail to Rail amplifier
SYMATTR SpiceModel ADA4666.cir

I changed the SYMATTR values to give a correct display name (Value), the Description field for what LTSpice shows in the selector window and the SpiceModel to the model I added in the sub folder.

Here it is:

New amplifier with description

I then place it:

ADA4666 placed

Right click on the part and you get this:

ADA4666 attributes

This can now be used in any schematic.

I went through this when I added the Wurth magnetics library a while back.