1. 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.
    Dismiss Notice

LT Spice Subcircuits on LT Spice XVII

Discussion in 'Circuit Simulation & PCB Design' started by JebRadic, May 15, 2018.

  1. JebRadic

    JebRadic New Member

    Joined:
    Sep 15, 2015
    Messages:
    5
    Likes:
    0
    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.
     

    Attached Files:

  2. alec_t

    alec_t Well-Known Member Most Helpful Member

    Joined:
    Jul 10, 2011
    Messages:
    9,656
    Likes:
    1,269
    Location:
    Cardiff, Wales
    LTS looks for model files in either the folder the project is in, or the lib/sub folder (not the lib/asy folder).
     
  3. JebRadic

    JebRadic New Member

    Joined:
    Sep 15, 2015
    Messages:
    5
    Likes:
    0
    I put the .asc file in lib/sub, but still get the error I listed in the previous post.
     
  4. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  5. MikeMl

    MikeMl Well-Known Member Most Helpful Member

    Joined:
    Mar 17, 2009
    Messages:
    11,401
    Likes:
    595
    Location:
    AZ 86334
    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).
     

    Attached Files:

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice