In short I'm recreating a program that reads 3 sinusoidal signals through an ADC performs some manipulations and then reproduces these signals through a DAC. In order to reproduce these signals I need the instantaneous phase of one of these manipulations. So I recreated a charge pump zero crossing pll in software.

I don't understand why you would go to the trouble of working out the analogue loop filter transfer function, convert it to the z domain, when in software when I could just implement a program that reads the amount of samples between zeros, and the instantaneous phase is just.

(current sample#-last zero sample#)/(pi*(number of samples between zeroes))

Now I've obviously missed something, but I don't know what to google to find out what.

  • 1
    $\begingroup$ Noise can introduce some jitter or ambiguity in the location of the zero crossings. A more robust alternative is the phase of the fundamental of the Fourier series, obtained by convolving with a sinusoid/cosinusoid, provided the frequency is well known. $\endgroup$
    – user7657
    Commented Sep 9, 2014 at 10:34
  • $\begingroup$ @YvesDaoust do you mean the frequency of the sinusoid i convolve it with is well known, because i dont know the frequency of the signal that i need the instantaneous phase of? I read a bit about using recursive discrete fourier transforms to achieve the same ends though i read allot of criticism that fourier transforms introduce large computational burdens. $\endgroup$ Commented Sep 9, 2014 at 11:00
  • $\begingroup$ If you know the frequency, there won't be a big burden, just two dot products. FFT is a much different matter. $\endgroup$
    – user7657
    Commented Sep 9, 2014 at 11:08

1 Answer 1


For very high SNR signals locating the zero crossings will work pretty well. You use PLL's when the signal doesn't have a high SNR, like the following.

Noisy sinusoid

As you can see by inspection, a zero-crossing algorithm wouldn't have a prayer of working on this signal. A PLL, on the other hand, could do just fine. That is, by the way, a tone with an SNR of 8 dB.

  • $\begingroup$ Just to clarify are you saying an analogue pll would work fine or are you saying that a zero crossing pll with a digital filter would work fine too(I know you can also use fft like you mentioned in a previous answer) ? $\endgroup$ Commented Sep 10, 2014 at 23:09
  • $\begingroup$ Oh and thank you for explaining why that algorithm wouldn't work, i knew it seemed to simple to be true. $\endgroup$ Commented Sep 11, 2014 at 1:18
  • $\begingroup$ I'm saying an analog or digital PLL would work, but I don't believe that a zero-crossing PLL with a digital filter would work. $\endgroup$
    – Jim Clay
    Commented Sep 11, 2014 at 4:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.