2
\$\begingroup\$

I'm trying to simulate the following circuit in Altium before going to PCB route:

enter image description here

But I get the following pin errors:

enter image description here

I found the SPICE model and tried to assign them to this footprint:

enter image description here

Here is how I link the .ckt file:

enter image description here

Here is the how I made the pin assignments:

enter image description here

the rest of assignments:

enter image description here

And finally here is the SPICE ckt file's code:

* * * (DUAL) RETRIGGERABLE MONOSTABLE MULTIVIBRATOR * Pulse Width Tw = 0.5 * R * C * tpd R,A,B->Q 30n * Tpulse 75n, C=0, Rext=5k .SUBCKT 74HC123 A B CLR CGND RC Q QN VCC VGND vcc1={vcc} speed1={speed} tripdt1={tripdt} .param egain=1/{vcc1} .param td5=1e-9*(5)*4.0/({vcc1}-0.5)*{speed1} .param td2=1e-9*(2)*4.0/({vcc1}-0.5)*{speed1} * XINA A Ai VCC VGND 74HC_IN_1 vcc2={vcc1} speed2={speed1} tripdt2={tripdt1} XINB B Bi VCC VGND 74HC_IN_1 vcc2={vcc1} speed2={speed1} tripdt2={tripdt1} XINCLR CLR CLRi VCC VGND 74HC_IN_1 vcc2={vcc1} speed2={speed1} tripdt2={tripdt1} XINRC1 RC RCi VCC VGND 74HC_IN_0 vcc2={vcc1} speed2={speed1} tripdt2={tripdt1} * * Model of a 74HC123 derived from SGS-Thomson data sheet. * Helmut Sennewald, 13.9.2002 A4 DHIGH 0 N014 0 N004 N006 N005 0 DFLOP tripdt={tripdt1} td={td5} A3 0 N015 N016 N023 0 N014 0 0 OR tripdt={tripdt1} td={td5} A1 Ai 0 0 0 0 0 N015 0 SCHMITT Vt=0.46 Vh=0.02 tripdt={tripdt1} td={td5} A2 Bi 0 0 0 0 N016 0 0 SCHMITT Vt=0.46 Vh=0.02 tripdt={tripdt1} td={td5} A6 0 N008 0 N006 0 N007 0 0 AND tripdt={tripdt1} td={td5} A5 0 N009 0 N007 0 N008 0 0 AND tripdt={tripdt1} td={td5} A14 0 N003 0 N021 0 N004 0 0 AND tripdt={tripdt1} td={td2} A13 0 N003 0 N005 0 0 N030 0 AND tripdt={tripdt1} td={td5} A12 N005 0 0 0 0 N012 0 0 BUF tripdt={tripdt1} td={td5} A21 0 N010 0 N011 0 0 N009 0 OR tripdt={tripdt1} td={td5} A22 0 N005 0 N007 0 N010 0 0 OR tripdt={tripdt1} td={td5} A11 0 N013 0 N012 0 0 N003 0 OR tripdt={tripdt1} td={td5} A7 0 N007 0 N018 0 QNi Qi 0 AND tripdt={tripdt1} td={td5} A20 RCi 0 0 0 0 N011 0 0 SCHMITT tripdt={tripdt1} td={td5} Vt=0.44 Vh=0.2m A10 RCi 0 0 0 0 0 N013 0 SCHMITT tripdt={tripdt1} td={td5} Vt=0.1 Vh=0.2m A32 0 N006 0 N021 0 N022 0 0 OR tripdt={tripdt1} td={td5} A31 0 N022 0 N023 0 N021 0 0 OR tripdt={tripdt1} td={td2} A33 N021 0 0 0 0 N019 0 0 BUF tripdt={tripdt1} td={td5} A30 CLRi 0 0 0 0 N023 0 0 BUF tripdt={tripdt1} td={td5} A34 0 N007 0 N006 0 N020 0 0 AND tripdt={tripdt1} td={td5} A35 0 N020 0 N018 0 N017 0 0 OR tripdt={tripdt1} td={td5} A36 0 N017 0 N019 0 N018 0 0 OR tripdt={tripdt1} td={td5} M10 RC N001 VGND VGND NMOS1 M30 RC N024 VCC VCC PMOS1 D1 RC VCC DIO1 D2 VGND RC DIO1 R10 N001 N002 100 R30 N024 N029 100 R3 CGND VGND 1 E4 RCi 0 RC VGND {egain} E7 N029 VCC N018 0 {vcc1} E8 N002 VGND N030 0 {vcc1} V1 DHIGH 0 DC 1 .MODEL NMOS1 NMOS ( LEVEL=3 W=500e-6 L=1E-6 VTO=1 + VMAX=1E6 RS=10 RD=10 CJ=0.002 MJ=0.4 +THETA=1E-6 ETA=0.01 KAPPA=2.2) .MODEL PMOS1 PMOS ( LEVEL=3 W=500e-6 L=1E-6 VTO=-1 + VMAX=1E6 RS=10 RD=10 CJ=0.002 MJ=0.4 +THETA=1E-6 ETA=0.01 KAPPA=2.2) .MODEL DIO1 D (IS=10p RS=10 N=1.75 M=0.4 Cjo=6p TT=20n) * XOUT0 Qi Q VCC VGND 74HC_OUT_1X vcc2={vcc1} speed2={speed1} tripdt2={tripdt1} XOUT1 QNi QN VCC VGND 74HC_OUT_1X vcc2={vcc1} speed2={speed1} tripdt2={tripdt1} .ends * * * 

I couldn't figure out where I am doing wrong. What can I do to solve this issue?

\$\endgroup\$
1
  • \$\begingroup\$ +1 for clear screenshots as well as what you've attempted so far to resolve the problem \$\endgroup\$ Commented Jul 3, 2018 at 18:23

3 Answers 3

1
\$\begingroup\$

There are two faults here:

  1. A single-unit SPICE model can't be attached to a dual symbol in Altium. It's a limitation of the platform, but it is easily addressed by making a two-section Part. Each section gets its own instance. (You can simply not place the second instance and ignore the Part warning, rather than placing it and strapping it as unused.)

  2. The SPICE definition itself is wrong. I don't know how this happened, if LTSpice uses a different .SUBCKT definition or what, but the PARAMS: keyword is missing, between the list of nodes and the list of parameters.

This might be corrected as so:

.SUBCKT 74HC123 A B CLR CGND RC Q QN VCC VGND PARAMS: vcc1={vcc} speed1={speed} tripdt1={tripdt} 

Note that the vcc, speed and tripdt parameters have to be set globally (Design/Simulate/Mixed Sim, or Setup Mixed-Signal Simulation; Analyses Setup, Global Parameters). SPICE statements cannot be strewn about the schematic unlike most simulators.

The problem compounds, however. You also need to find substitutes for ALL the logic elements, which use the LTSpice propietary logic primitive. For example:

A21 0 N010 0 N011 0 0 N009 0 OR tripdt={tripdt1} td={td5} 

Seems to be an OR gate, presumably between N010 and N011 (inputs) and N009 (output). Note that equivalent timing parameters must be entered as well.

Altium uses a modified XSPICE engine, so these can perhaps be substituted with primitives from that platform.

Example:

enter image description here

Source: F.L. Cox, W.B. Kuhn, H.W. Li, J.P. Murray, S.D. Tynor, and M.J. Willis, Xspice User's Manual, Georgia Institute of Technology, Computer Science and Information Technology Laboratory (Dec. 1992); p.141.

The bracketed list specifies a vector of input nodes. See the above reference, and LTSpice help for more information.[1] You may also be interested in porting elements to SimCode: https://techdocs.altium.com/display/AMSE/Digital+SimCode+Reference

Current versions of Altium may support more variants of syntax; I don't have an up-to-date version to compare. The above is correct through AD18, period-appropriate to the question.

[1] A correct link, but not very useful given its present content. Evidently this wiki is not well curated. This seems the more useful page: https://ltwiki.org/index.php?title=Undocumented_LTspice#A-Devices

\$\endgroup\$
0
\$\begingroup\$

The model only has these inputs, which is only one section of the inputs for the T-flip flop. Your model has two, your sub circuit only has one.

.SUBCKT 74HC123 A B CLR CGND RC Q QN VCC VGND

Typically spice files don't have dual parts inside of them, because they can be duplicated outside of the part. The code will need to be duplicated for both halves of the part.

There are a few options to correct this: 1) duplicate the library file and write a new one that has two of the 74HC123 sub circuits.
2) Change the graphical part to only have one flop not two. (which you probably don't want to do to mach the real world schematic)
3) This might be solvable in the netlist by doing something like this (but I have not tried it)

enter image description here

\$\endgroup\$
1
  • \$\begingroup\$ I tried your 3rd suggestion I get pin errors again \$\endgroup\$ Commented Jul 3, 2018 at 23:18
-1
\$\begingroup\$

The SN74123 appears to be a dual monostable. However, the sim model looks to be just for a single instance.

The schematic indicates that you are interested in the operation of just one instance as well.

To get this to work, do not try to map the pins of the unused (2nd) instance (I've always had trouble with Altium and multi-part components with sim). Just map the pins for part A.

Your Model Kind statement should end up with just 9 parameters (as listed in the circuit sim file:

@DESIGNATOR %1 %2 %3 %4 %5 %6 %7 %8 %9 @MODEL

with %1 corrsesponding with "A", %2 to "B", and so on:

.SUBCKT 74HC123 A B CLR CGND RC Q QN VCC VGND

For example, here's a declaration for Part A of a dual Amp: enter image description here


I am not familiar with the significance of the rest of the model statement in the sim file:

vcc1={vcc} speed1={speed} tripdt1={tripdt}

perhaps you will need to define these values as global parameters in your sim setup? Or maybe you can define them as constants in the model line? I don't know. Try and find out...

\$\endgroup\$
3
  • \$\begingroup\$ I tried your suggestion @DESIGNATOR %1 %2 %3 %4 %5 %6 %7 %8 %9 MODEL and set the rest unconnected and I dont have pin assignment error now. But now I get error related to vcc1={vcc} speed1={speed} tripdt1={tripdt} . How and where can I set those to VCC=5 SPEED=1.0 TRIPDT=1e-9 ? \$\endgroup\$ Commented Jul 3, 2018 at 23:37
  • \$\begingroup\$ I get errors like: [Error] 74hc123 XSpice Unknown subckt: xina a ai vcc vgnd 74hc_in_1 vcc2={vcc1} speed2={speed1} tripdt2={tripdt1} \$\endgroup\$ Commented Jul 3, 2018 at 23:38
  • \$\begingroup\$ As a test, edit the model file with the constants you want. If that works, then you can continue as is, or try to figure out how to pass the constants in from Altium. \$\endgroup\$ Commented Jul 5, 2018 at 11:52

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.