Opinions wanted: best cd4060 sim for LTspice

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,307
The title about says it all. I'd like to play around with simulating some cd4060 circuits. I just joined the yahoo LTspice user group and I tried the 4060 model in "files > lib." It does seem to work as expected, except that it's excruciatingly slow. I left one simulation running for an hour and it had only processed less than a minute of simulation time (on a circuit that sims over an hour's worth of data in a couple seconds with a 555 in place of the 4060.)

Are some 4060 models way better than others? The organization of the yahoo user group is a little strange to me. I found 4060 models in a bunch of different spots, but it's not entirely clear to me if they're different. If so, I have no idea how to choose.

Any advice?
 

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,307
hi e17,
Can you post your LTS asc file of the super slow 4060 sim, I will give it a go,
E
Ooh, that would be awesome. Thanks! I'm not at my computer right now, but I'll definitely upload some files as soon as I can. Would you like me to share the files I got from Yahoo too?
 

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,307
hi e17,
Can you post your LTS asc file of the super slow 4060 sim, I will give it a go,
E
Eric,
here are a few files. The CD4060BTest is the demo file that came with the model I downloaded. It's pretty slow. I've included the zip package it came in with the model file, in case you're interested.

The other two files are two versions of the circuit I've been working on. Don't judge me too harshly - it's very much a work-in-progress as I brainstorm logic ideas and try to get a feel for working with the 4060. After I get the basic behavior right I'll still have to change a lot of component values to get timing right or to get output power handling right, etc. Most of what you see is just placeholders while I sort out the basic operation.

The first version of my file is set to the shortest possible time-out on the 4060, and since I've set it up to latch the output high and stop clock oscillations, the sim runs plenty fast once the clock stops oscillating. The "b" version of the file has a longer 4060 time-out - with this one the clock keeps ticking for a long time and it's pretty grueling to try to sit through the simulation.

If you can figure anything out to improve my 4060 simming ability, that would be awesome! Feel free to criticize the rest of my circuit too if you're so inclined, but you certainly don't need to - I expect a lot more will change before I think it's ready anyway.

P.S. Just as a point of reference for what I thought was too slow, the test file that came with the 4060 model reported running at 424.29 microseconds / second and other similar rates numerous times. Given that I'm trying to learn about circuits that time for hours, having something simulate at <0.05% of real time is pretty rough!
 

Attachments

Last edited:

ericgibbs

Joined Jan 29, 2010
18,766
hi e17,
Downloaded your files, will run them.
I had the same problem with the standard 4060 model back in 2010, it is very slow.
For the project I was doing back then I made a hierarchical circuit, using the CD4020B, attached the asc files.

E
 

Attachments

ericgibbs

Joined Jan 29, 2010
18,766
hi,
Your asc files take approx 80 seconds to complete a sim.
Can you say what exactly the circuit you are simulating is supposed to do in the real world.?

Using my budget version of the 4060m1, your circuit takes less than 10secs to run.
The 4060m1 was designed solely to show the Q output waveforms.

E
BTW: if you want to run the IC's at Vdd= 10v, change them in the model.

Update:
Checking your files, even when the circuit is reduced to just the simplest possible using the CD4060.moo model, for the pulses/hour, they will not run for me.!
 
Last edited:

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,307
Can you say what exactly the circuit you are simulating is supposed to do in the real world.?
I started trying to figure this circuit out in response to the following thread:
https://forum.allaboutcircuits.com/threads/timer-circuit-with-relay-output.138577/
Parsing the logic sequences of it seemed fun to me, and I have very little experience with timing circuits (a few successful 555 circuits, never before touched a 4060) so I thought this would be a good learning experience. When I was about halfway through, AnalogKid joined the conversation, and of course came up with a simple, and probably generally better, solution. Nevertheless, just for my own experience, I wanted to continue the exercise and see if I could make a circuit per the user requirements on my own.

The basic idea of the circuit is that there will be a stream of pulses on the input. If the pulses are spaced by one minute or less, a one hour timer should be running. (If there's a gap of more than one minute in the pulses, the one hour timer should stop. Upon the next pulse, the timer should reset/restart counting the full hour again.) When the timer reaches an hour, it should activate a relay and latch that output so that the relay stays high, regardless of pulse activity, until manually reset.
Checking your files, even when the circuit is reduced to just the simplest possible using the CD4060.moo model, for the pulses/hour, they will not run for me.!
That's odd. Any hints from the error messages as to what's going on? I know my circuit is far from ideal, but I thought it was basically functional at this point. And it does run, albeit incredibly slowly, on my computer.
 

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,307
hi e17,
Downloaded your files, will run them.
I had the same problem with the standard 4060 model back in 2010, it is very slow.
For the project I was doing back then I made a hierarchical circuit, using the CD4020B, attached the asc files.

E
I'm trying to play with your models, but I'm getting an error message on the 4060m1_test1 file. It says I'm missing the 4060m1 symbol. Could you share that too? Thanks!
 

ericgibbs

Joined Jan 29, 2010
18,766
hi,
I have stripped down the slowest asc file you posted, even that runs very very slow, the 4060.moo model is suspect. [posted image of strip down]

Attached asy file for 4060m1, change extension back to asy from txt.

E
 

Attachments

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,307
hi,
I have stripped down the slowest asc file you posted, even that runs very very slow, the 4060.moo model is suspect. [posted image of strip down]

Attached asy file for 4060m1, change extension back to asy from txt.

E
Awesome, thanks! I'm on my way out the door, so it'll be a little bit before I can try it out, but I'm very excited. Thanks!
 

ericgibbs

Joined Jan 29, 2010
18,766
hi e17,
Attached asc file for a cd4060m1, also a screen clip of the plots it produced.
You could use this asc file as a template for your project.
If the timings are not exact, you can modify the 4060 model.
E
 

Attachments

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,307
hi,
I have stripped down the slowest asc file you posted, even that runs very very slow, the 4060.moo model is suspect. [posted image of strip down]

Attached asy file for 4060m1, change extension back to asy from txt.

E
Thanks so much for sharing these files! The sim still takes longer than any other project I've previously worked on, but it seems quite reasonable, considering the time scales I'm trying to look at and the high number of oscillations.

I do have some questions though. When I was just getting a feel for basic operation, everything seemed great, but when I tried to set the 4060 timing how I wanted it, the time was almost exactly 2/3 of the expected value (I believe I was looking at pin 8 output at this point.) I rechecked my calculations and they were good. Then I zoomed in and looked at the oscillations, and they were correct, but the periods of the q outputs weren't the expected multiples of the oscillator period.

At first I thought I had messed things up when adjusting the model for 12V, so I set everything back to normal. No luck. Then I thought maybe I still had it wrong after trying to set things back, so I deleted all the CD40xx files (lib, asy, everything) and reinstalled them. Still no luck. Starting to think I'm crazy.

Next I copied the components of your model into a new schematic so I could test it myself, including seeing the lower q outputs that aren't directly available in a cd4060. I discovered that if I generate a pulse train with a voltage source and feed it into the ripple counter input, all of the outputs behave as expected. However, if I add the two resistors and a cap to run the built in oscillator, something strange happens. Q1 has extra, unwanted pulses at regular intervals, resulting in q2 having an irregular period and asymmetrical duty cycle. (I tried these oscillator based tests with a few different sets of r and c values, including my calculated ones, AnalogKid's values from the linked thread, and your demo values from the included test schematic. Same result in all cases.)

I tried playing around with some internal values for the ripple counter, and discovered that if I turn the speed up from 1.0 to 2.0, then I get the expected timing behavior out of the ripple counters. The only remaining problem is that the mapping from ripple counter pins to cd4060 pins is offset by one, and with this new setting, that means every pin has double the period (half the frequency) that I believe it should.

So, after all that, two big questions:
1) Am I just insane?
2) What is the speed setting within the cd40xx models meant to represent?

2b) Bonus question: what about the other setting after speed, which I've suddenly forgotten the name of?
 

ericgibbs

Joined Jan 29, 2010
18,766
hi e17,
You can borrow my straight jacket if the insanity gets any worse.:rolleyes:

Lets take it from here:
Q1. Tell me what input frequency you want from the 4060 oscillator section.?
Q2. At what time in seconds do you want Q13 to go High.??

E
 

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,307
hi e17,
You can borrow my straight jacket if the insanity gets any worse.:rolleyes:

Lets take it from here:
Q1. Tell me what input frequency you want from the 4060 oscillator section.?
Q2. At what time in seconds do you want Q13 to go High.??

E
Oscillator: 1.14784206 Hz (0.8712 period)
Q13 high: 3568.4352 seconds (59.47392 minutes)
(Expecting Q8 to go high ~111 seconds, instead it went high ~74 seconds.)

These values are odd because I chose to just target the closest I could easily get to 1 hour with standard values. I chose 3.3uF, 120k, and 1Meg in order to achieve this.
 

Thread Starter

ebeowulf17

Joined Aug 12, 2014
3,307
hi e17,
You can borrow my straight jacket if the insanity gets any worse.:rolleyes:

Lets take it from here:
Q1. Tell me what input frequency you want from the 4060 oscillator section.?
Q2. At what time in seconds do you want Q13 to go High.??

E
And here's a screenshot of the strange behavior I was describing. I'm sure my wordy paragraphs did little to illuminate the situation. For whatever reason, changing the CD4024B "speed" to 2.0 eliminates the the odd pulses on q1.
ripple-test2.png
 

Attachments

Top