Author Topic: Simple oscillator in LTspice  (Read 2430 times)

0 Members and 1 Guest are viewing this topic.

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 116
  • Country: be
Simple oscillator in LTspice
« on: December 13, 2023, 10:17:14 am »
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 from https://www.ti.com/product/CD40106B.
 

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 6712
  • Country: ro
Re: Simple oscillator in LTspice
« Reply #1 on: December 13, 2023, 11:12:20 am »
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-finishes

Check the checkbox for 'Start external DC supply voltages at 0V', or manually type 'startup' at the end of '.tran ....' text.
 
The following users thanked this post: elki

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 116
  • Country: be
Re: Simple oscillator in LTspice
« Reply #2 on: December 13, 2023, 11:14:28 am »
Thank you very much! This solved the issue.
 

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 116
  • Country: be
Re: Simple oscillator in LTspice
« Reply #3 on: December 13, 2023, 12:37:26 pm »
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?
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19920
  • Country: gb
  • 0999
Re: Simple oscillator in LTspice
« Reply #4 on: December 13, 2023, 06:24:16 pm »
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 [Digital] 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.

« Last Edit: December 13, 2023, 06:30:01 pm by Zero999 »
 
The following users thanked this post: MathWizard, elki

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 116
  • Country: be
Re: Simple oscillator in LTspice
« Reply #5 on: December 13, 2023, 07:24:45 pm »
Thank you very much for the detailed response. Very useful.
 

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 6712
  • Country: ro
Re: Simple oscillator in LTspice
« Reply #6 on: December 13, 2023, 07:45:41 pm »
Tried with another Schmitt-trigger inverter (SN74AC14).

The TI model for SN74AC14 is either wrong, or not compatible with LTspice.  The gate alone draws some kA :o from 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.
 
The following users thanked this post: elki

Offline elkiTopic starter

  • Regular Contributor
  • *
  • Posts: 116
  • Country: be
Re: Simple oscillator in LTspice
« Reply #7 on: December 13, 2023, 07:54:26 pm »
Good catch! Indeed, looks like the model itself is problematic.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19920
  • Country: gb
  • 0999
Re: Simple oscillator in LTspice
« Reply #8 on: December 13, 2023, 10:46:15 pm »
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

« Last Edit: December 14, 2023, 04:39:37 pm by Zero999 »
 
The following users thanked this post: elki


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf