Lock Phase Between Timer 1 and Timer 2

Hi,

I am generating two PWM signals (with different frequencies) from Timer 1 and Timer 2. And I am doing direct value assignments to the timer registers (TCCR1A, TCCR1B, etc.).

When I observe the two signals on an oscilloscope, the phase between the two signals is constantly changing. That is, one signal is static on the oscilloscope screen, and the other signal slowly "slides" to the right side of the screen. I would like to ask if there is a way to "lock" the phase between those two signals? And what is the cause for the problem?

Thank you very much for your reply.

Easy. Use the same frequency for both signals.

And what is the cause for the problem?

Signals with different frequencies have a constantly shifting phase. It's mathematical.

You can make them stand still if you lock to a signal that is the inverse of the product of the two,

e.g. if you have 7kHz and 5kHz signals, every 5*7 = 35th pulse will line up.

In that case, the phase is constantly shifting, but returns to the exactly the same value after completing a full phase rotation.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.