LTspice Creating New Symbols

REF: http://m.eeworld.com.cn/bbs/forum.php?mod=viewthread&tid=1208267&page=1

Creating New Symbols

Symbols can represent a primitive device such as a resistor or a capacitor; a subcircuit libraried in a separate file; or another page of the schematic. This section describes how to define your own new symbols. To start a new symbol, use the menu command File=>New Symbol.

Drawing the body

Adding the Pins

Adding Attributes

Attribute Visibility

Automatic Symbol Generation

Drawing the body

You draw the body of the symbol as a series of lines, rectangles, circles, and arcs. The objects have no electrical impact on the circuit. You can also draw text on the symbol with the Draw=>Text command that has no impact on the circuit. The anchor points of these objects are drawn with small red circles so you know what to grab when dragging them about. You can toggle the red markers off and on with the menu command View=>Mark Object Anchors

Adding the Pins

The pins allow electrical connection to the symbol. Use the menu command

"Edit=>Add Pin/Port " to add a new pin.

The "Pin Label Position" determines how the pin label is presented. "TOP", "BOTTOM", "LEFT", and "RIGHT" are text justifications. For example, if a pin label is TOP justified, the pin(the label's text justification's anchor point) will be above the label. If the symbol represents a SPICE primitive element or a subcircuit from a library, then the pin label has no direct electrical impact on the circuit. However, if the symbol represents lower-level schematic of a hierarchical schematic, then the pin name is significant as the name of a net in the lower level schematic.

The "Netlist Order" determines the order this pin is netlisted for SPICE.

Adding Attributes

You can define default attributes for a symbol using the menu command Edit=>Attributes=>Edit Attributes. The most important attribute is called the "Prefix". This determines the basic type of symbol. If the symbol is intended to represent a SPICE primitive, the symbol should have the appropriate prefix, R for resistor, C or capacitor, M for MOSFET, etc. See the LTspice reference for a complete set of SPICE primitives available. The prefix should be 'X' if you want to use the symbol to represent a subcircuit defined in a library.

The symbol's attributes can be overridden in the instance of the symbol as a component in a schematic. For example, if you have a symbol for a MOSFET with a prefix attribute of 'M', it's possible to override the prefix to an 'X' on an instance-by-instance basis so that the transistor can be modeled as subcircuit instead.

There is a special combination of attributes that will cause a required library to be automatically included in every schematic that uses the symbol:

Prefix: X

SpiceModel: <name of file including the spicemodel>

Value: <What ever you want visible on the schematic>

Value2: <The value as you want in the netlist>

Value2 would be made to coincide with a subcircuit name defined in the file including the spicemodel and may pass additional parameters to the subcircuit. When a symbol is defined in this manner, an instance of the symbol as a component on a schematic cannot be edited to have different attributes.

If you wish the symbol to represent another page of a hierarchical schematic, all attributes should be left blank the symbol type should be changed from "Cell" to "Block". No attribute values need be set.

There is a symbol attribute, ModelFile, that may be specified. This is used for the name of a file to be included in the netlist as a library. If the prefix attribute is 'X' and there is a symbol attribute SpiceModel defined that is subcircuit defined in the model file, then a drop list of all subcircuits names will be available when an instance of the symbol is edited on a schematic.

Attribute Visibility

You can edit the visibility of attributes using the menu command Edit=>Attributes=>Attribute Window. After you select an attribute with this dialog you will then be able to position it as you wish with respect to the symbol.

You can modify the text justification and contents of attributes that you've already made visible by right mouse clicking on the text of the attribute.

Automatic Symbol Generation

A symbol can be automatically generated in two situations:

1. When editing a schematic, you can execute menu item Hierarchy=>Open this Sheet's Symbol. When no symbol is found, LTspice will ask if you would like one automatically generated. This symbol then can be used to call this sheet of circuitry in some higher level schematic. Note that if you edit the ports of the schematic, the symbol will no longer netlist correctly against the schematic and you should delete the symbol and regenerate it.

2. When editing an ASCII netlist that contains subcircuit definitions, you place the cursor on the line containing the name of the subcircuit, right click, and execute context menu item "Create Symbol." For most users, this is the only method you should ever consider for adding third-party models defined as subcircuits since all the details are handled for you.

Example

Automatic Symbol Generation

  1. creat a txt file, add the follow text in it, and save.


* design by xutong

* define a PWM Generate

* Name is PWM_G means PWM Generate

*              PWM output+

*              |  PWM output-

*              |  |  Ground



.subckt PWM_G_EXP PH PL GND

*in this here V1 is Vinitial V2 is Von

*Ncycles remove always have

*Vxxx n+ n- PULSE(V1 V2 Tdelay Trise Tfall Ton Tperiod Ncycles)

*                                   DT=0.2us

Vph1 PH GND PULSE(0 5 1m 0.01u 0.01u 4.8u 10u)

*          if function is an operation,you need to add{}

Vpl1 PL GND PULSE(0 5 {1m+5u} 0.01u 0.01u 4.8u 10u)

.ends


  1. put the cursor at ".subckt PWM_G_EXP PH PL GND " , then click the Right key, select "Create Symbol"

  1. Add part into the schematic sheet.

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值