Passing Parameters to Hierarchical Block in LTSPICE

There were a couple of questions on how to pass parameters to Hierarchical Blocks from main level schematic in LTSPICE. In fact, until recently, I was having troubles doing this. But solution is very simple and strait forward.

Here is how it could be done.

Create your Hierarchical Block schematic and symbol the regular way as described in previous section.

In Hierarchical Block schematic, put parameter variable in value field of component you would like to pass different parameter to from your main level schematic.

In our example it will be value of resistor R2.

In Hierarchical Block schematic, assign default value for this parameter by using .PARAM statement.

This is necessary to be able to pass this parameter value from top level schematic and to set default value just in case you would not want to pass anything to this instance of your Hierarchical Block.

Hierarchical Block schematic

Hierarchical Block schematic

In Main Level schematic, place as many instances of Hierarchical Block symbols as you need.

For every instance that you want to pass parameters to: right click on Hierarchical Block symbol, enter parameter assignment in PARAMS window in the form “param value name”=”param value”.

Select PARAMS checkbox to enable passing parameters. Don’t put .PARAMS statement before “value name” in PARAMS window. Just put “value name”=”param value”.

Press OK to close this window. Parameter should be passed to corresponding instance of your Hierarchical Block.

Parameter assignment in PARAMS window

Parameter assignment in PARAMS window

I created simple example to illustrate how to pass parameters to Hierarchical Block.

It could be downloaded by using this link:

Passing-Parameters-to-Hierarchical-Block.zip

Just unzip all files in the same directory and run ‘PassingParametersHierarchicalBlock.asc”

Comments

4 Responses to Passing Parameters to Hierarchical Block in LTSPICE

  1. Pingback: Hierarchical Blocks in LTSPICE | Audio Perfection