Need NGspice Model for 74HC04 Inverter

Where can I find a good model for the 74HC04 inverter?

After searching for 30+ minutes I found this Spice Model site…
http://www.bordodynov.ltwiki.org/
with the file lib.zip unzipped It has a file 74HC.lib with a number of 74HC parts…
including the 74HC04 inverter… with the Model shown below…

* Inverter gate
* tpd 25n/9n/7n
* tr 19n/7n/6n
.SUBCKT 74HC04  A Y  VCC VGND  vcc1={vcc} speed1={speed} tripdt1={tripdt}
.param td1=1e-9*(9-3-3)*4.0/({vcc1}-0.5)*{speed1}
*
XIN  A Ai  VCC VGND  74HC_IN_1  vcc2={vcc1}  speed2={speed1}  tripdt2={tripdt1} 
*
A1  Ai 0 0 0 0  Yi 0 0  BUF  tripdt={tripdt1}  td={td1}  
*
XOUT  Yi Y  VCC VGND  74HC_OUT_1X  vcc2={vcc1} speed2={speed1}  tripdt2={tripdt1}
.ends
*

I saved this model as 74hc04.mod in my project folder and assigned it to the device as a subckt.

But I get an error when running the simulation…
Compatibility modes selected: lt
Circuit: KiCad schematic
Too few parameters for subcircuit type “74hc04” (instance: xxu?)
Background thread stopped with timeout = 0
Error: circuit not parsed.

Thanks for any help on finding the correct model and getting it to work.

The model is for one inverter. Your IC contains six of it. You have to write a model for the IC with six instances of the model coming from Bordodynovs library. His library is focussed on LTSpice. LTSpice doesn’t simulate multi gate devices.

Use this as template:

1 Like

The LTSPICE model of the 7404 uses proprietary circuit building blocks (e.g.

A1  Ai 0 0 0 0  Yi 0 0  BUF  tripdt={tripdt1}  td={td1}  

) which ngspice cannot use.

Some digital models for ngspice (including 7404) are available at a link given in KiCad Eeschema as GUI for ngspice, tutorial for setting up the simulation.

1 Like