Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How to make sure 4040 counter to start on rising edge of clock?

Status
Not open for further replies.

pavjayt

Member
Hi,

I have a unique issue that I am trying to figure out a solution for it. I have a frequency doubler, the output of which is fed to a 4040 counter. I would like to align the outputs of this counter to the rising edge of the master clock that is fed as the input to the frequency doubler. Could someone suggest a possible solution for this?

thanks
 
I would like to align the outputs of this counter to the rising edge of the master clock
The CD4040 works off the falling edge. (my memory) If you put an inverter on the clock of the 4040 then it will respond off the raising edge. (invert the clock)
Is that what you want to do?
 
The CD4040 works off the falling edge. (my memory) If you put an inverter on the clock of the 4040 then it will respond off the raising edge. (invert the clock)
Is that what you want to do?
I am trying to align my 4040 outputs to the rising edge of my original clock thats the input to my frequency doubler. The output of the doubler is the clock input to 4040.
 
(frequency doubler) (inverter) (4040)
This will cause the 4040 to count off the rising edge of the Doubler.


Align = how many nano seconds.
I am not looking for exact phase aligned outputs, as long as they start on the rising edge of my non doubled clock, thats all I am looking for.

thanks
 
If it's not aligned then using an inverter, like ron suggested, should work.
 
If it's not aligned then using an inverter, like ron suggested, should work.
My frequency doubler output (say 20Hz) is phase aligned to my original clock (10Hz). In this case, I have two cycles that are fed as clock input to 4040 for every one original TTL clock. So, 4040 sees two rising edges on its clock for one cycle of original clock, one at the rising edge of my original clock and another one at its falling edge. So, the 4040's outputs can be arbitrary to the original clock and would like to make it so that the outputs are always aligned to the rising edge of the original clock.
 
We get it that you want the other edge on the 4040. The way you get the other edge is to invert the signal. Use a CD40106 inverts the signal. It makes every falling edge into a raising edge.
 
So, 4040 sees two rising edges on its clock for one cycle of original clock, one at the rising edge of my original clock and another one at its falling edge.
That's fundamental to the circuit.
So, the 4040's outputs can be arbitrary to the original clock and would like to make it so that the outputs are always aligned to the rising edge of the original clock.
Don't see how that's possible, given the preceding fact.

So I'm confused about what you want.
Can you post a timing diagram of what you have and what you want?
 
That's fundamental to the circuit.
Don't see how that's possible, given the preceding fact.

So I'm confused about what you want.
Can you post a timing diagram of what you have and what you want?

I am skeptical as well for a solution on this issue, but just wanted to ask out there. Will take a screenshot of my oscope tomorrow and post it to get a better idea as to what I am trying to ask.
 
Green trace is the original clock. Blue trace is 2X clock. Here the CD4040 will count on the falling edge which is in the wrong place.
The red trace is the inverse of the blue trace. Here the 4040 will count on the falling edge and be in the right place.
upload_2018-6-26_20-50-13.png

Here I am using a XOR gate to do the 2X and a XOR gate to invert.
upload_2018-6-26_20-53-11.png
 
Green trace is the original clock. Blue trace is 2X clock. Here the CD4040 will count on the falling edge which is in the wrong place.
The red trace is the inverse of the blue trace. Here the 4040 will count on the falling edge and be in the right place.
View attachment 113575
Here I am using a XOR gate to do the 2X and a XOR gate to invert.
View attachment 113576
Here are some labeled screenshots of my signals. As we can see, the 2x clk has 2 falling edges for a given original clk cycle, so its arbitrary for 4040 as to which one it chooses and that can be seen here. I am not sure if there is a way to lock it to the falling edge of the 2x clk that coincides with the original clk's rising edge.

WP_20180627_08_59_38_Pro.jpg WP_20180627_08_58_51_Pro.jpg
 
I am not sure if there is a way to lock it to the falling edge of the 2x clk that coincides with the original clk's rising edge.
If you do that you are using only half of the double-frequency signal, so you might just as well forget about doubling the frequency and simply clock the 4040 with the original signal.
 
If you do that you are using only half of the double-frequency signal, so you might just as well forget about doubling the frequency and simply clock the 4040 with the original signal.
I have to use the 2x clock in this situation where my 4040 is connected to a DAC.
 
So none of us understood from your words. Different problem.
Picture below. Bottom trace is not Q1 but Q3 or 4 or ....
Look at Q1. It will change state on every falling edge. But we do not know which falling edge will cause Q2 to flip over.
upload_2018-6-27_12-26-11.png

Look at Original Clock and Q1. They will be in phase or our of phase. There will be some delay but they will be 99.5% together or 99.5% wrong.
So add a XOR gate looking at the two. The output of the XOR will be "good" for 99.5% or "bad" for 99.5% of the time. Add a RC on the output with a time constant to hide the small spikes (0.5% of the time) After the filter (RC) the output should be 1 or 0 all the time depending on which condition.

What I am thinking is to run the XOR (filtered) signal to the 4040's reset.
...On one mode the (XOR filtered) will all wise be high and the 4040 will count for ever.
...On the other mode the (XOR filtered) will be low and reset the 4040 so it might try again.
I know there is some thing wrong with my logic but think about it.

OR do what Alec_t said and forget this 2X thing. Your Original Clock = Q1 so just use Original Clock for Q1.
 
I have to use the 2x clock in this situation where my 4040 is connected to a DAC.
:confused: I don't see how the DAC presence has any bearing on clocking the 4040. It would help if you could sketch and post the waveforms you are trying to achieve.
 
What you are requesting seems to a contradiction of what can be done.
We need a sketch of the waveforms you want, as previously requested.
 
This came from my previous thread here as Ron predicted above. This is not crucial, but I just thought it would be nice if I can get my 60Hz output aligned to the rising edge of my main clock as the 30Hz clock was. I guess its not trivial to achieve this if not possible.

thanks to all of you guys for chipping in with your suggestions/ideas.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top