Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LT Spice Subcircuits on LT Spice XVII

Status
Not open for further replies.

JebRadic

New Member
Hello, I have been trying for the last night and a half to get sub circuits to work with LT spice. I have followed the tutorial at this url:


And I have created the attached files. The two "PeakDetector.*" files, I have placed in documents/ltspiceXVII/lib/sym/CustomElements. I can access the symbol from LT Spice from the F2 menu, and it shows shows fine when being placed, but running the simulation from tmp.asc, I get the following error.

(I would insert this error as code, but the entry page goes white when I select insert>code and I can't do anything)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Circuit: * C:\Users\[my username]\Documents\Projects\LT Spice\tmp.asc

Expanding empty subcircuit: peakdetector
WARNING: Less than two connections to node N002. This node is used by V1.
WARNING: Less than two connections to node N001. This node is used by V2.
Direct Newton iteration for .op point succeeded.

Date: Tue May 15 21:44:28 2018
Total elapsed time: 0.048 seconds.

tnom = 27
temp = 27
method = modified trap
totiter = 2087
traniter = 2084
tranpoints = 1043
accept = 1043
rejected = 0
matrix size = 4
fillins = 0
solver = Normal
Matrix Compiler1: 46 bytes object code size 1.1/1.0/[1.0]
Matrix Compiler2: 160 bytes object code size 1.1/1.0/[1.0]

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Some more information for those who don't want to download the files and look at them:

-In the attributes menu for the symbol, I have set value=PeakDetector
-I have matched (or at least I think I have) the nets on the subcircuit to the pins on the symbol.
-I have both the PeakDetector.asc and PeakDetector.asy files in the same folder: lib/sym/CustomElements
-I have tried renaming PeakDetector.asc to various names (pdect.asc for example) and rebuilding the symbol from the ground up.

Given that I've been trying to get this to work for 2 whole evenings to no avail, I am in need of help. I've tried multiple sources online - forums, stack overflow, etc - but I must be missing something obvious.

Thanks.
 

Attachments

  • PeakDetector.asc
    2 KB · Views: 204
  • PeakDetector.asy
    374 bytes · Views: 192
  • tmp.asc
    620 bytes · Views: 207
I have both the PeakDetector.asc and PeakDetector.asy files in the same folder: lib/sym/CustomElements
LTS looks for model files in either the folder the project is in, or the lib/sub folder (not the lib/asy folder).
 
Before worrying about making it hierarchical, how about making it do something useful?

I don't know what you think it is supposed to do, but almost certain you don't know how to use the LTSpice special logic. Here is a version for you to try that simulates, but if it does something useful, only you will know.

Please read the LTSpice help file section "A. Special Functions". Look at the parameters I set on the Nor gate instance.

The opamp used as a comparator needs some hysteresis to keep it from oscillating if there is no dv/dt at V(vin).
 

Attachments

  • PeakDetectorM.asc
    2 KB · Views: 196
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top