.SUBCKT
As an aid to defining a circuit, repetitive circuitry
can be enclosed in a subcircuit definition and used as
multiple instances in the same circuit. Before the
simulation runs, the circuit is expanded to a flat
netlist by replacing each invocation of a subcircuit
with the circuit elements in the subcircuit
definition. There is no limit on the size or
complexity of subcircuits.
The end of a subcircuit definition must be a .ends
directive.
Here is an example using a subcircuit:
*
* This is the circuit definition
X1 a b 0 divider
V1 a 0 pulse(0 1 0 .5μ .5μ 0 1μ)
* this is the definition of the subcircuit
.subckt divider n1 n2 n3
96
r1 n1 n2 1k
r2 n2 n3 1k
.ends
.tran 3μ
.end
Which runs after expanding to
* Expand X1 into two resistor network
r:1:1 a b 1k
r:1:2 b 0 1k
*
v1 a 0 pulse(0 1 0 .5μ .5μ 0 1μ)
.tran 3μ
.end
Note that unique names based on the subcircuit name
and the subcircuit definition element names are made
for the circuit elements inserted by subcircuit
expansion.
May 2nd, 2010 at 9:45 am
wow nice here a video on it http://www.youtube.com/watch?v=BlSXYwmkmOQ