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.
Claude, you can detect phase difference with an XOR or a DFF, but I don't think you can use them as frequency comparators. The MC4044 is a phase-frequency detector. I don't know if they are available, but NTE apparently has a replacement.
Correct me if I'm wrong here, Ron. I mentioned the two most common phase comparators (type I - xor, type II - D flip-flop) used in phase-locked loops for digital input signals. An error signal is generated with either a phase or frequency difference between the reference and the input signal, correct? The xor type works best with 50% duty cycle waveforms; the D flip-flop type is edge triggered, so duty cycle is not important.
The other type of phase comparator, found in analog PLLs, is a four-quadrant analog multiplier. The output is a "function of input and VCO signal amplitudes, frequencies, phase relationships, and duty cycle" (AN-177).
Phase detectors give an output proportional to phase difference. If the two input frequencies are identical, you will get a DC voltage (sometimes you need a lowpass filter to remove the 2F component) proportional to phase difference. If the frequencies are different, you get an output signal whose frequency is the difference between the two inputs. There is no way of knowing which input is the higher frequency. Simple phase detectors are indeed multipliers. The XOR is the digital equivalent of an analog multiplier. If you look at the mathematical result of multiplying two signals, you will see that the output has sum and difference frequencies. The lowpass filter, as I mentioned, is generally needed to remove the sum component.
The D flipflop is a bang-bang phase detector, i.e, it's output is not proportional to phase error. Instead, it will output a one or a zero (or vice versa, depending on the circuit) , depending on whether the input leads or lags the reference.
BTW, I spent about 18 years designing the input and genlock PLLs in video time base correctors, so I'm not just spouting something I read in a book (no offense intended).
As I mentioned, the MC4044 phase/frequency detector is a good part for frequency comparison, and it will tell you which input is high and which is low. It has no noise immunity (can't handle glitches or analog signals), so you need clean digital inputs.
Another way to compare frequencies is to use two frequency-to-voltage converters and a comparator. There will be a delay in the output due to the lowpass filters in the F to V converters.
No offense taken, thanks for clarifying. No disagreement on the technical points, either. I was poking around for some more info, suspecting the post had something to do with the recent thread on frequency counters and another on stopwatches. If you only need to calibrate a timebase, a frequency comparator circuit would be simpler than building a full-blown frequency counter.
For the stopwatch, my suggestion would be to calibrate the 0.1 sec output against a 60Hz zero-crossing detector (divided by 6). Using a type-I or II phase detector followed by a simple low-pass filter, you'd adjust the stopwatch clock source for minimum error (I think a 555 was being used). Knowing which frequency is higher/lower doesn't really matter for that application, so a type-I or II phase detector should be OK. Not sure which type would be most appropriate for that use. Like many circuits, the complexity of a phase/frequency detector depends on what you need it for. - CAL
btw, the power line frequency in the US is normally 60Hz +/- 0.05Hz, accurate enough for many applications.