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.

03-12
### LTspice 下载、安装与使用教程 #### 下载 LTspice LTspice 是一款由 Analog Devices 提供的免费高性能 Spice III 仿真软件,集成了原理图捕获工具和波形查看器。该软件支持多种类型的电路仿真,并特别优化了开关稳压器的设计流程[^1]。 为了获取最新版本的 LTspice 及其相关资源,建议访问官方站点 Analog Devices 的 LTspice Information Center 页面进行下载[^4]。这里不仅提供程序本身,还包括丰富的文档和支持材料,帮助用户快速上手并充分利用这款强大的设计辅助工具。 #### 安装过程简介 安装文件通常是一个自解压缩包,在执行时会引导用户完成整个设置向导。按照提示逐步操作即可顺利完成安装。值得注意的是,首次启动应用程序时可能还需要配置一些初始参数,比如工作目录的选择等[^2]。 #### 基础使用指南 - **界面概览**:打开 LTspice 后,可以看到简洁直观的操作环境,左侧为元件库列表,右侧为主绘图区。 - **创建新项目**:通过菜单栏中的“File -> New Schematic”命令来新建一张空白图纸。 - **放置组件**:利用鼠标点击所需元器件图标拖放到编辑区内;也可以直接键入名称搜索特定部件。 - **连接线路**:选中任意两个端点之间的位置画线即形成电气连接关系。 - **设定属性**:双击某个对象可弹出对话框调整具体数值或其他特性。 - **运行分析**:完成后保存工程再选择合适的仿真模式(如瞬态响应、频率扫描),最后按下 F9 键开始计算处理数据。 对于初学者来说,《LTspice 电路仿真软件教程—基础篇》是一份不可多得的学习资料,它详细介绍了上述各个方面的要点,非常适合用来作为入门指导手册。 ```python import webbrowser def open_ltspice_website(): url = 'https://www.analog.com/en/design-center/ltspice.html' webbrowser.open(url) open_ltspice_website() ``` 此段 Python 代码可用于一键跳转至 LTspice 官方网站页面,方便快捷地找到更多关于这个优秀平台的信息和服务。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值