Hi, Can anybody help me with a spice model that will closely simulate the TC1025 dual comparator please? Thank you Johan Smit
TC1025 comparator spice model
Dec 21, 2004
20 Replies
Hi, Can anybody help me with a spice model that will simulate the TC1025 dual comparator please? Thank you Johan Smit
Which simulator are you using?
...Jim Thompson
-- | James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | |
formatting link
| 1962 | I love to cook with wine. Sometimes I even put it in the food.
Hi Jim, I normally use Swcad3, because it can use the original Spice ascii libs, which I had from DOS days. I have others, depending on which lib I can get. The TC1025 appears nice, rail to rail, and I would like to use it in a circuit to replace LM393, which has no active pull-up. If I cannot get a spice model for the TC1025, could you perhaps recommend a replacement comparator, for low power (battery) use? Thank you Johan Smit
Johan, I have a configurable comparator model, but it uses "tanh" in the transfer function. Can Swcad3 handle "tanh"?
...Jim Thompson
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus |
| Phoenix, Arizona Voice:(480)460-2350 | |
| E-mail Address at Website Fax:(480)460-2142 | Brass Rat |
| http://www.analog-innovations.com | 1962 |
I love to cook with wine. Sometimes I even put it in the food.
I figured it did. What is the syntax?
...Jim Thompson
-- | James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | |
formatting link
| 1962 | I love to cook with wine. Sometimes I even put it in the food.
Jim,
Of course LTspice does tanh().
--Mike
Jim,
You can just use PSpice syntax in LTspice. If you're interested, LTspice's native syntax is documented in the help section (F1 Key)=>
LTspice=>Circuit Elements=>B. Arbitrary behavioral voltage or current sources.
But it runs PSpice macromodel syntax flawlessly.
--Mike
Hi Jim,
From the Swcad3 help file: "LTspice is the circuit simulation engine for the SwitcherCAD III." and as Mike said, LT Spice can do it. So I must conclude that Swcad3 can handle tanh. Looking forward to your module. Thanks for all the replies. Regards Johan Smit
Hi Johan, I think the following is correct... I had to re-write it in subcircuit format... it is from some of my old stuff where I used to place everything inside the symbol. Give it a whirl. If it balks, let me know.
..SUBCKT CompBeh INP INN OUT PARAMS: HIGH=5 LOW=0 DELTA=5m T=10n
** HIGH = High Output Level (Volts) ** LOW = Low Output Level (Volts) ** DELTA = Transition Width (Input, Volts) ** T = Delay R1 int1 0 1G R2 int1 int2 {SQRT(T/0.693147)} C1 int2 0 {SQRT(T/0.693147)} E2 OUT 0 VALUE = {V(int2,0)*(HIGH-LOW)+LOW} E1 int1 0 VALUE = {(tanh(A*V(INP,INN))+1)/2} ..PARAM A = 2.197774/DELTA ..ENDS CompBeh...Jim Thompson
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus |
| Phoenix, Arizona Voice:(480)460-2350 | |
| E-mail Address at Website Fax:(480)460-2142 | Brass Rat |
| http://www.analog-innovations.com | 1962 |
I love to cook with wine. Sometimes I even put it in the food.
Looks fine. Now add power supply CURRENTS ;-)
...Jim Thompson
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus |
| Phoenix, Arizona Voice:(480)460-2350 | |
| E-mail Address at Website Fax:(480)460-2142 | Brass Rat |
| http://www.analog-innovations.com | 1962 |
I love to cook with wine. Sometimes I even put it in the food.
Hi Great One Jim, I changed a few things to add the supply connections. Here is the .Lib file :
..SUBCKT CompCMOS 1 2 3 4 5 PARAMS: DELTA=5m T=10n
** DELTA = Transition Width (Input, Volts) ** T = Delay R1 int1 4 1G R2 int1 int2 {SQRT(T/0.693147)} C1 int2 4 {SQRT(T/0.693147)} E2 5 4 VALUE = {V(int2,4)*V(3,4)+V(4)} E1 int1 4 VALUE = {(tanh(A*V(1,2))+1)/2} ..PARAM A = 2.197774/DELTA ..ENDS CompCMOSand the little capacity controlled oscillator
VS1025.CIR ..LIB CompCMOS.LIB Vsupply Vs 0 3v R1 2 5 1MEG R2 5 7 470K R3 6 7 220K R4 1 2 220K R5 7 0 100K ;load C1 2 6 100PF ;CX C2 2 0 200PF ;stray C3 6 0 200PF ;stray C4 Vs 0 100NF ;decoupling XCOMP1 5 6 Vs 0 7 CompCMOS XCOMP2 6 7 Vs 0 1 CompCMOS ..IC V(2)=1v ..tran 0.1u 1m 0 0 ..probe
Works like a charm, but please check if I had not made a fool of myself somewhere. I have done it before. Thanks very much Best Regards Johan Smit
Johan,
You might just use the LTspice device "1pole". It's a behavioral opamp with a tanh() xfer function. Using the rail-to-rail opamp without feedback approximates a comparator. The 1pole does steer current from the supplies to the output. Also, the 1pole uses the tanh() xfer function that's part of an intrinsic SPICE device that knows how to help the solver find the solution with higher than just the 1st order information that's usually available to the solver's Newton iteration. The behavioral modeling like Jim's is using can't do that.
--Mike
Hi Great One Jim,
Thank you. Could you show me how to do that please? Best Regards Johan Smit
Tanh works just ducky in PSpice, or anywhere else for that matter... it allows bounding without discontinuities.
...Jim Thompson
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus |
| Phoenix, Arizona Voice:(480)460-2350 | |
| E-mail Address at Website Fax:(480)460-2142 | Brass Rat |
| http://www.analog-innovations.com | 1962 |
I love to cook with wine. Sometimes I even put it in the food.
Hi Mike, Thank you. I must admit that my knowledge is lacking. I have changed to the following: VS1025A.CIR ..LIB CompCMOS.Lib Vsupply Vs 0 3v R1 2 5 1MEG R2 5 7 470K R3 6 7 220K R4 1 2 220K R5 7 0 100K ;load C1 2 6 100PF ;CX C2 2 0 200PF ;stray C3 6 0 200PF ;stray C4 Vs 0 100NF ;decoupling XCOMP1 5 6 Vs 0 7 1pole XCOMP2 6 7 Vs 0 1 1pole ..IC V(2)=1v ..tran 0.1u 1m 0 0 ..probe ..ends VS1025A
*------------------------------------------------------- ..subckt 1pole 1 2 3 4 5 S1 5 3 N002 5 Q S2 4 5 5 N002 Q A1 2 1 0 0 0 0 N002 0 OTA G={Avol/Rout} ref={Vos} Iout={slew*Cout} Cout={Cout} en={en} enk={enk} in={in} ink={ink} Vhigh=1e308 Vlow=-1e308 C3 5 4 1p C4 3 5 1p S3 N002 0 4 N002 C S4 0 N002 N002 3 C R2 N002 4 {2*Rout} noiseless R1 3 N002 {2*Rout} noiseless R3 3 1 1G noiseless R4 3 2 1G noiseless R5 2 4 1G noiseless R6 1 4 1G noiseless ..model C SW(Ron=100 Roff=1T Vt=0 Vh=-1 noiseless) ..param Rout=100Meg ..param Cout={Avol/GBW/2/pi/Rout} ..model Q SW(Ron=10 Roff=10Meg Vt=0 Vh=-.1 Vser={Rail} ilimit={Ilimit} noiseless) ..param Avol=1Meg GBW=10Meg Slew=10Meg ilimit=25m rail=0 Vos=0 ..param en=0 enk=0 in=0 ink=0 ..ends 1poleThe currents are now shown. Now how to adjust the delay and the transition window to the specs? Thank you Regards Johan Smit
I didn't say "atanh", I said "tanh"
...Jim Thompson
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus |
| Phoenix, Arizona Voice:(480)460-2350 | |
| E-mail Address at Website Fax:(480)460-2142 | Brass Rat |
| http://www.analog-innovations.com | 1962 |
I love to cook with wine. Sometimes I even put it in the food.
Johan ,
I think you can adjust the transition well enough with the DC gain(Avol). The GBW and slew will adjust the delay but not independently of the rise and fall times. You'd have to try different values and see if you can get the behavior as you like. The basic thought to this is that as a comparator can be used as an opamp, an opamp can be used as a comparator. You might be able to adjust the delay a bit by using the level 3b of the UniversalOpamp. It has delay line implemented in a few pi sections. The amount of delay is specified by the phase margin.
--Mike
Jim,
Yes, it can run "just ducky" in simple simulations. But as the complexity increases, especially if the behavioral devices are found in feedback loops, you've have a progressively more difficult time with convergence problems when using a function like atanh() as a behavioral expression as contrasted with using it as part of a properly written intrinsic SPICE device.
There's a difference between using a transcendental like tanh() in an intrinsic device and using it in a behavioral expression. When implemented in an intrinsic device; almost any SPICE, at least both PSpice and LTspice; is aware of how to fix problems that arise in the Newton iteration method. Newton-Raphson is a
1st order method that can run into trouble finding the solution of multi-dimensional non- inear systems like circuits. The types of techniques used in intrinsic SPICE devices like semiconductors can't be applied to general behavioral expressions using atanh().--Mike
Jim,
I *did* say tanh(), but also mistyped it as atanh(). My point applies for all transcendentals. There's an advantage to using intrinsic SPICE devices over behavioral sources for SPICE machines designed with knowledge over 1st order in the transcendental functions used to describe the device.
--Mike
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required