Three question about subckt.

Help
lpc2138
2012-12-30
2013-06-12
  • lpc2138
    lpc2138
    2012-12-30

    1 can the subckt name be start with a number ?
    2 is the subckt name case sensitive?
    3 why the bellow code don't work in ngspice ,but work under ltspice ?

    sq
    .tran 10m 1s 0
    XU1 R2_1 C1_2 15V -15V R4_1 UA741
    XD2 GND XD2_2 D1N4738A
    XD1 VOLPROBE XD2_2 D1N4738A
    V2 15V GND  15
    V1 -15V GND  -15
    R4 R4_1 VOLPROBE  1k
    R3 GND R2_1  1k
    R2 R2_1 R4_1  1k
    R1 C1_2 R4_1  1k
    C1 GND C1_2  1u
    .save V(VOLPROBE) 
    * UA741 OPERATIONAL AMPLIFIER \"MACROMODEL\" SUBCIRCUIT
    * CREATED USING PARTS RELEASE 4.01 ON 07/05/89 AT 09:09
    * (REV N/A)      SUPPLY VOLTAGE: +/-15V
    * CONNECTIONS:   NON-INVERTING INPUT
    *                | INVERTING INPUT
    *                | | POSITIVE POWER SUPPLY
    *                | | | NEGATIVE POWER SUPPLY
    *                | | | | OUTPUT
    *                | | | | |
    .SUBCKT UA741    1 2 3 4 5
    *
      C1   11 12 4.664E-12
      C2    6  7 20.00E-12
      DC    5 53 DX
      DE   54  5 DX
      DLP  90 91 DX
      DLN  92 90 DX
      DP    4  3 DX
      EGND 99  0 POLY(2) (3,0) (4,0) 0 .5 .5
      FB    7 99 POLY(5) VB VC VE VLP VLN 0 10.61E6 -10E6 10E6 10E6 -10E6
      GA 6  0 11 12 137.7E-6
      GCM 0  6 10 99 2.574E-9
      IEE  10  4 DC 10.16E-6
      HLIM 90  0 VLIM 1K
      Q1   11  2 13 QX
      Q2   12  1 14 QX
      R2    6  9 100.0E3
      RC1   3 11 7.957E3
      RC2   3 12 7.957E3
      RE1  13 10 2.740E3
      RE2  14 10 2.740E3
      REE  10 99 19.69E6
      RO1   8  5 150
      RO2   7 99 150
      RP    3  4 18.11E3
      VB    9  0 DC 0
      VC 3 53 DC 2.600
      VE   54  4 DC 2.600
      VLIM  7  8 DC 0
      VLP  91  0 DC 25
      VLN   0 92 DC 25
    .MODEL DX D(IS=800.0E-18)
    .MODEL QX NPN(IS=800.0E-18 BF=62.50)
    .ENDS
    .subckt D1N4738A 1 2
    D1 1 2 D1
    D2 2 3 D2
    I1 1 3 1.61312
    R1 1 3 4.5 TC1=0.6337m
    .model D1 D IS=9.19e-16 CJO=150p RS=0.57061 ISR=4.41e-08
    .model D2 D IS=1.00e-15
    .ends
    .END
    

    the error message
    Error: unknown subckt: xd2 0 xd2_2 d1n4738a

    Error: there aren\'t any circuits loaded.

    you know d1n4738a is exist.
    thanks. and happy new year.

     
  • marcel hendrix
    marcel hendrix
    2012-12-30

    Change the first few lines to these:

    -8<---------
    * name D1N4738A not recognized

    .tran 1u 50m 0
    XU1 R2_1 C1_2 15V -15V R4_1 UA741
    XD2 GND XD2_2 D1N4738A
    -8<-----------

    .. and the your 437 Hz squarewave oscillator will run better in NGSPICE than in LTSpice.
    The ISR parameter is not understood, but it doesn't influence the result.

    -marcel