# How to make two different frequency square waves stay in sync with each other at all times? [closed]

Is there circuit to make two square waveforms of different frequency be in sync with each other at all times as shown and not drift over time?

• feed the blue signal into a divider to generate the green signal Jul 1 at 3:12
• In general, no, unless they multiples of the same frequency (which your image is). Jul 1 at 3:16
• EIther compute the GCD of the two frequencies and provide that GCD value as a base frequency and apply two different DCO multipliers to get the frequencies you want or else compute the LCM of the two frequencies and provide that LCM value as a base frequency and apply two different digital divide-by-N to get the frequencies you want. This paper from TI may also be of some small interest, though I am not sure.
– jonk
Jul 1 at 4:11
• Sounds like you want something like a phase-locked loop (PLL). Jul 1 at 4:30

In the general case, it's called frequency synthesis.

You make a second frequency as a rational fraction of the first.

$$F_{out}=\frac{num}{den}F_{in}$$

In your particular case, if you take the blue waveform as Fin, you could create the green waveform by clocking a divide-by-2 latch on the falling edge of Fin. If you wanted to use the green waveform as Fin, you might use a frequency doubler by closing a Phase Locked Loop around a divide-by-2 circuit, or you could double the frequency directly with logic or RF components.

The subject is vast, and this answer barely scratches the surface. There's a lot of technology (aka knowhow) about the hardware used to make multipliers and dividers, their noise performance, the permissible sizes of num and den and whether they can adjusted in real time. Most FPGAs now contain several dedicated frequency synthesis blocks to manipulate their clock signals, and you can buy complete Direct Digital Synthesis ICs for a few dollars from several manufacturers.

Short:

Yes, you can. What you want is called phase locking. You need to make the two frequencies based on the same source, otherwise you will never completely get rid of some drift even with the best frequency sources.