Simple oscillator in LTspice - Page 1
Forum section: electronics / beginners

author: elki
author_rank: Regular Contributor
timestamp: December 13, 2023, 10:17:14 am
content: Hello,For some reason, my simple oscillator (square wave generator) based on the hex Schmitt-Trigger inverter is not converging in LTspice simulation. I am attaching the asc file below. Does anyone have an idea what is wrong with this circuit? The simulation model (CD40106B.cir) is taken fromhttps://www.ti.com/product/CD40106B.

author: RoGeorge
author_rank: Super Contributor
timestamp: December 13, 2023, 11:12:20 am
content: Search for "ltspice stepping source 100%" and find the explanation:https://ez.analog.com/design-tools-and-calculators/ltspice/f/q-a/546766/ltspice-stepping-source-100-never-finishesCheck the checkbox for 'Start external DC supply voltages at 0V', or manually type 'startup' at the end of '.tran ....' text.

author: elki
author_rank: Regular Contributor
timestamp: December 13, 2023, 11:14:28 am
content: Thank you very much! This solved the issue.

author: elki
author_rank: Regular Contributor
timestamp: December 13, 2023, 12:37:26 pm
content: Tried with another Schmitt-trigger inverter (SN74AC14). Simulation converges but with a strange result - the output voltage is basically zero. Still something to adjust in the LTspice transient syntax?

author: Zero999
author_rank: Super Contributor
timestamp: December 13, 2023, 06:24:16 pm
content: A couple of points:Normally LTSpice will attempt to calculate the steady state voltages on capacitors, which can cause problems in circuits like this, which don't have a steady state. One way round this, is to set the initial voltage on the capacitor to zero, using the Ic (Initial Condition) directive.LTSpice already has built-in models for logic gates and Schmitt triggers. There's normally no need to use custom ones, unless one is doing something unusual, such as manipulating the supply voltage, or relying on the supply current. They're in the  of the Insert Component Symbol dialogue box. More information can be found in the LTSpice help file: Circuit Elements > A. Special Functions.Here's an example of a Schmitt trigger oscillator, using a parameters which model the 40106. It's probably not perfect, I quickly looked at the data sheet and adjusted the model accordingly, but it should be good enough for most applications. Note the data sheet specifies the hysteresis voltage differently to LTSpice. The data sheet lists the hysteresis as the difference between the positive and negative going thresholds, where as LTSpice adds and subtracts is from a defined from the parameters, given in the help file. This means LTSpice's parameter for hysteresis should be half of that on the data sheet, hence why I've got 0.45V, rather than 0.9V for Vh.

author: elki
author_rank: Regular Contributor
timestamp: December 13, 2023, 07:24:45 pm
content: Thank you very much for the detailed response. Very useful.

author: RoGeorge
author_rank: Super Contributor
timestamp: December 13, 2023, 07:45:41 pm
content: Quote from: elki on December 13, 2023, 12:37:26 pmThe TI model for SN74AC14 is either wrong, or not compatible with LTspice. The gate alone draws some kAfrom the power supply.If you open the .cir file, you'll see they are using that model with the TINA-TI simulator. TINA-TI is similar with LTspice, but not exactly the same. Often the models are interchangeable, and they work in any SPICE flavor, but I'm not aware of all the fine details. TI can not use LTspice because LTspice is made by ADI, and the free LTspice license is for personal use only, not for companies.Download TINA-TI from the TI website, and see if the 74AC14 model works in TINA-TI.

author: elki
author_rank: Regular Contributor
timestamp: December 13, 2023, 07:54:26 pm
content: Good catch! Indeed, looks like the model itself is problematic.

author: Zero999
author_rank: Super Contributor
timestamp: December 13, 2023, 10:46:15 pm
content: I had a play with using discrete parts to model a 40106. I used MOSFETs from the 4007, which in theory should be the same as the MOSFETs used in the 4000 series. Unfortunately it's slower than a real 40106. I think it's because smaller, faster MOSFETs are used inside the chips, with larger, slower ones on the outputs.https://wiki.analog.com/university/courses/electronics/electronics-lab-28

author: slamb
author_rank: Newbie
timestamp: June 17, 2025, 10:26:39 pm
content: I had the same problem simulating this gate from kiCad: kA of current to the part's VCC and wouldn't oscillate properly. A search landed me here.I think I found the problem with the model file. The `RA` and `RB` parameters are massively different between the HC and AC models. I'm a spice newbie, but I think it's saying that the input pins are basically shorted to ground. If I remove the minus sign in the exponent, increasing that resistance by 10 orders of magnitude(!), it behaves as expected.Code:$ diff -u SN74HC14.cir SN74AC14.cir--- SN74HC14.cir2020-01-13 09:13:22+++ SN74AC14.cir2025-06-17 15:10:15@@ -1,5 +1,5 @@********************************************************************************-* SN74HC14.cir+* SN74AC14.cir* 2.0* 2019-11-14 00:00:00* Texas Instruments Incorporated.@@ -30,36 +30,36 @@**********************************************************************************-* SN74HC14+* SN74AC14********************************************************************************-.SUBCKT SN74HC14 Y A VCC AGND-XU1 Y A VCC VCC AGND LOGIC_GATE_2PIN_OD_HC_1i_NAND_PP_ST_SN74HC14+.SUBCKT SN74AC14 Y A VCC AGND+XU1 Y A VCC VCC AGND LOGIC_GATE_2PIN_OD_AHC_1i_NAND_PP_ST_SN74AC14.ENDS-.SUBCKT LOGIC_GATE_2PIN_OD_HC_1i_NAND_PP_ST_SN74HC14 OUT A B VCC GND+.SUBCKT LOGIC_GATE_2PIN_OD_AHC_1i_NAND_PP_ST_SN74AC14 OUT A B VCC GND.PARAM VCC_ABS_MAX = 7.PARAM VCC_MAX = 6-.PARAM RA = 240000000-.PARAM RB = 240000000-.PARAM CA = 1e-11-.PARAM CB = 1e-11-.PARAM ROEZ = 5000+.PARAM RA = 2.4e-05+.PARAM RB = 2.4e-05+.PARAM CA = 2.8e-12+.PARAM CB = 2.8e-12+.PARAM ROEZ = 2000.PARAM COEZ = 3e-12RA A GND {RA}RB B GND {RB}CA A GND {CA}CB B GND {CB}