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.

Tina-TI Spice Dissapointment at Simulating LM393. Need Proper Model.

Status
Not open for further replies.

shafri

Member
Hi newbie here. Firstly, sorry if my post got mistakes... I just downloaded TINA-TI from Texas instrument. tried to simulate some stuff, ie mix between TI Chip THS3095 and LM393. Long story short, Tina cannot simulate LM393 behaviour properly. From simulation, i can get LM393 "comparating" at/from 20++ MHz 1Vpp Sine signal. But in the real life circuit, i only can get LM393 stable up to 1.5MHz only. beyond that (2++ MHz), LM393 will simply flattened)

So if i were to trust the simulation, directly make the pcb and solder the components, expecting it to work up to 20++ MHz, i will be in total dissapointment. So any advice from expert here? is this the end of SIM for me? ie just rely on datasheets and make the real circuit right away, and do the debugging later? on the real circuit? or is there still hope for the SIM? any better model available to simulate LM393?

Here is my current LM393 model which i got from TI's site (ti_pspice_models.zip). And i provided the picture of the simulation result (tina.png) vs the real circuit behaviour (real.png) Hope to hear some advice. thanx.

Code:
* LM393 VOLTAGE COMPARATOR "MACROMODEL" SUBCIRCUIT
* CREATED USING PARTS VERSION 4.03 ON 03/07/90 AT 14:17
* REV (N/A)
* CONNECTIONS:   NON-INVERTING INPUT
*                | INVERTING INPUT
*                | | POSITIVE POWER SUPPLY
*                | | | NEGATIVE POWER SUPPLY
*                | | | | OPEN COLLECTOR OUTPUT
*                | | | | |
.SUBCKT LM393    1 2 3 4 5
*
  F1    9  3 V1 1
  IEE   3  7 DC 100.0E-6
  VI1  21  1 DC .75
  VI2  22  2 DC .75
  Q1    9 21  7 QIN
  Q2    8 22  7 QIN
  Q3    9  8  4 QMO
  Q4    8  8  4 QMI
.MODEL QIN PNP(IS=800.0E-18 BF=2.000E3)
.MODEL QMI NPN(IS=800.0E-18 BF=1002)
.MODEL QMO NPN(IS=800.0E-18 BF=1000 CJC=1E-15 TR=807.4E-9)
  E1   10  4  9  4  1
  V1   10 11 DC 0
  Q5    5 11  4 QOC
.MODEL QOC NPN(IS=800.0E-18 BF=20.29E3 CJC=1E-15 TF=942.6E-12 TR=543.8E-9)
  DP    4  3 DX
  RP 3  4 46.3E3
.MODEL DX  D(IS=800.0E-18)
*
.ENDS
 

Attachments

  • tina.png
    tina.png
    113.7 KB · Views: 1,984
  • real.png
    real.png
    23.7 KB · Views: 592
hi,
No way will a LM393 work at 20MHz in the real world.
Look at this clip from the pdf.

EDIT:
Looking thru the LM393 model that you posted, it was created in 1990, I would suggest you search the web for a more up to date model.

If you post your Tina file for this project I will try it in my Tina program.
 

Attachments

  • AAesp01.gif
    AAesp01.gif
    38.4 KB · Views: 574
Last edited:
hi,
No way will a LM393 work at 20MHz in the real world.
Look at this clip from the pdf.

EDIT:
Looking thru the LM393 model that you posted, it was created in 1990, I would suggest you search the web for a more up to date model.
If you post your Tina file for this project I will try it in my Tina program.

i know and i read the lm393 datasheet. it sure cannot perform at 20MHz. even at 1MHz it start to attenuate. but in sim we still get a usable output up to 50MHz!
and yes, i believe the fault is in the LM393 spice model, i'm reading SPICE book right now, but still a long way to go :(.
thanx for offering the help eric, here is the lm393 circuit i used. i made simplification by removing the ths3095 which is not the problem and to avoid confusion. i left the parasitic sim intact though.
if there is up to date lm393 spice model, i will be glad to have. finding in google dont give me any luck. thanx.
 

Attachments

  • my_lm393.zip
    6.3 KB · Views: 446
Last edited:
Here is a newer (2006) LM393 model from On Semi. It still won't work above ~1MHz, but you can put it in your Lib for future use perhaps. I'll also include the model for the MAX961 which will work fine at 100MHz and a little beyond. I had to modify the .asy file to fit the non-default .sub file for LT Spice so beware of that. I'm not at all familiar with TINA. Hopes this helps.


* ============================================================
* | LM293, LM393, LM2903, LM2903V, NCV2903
* | Comparator MACRO-MODEL
* | Designed in pSpice Version 9.2
* |
* | The content of this model is subject to change
* | without notice and may not be modified or altered
* | without permission from ON Semiconductor. This model
* | has been carefully checked and is believed to be
* | accurate, however ON Semiconductor does not assume
* | liability for the use of this model or the results
* | obtained from using it.
* ============================================================

* ============================================================
* Features: - Wide Single-Supply Range: 2.0 Vdc to 36 Vdc
* - Split-Supply Range: +/-1.0 Vdc to +/-18 Vdc
* - Very Low Current Drain Independent of
* Supply Voltage: 0.4 mA
* - Low Input Bias Current: 25 nA
* - Low Input Offset Current: 5.0 nA
* - Low Input Offset Voltage: 5.0 mV (max) LM293/393
* - Input Common Mode Range to Ground Level
* - Differential Input Voltage Range Equal to Power
* Supply Voltage
* ============================================================

* $Author: Vallabh Chilakapati $
* $Date: 11 Aug 2006 $

* NOTE: - Noise is not modeled.
* - Temperature is not modeled.
* - PSR is not modeled.
* - Model is for single device only. Simulated supply current is 1/2 of
* total package current.

* Connections:
* Non-Inverting Input
* | Inverting Input
* | | +ve Supply Voltage
* | | | -ve Supply Voltage
* | | | | Output
* | | | | |
.SUBCKT LM2903 1 2 11 12 24

***** Input Stage *****
Q_Q1 4 1 6 QPNP1
Q_Q2 7 2 9 QPNP2
I_I1 111 10 DC 0.6m
R_RC1 4 12 95.49
R_RC2 7 12 95.49
R_RE1 10 6 45.49
R_RE2 10 9 45.49

***** Gain Stage & Frequency Response Stage *****
E_Eref 14 0 poly(2) (12,0) (11,0) 0 0.09091 0.09091
R_Rgnd 11 0 100k
I_Ignd 0 11 0.24m
Vsup 111 11 0
G_Ignd 0 11 poly(1) (11,0) 0 0.00678m
G_G1 14 15 7 4 0.01047
R_Rc 14 15 26.3Meg
C_Cc 14 15 0.00667n

***** Output Stage *****
E_E1 22 14 15 14 1
V_F1 23 24 0
F_F1 11 0 V_F1 1
R_Rout 22 23 13

***** Output Voltage Limiting *****
D_D1 15 18 D10D1
D_D2 19 15 D10D1
V_Voh 111 18 0.62
V_Vol 19 12 0.62

***** Models *****
.model QPNP1 PNP(Is=1E-15 Bf=8293.8)
.model QPNP2 PNP(Is=1E-15 Bf=9663.8)
.MODEL D10D1 D IS=1E-15 RS=1.000E-3 VJ=.75 BV=100E6
.ENDS


* MAX961 MACROMODEL
* ------------------------------
* Revision 0, 8/2005
* ------------------------------
* Model Platform: Pspice
*-------------------------------
* The MAX961 series comparators are low power, ultra-high-speed devices with
* internal hysterisis. These devices are optimized for single +3V to +5V
* operation and the input common mode range extends 100mV Beyond-the-rails.
* ------------------------------
* Note1: Shutdown delay times and Input impedance are not modeled.
*-------------------------------
* Connections
* 1 = IN+
* 2 = IN-
* 3 = SHDN
* 4 = LE
* 5 = GND
* 6 = Q
* 7 = Q\
* 8 = VCC
*******************************
.SUBCKT MAX961 1 2 3 4 5 6 7 8
*******************************
VG1 G1 5 0V
VRG1 V1 G1 1V
VRG2 V5 G1 0.5V
VRG3 V2 G1 2V
*******************************
*INPUT STAGE
GBIAS 8 IN1 VALUE={V(V1,SH1)*2.1M}
QIN1 IN2 IN4 IN1 QP1
QIN2 IN3 IN6 IN1 QP1
RIN1 IN2 G1 0.1K
RIN2 IN3 G1 0.1K
EPSR IN4 IN5 VALUE={V(8,G1)*0.05M}
ECMR IN7 IN5 VALUE={V(IN1,G1)*100U}
VOS IN7A IN7 0.1M
CIN1 IN4 G1 3P
CIN2 IN6 G1 3P
CPD IN2 IN3 10.3P
VIL CM1 G1 550M
EIL CM2 G1 VALUE={V(8,G1)+0.75}
DIL1 CM1 IN1 DA
DIL2 IN1 CM2 DA
********
*IN PROTECTION
RIN3 1 IN7A 200
RIN4 2 IN6 200
DI1 IN7 IN10 DB
DI2 IN10 IN11 DB
DI3 IN11 IN6 DB
DI4 IN6 IN8 DB
DI5 IN8 IN9 DB
DI6 IN9 IN7 DB
*****************
*GAIN STAGE
GA1 G1 A1 VALUE={V(IN3,IN2)+V(A1,V5)*12.63M}
RA1 A1 G1 10K
DA2 G1 A1 DA
DA1 A1 V1 DA
CA1 G1 A1 0.2P
EA1 A2 G1 A1 G1 1
RA2 A2 A3 1K
CA2 A3 G1 1.2P
XBUF1 A3 A4 G1 BUFF
.I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H1,G1)*V(8,G1)}
MS1 A6 SH2 6 G1 MOSN L=5U W=1M
MS2 A6 SH3 6 8 MOSP L=5U W=1M
MS3 A7 SH2 7 G1 MOSN L=5U W=1M
MS4 A7 SH3 7 8 MOSP L=5U W=1M
*****************
*SUPPLY CURRENTS
ISUP 8 G1 0.271M
GSUP 8 G1 V1 SH1 4.82M
**********************************************************
.MODEL QP1 PNP(IS=16E-15 BF=70)
.MODEL QN1 NPN(IS=16E-15 BF=70)
.MODEL MOSN NMOS(VTO=1.0 KP=88E-4)
.MODEL MOSP PMOS(VTO=-1.0 KP=88E-4)
.MODEL DA D(N=0.1M)
.MODEL DY D(N=10M)
.MODEL DB D(IS=100E-14)
**********************************************************
.ENDS
****************************
.SUBCKT NOR IN1 IN2 OUT G1 V1
EN1 N1 G1 IN1 G1 1
EN2 N2 G1 IN2 G1 1
DN1 N1 N3 DA
DN2 N2 N3 DA
RN1 N3 G1 1MEG
EN3 N4 G1 V1 N3 2
RN2 N4 N5 1K
CN1 N5 G1 1.5P
MN1 N6 N5 G1 G1 MOSN L=5U W=1M
RN3 V1 N6 100K
EN4 N9 G1 N6 G1 2
RN4 N9 N7 1K
CN2 N7 G1 1.5P
MN2 OUT N7 G1 G1 MOSN L=5U W=1M
RN5 V1 OUT 100K
.MODEL MOSN NMOS(VTO=1.0 KP=88E-6)
.MODEL DA D(N=0.1M)
.ENDS
****************************
****************************
.SUBCKT DG_IN IN OUT G1 VCC
EREF DG2 G1 VALUE={(V(VCC,G1)*0.5)+0.4}
EHYST DG2 DG3 VALUE={V(DG1,G1)*0.8}
GD1 G1 DG1 IN DG3 10M
DD1 G1 DG1 DA
DD2 DG1 V1 DA
CD1 DG1 G1 1P
VD1 V1 G1 1V
VOUT DG1 OUT 0V
RIN1 IN G1 333.3K
RIN2 VCC IN 333.3K
.MODEL DA D(N=0.1M)
.ENDS
****************************
****************************
.SUBCKT BUFF IN OUT G1
VRG1 V1 G1 1V
VRG2 V5 G1 0.5V
GBU1 G1 BU1 VALUE={V(IN,V5)+(V(BU1,G1)*10M)}
DBU1 BU1 V1 DA
DBU2 G1 BU1 DA
CBU1 BU1 G1 0.1P
EOUT OUT G1 BU1 G1 1
RBU1 BU1 G1 1MEG
.IC V(BU1)=0.5
.MODEL DA D(N=0.1M)
.ENDS
****************************
 
Thanx MrCecil. that will help alot. i copy pasted the spice script name and made LM393x for tina *.tsm/cir/txt (included here). the sim shows better result, but still not the real one. i wont hope too much. thank you.
 

Attachments

  • LM393x.zip
    4 KB · Views: 386
  • lm393_2006.png
    lm393_2006.png
    40.2 KB · Views: 522
Thanx MrCecil. that will help alot. i copy pasted the spice script name and made LM393x for tina *.tsm/cir/txt (included here). the sim shows better result, but still not the real one. i wont hope too much. thank you.
hi,
I cannot open your *.tsm file.??
 
hi,
I cannot open your *.tsm file.??

*.cir should be put in C:\Program Files\DesignSoft\Tina 9 - TI\SPICELIB
*.tsm should be put in C:\Program Files\DesignSoft\Tina 9 - TI\MACROLIB

at least thats what i learnt from their structure. and this is my first install, i dont know if direct copy to library folder is applicable. i tried to make a hack earlier with some model, but tina reported unsuccesfull/invalid library load.
if it cannot work, you have to remake the tsm again by the following step:

1) insert any existing spice macro model (pin compatible) into a new project
2) double click the model/component to enter macro
3) copy pasted the spice macro (*.txt in my case) in the editor and save as *.cir
4) go to tina menu tool->new macro wizard, fill the required form and load the *.cir earlier, save as *.tsm
5)load the newly created model by goto tina menu>insert->macro.
6) done!

thats my dirty hack :p here again i included the test file *.tsc, library *.cir/*.tsm and the main spice macro script *.txt for lm393 (ver 4.03) and lm393x (ver 9.2). i hope that help.
 

Attachments

  • LM393x2.zip
    12.9 KB · Views: 420
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top