# Tracking Phase comparator Logic

1. ## Tracking Phase comparator Logic

I have two waveforms, A and B of identical frequency. "A" is the reference wave which is fixed, "B" wave moves in steps of 5us- 20ms. All I need is to track the change in phase without recomputing every time. Can anybody suggest proven method in hardware

2. ## Re: Tracking Phase comparator Logic

Hi,

The obvious thing is to use a "phase comparator circuit".
But most probably you already tried/simulated this and failed .... otherwise you did not start this thread.

I have two waveforms,
good that you know .... but if you need detailed help, you should give us the information, too.
Is it a random, noisy waveform, sine, triangle, square wave, or any other waveform.

But "5us- 20ms" is meaningless as long as we don't know the both frequency ranges of A and B.

Klaus

* "track ....without recomputing"
* "every time"
mean for you.

You want some
* analog value, or some
* digital value (update period, resolution, precision...)?

Klaus

3. ## Re: Tracking Phase comparator Logic

look up CD4046 - it will give you a few ideas on phase comparators - and how it can be done ....

•

4. ## Re: Tracking Phase comparator Logic

Here are details. A and B are square wave TTL level 50 Hz signals from field. Based on field conditions, B wave moves in steps of 5us with respect to A wave (the direction is always left wrt A wave, ie.. B leads A). All I need is to track this phase change and display it digitally. My first though was to use XOR gate and measure pulse width. But recomputing of this width happens everytime, the phase changes. I require that when B moves by 5us, count is 1 and 10us, count is incremented from 1 (already tracked value).

5. ## Re: Tracking Phase comparator Logic

Hi,

I'm still not sure whether you want a digital system or an analog system.

XOR --> low_pass_filter --> analog value

Or you use a microcontroller with capture_feature to get duty_cycle.

*****
I'm still confused with your informations.
* If one leads the other you have a phase_shift_range of 0...180°, which means 0...10ms.
* With stepsize of 5us you get 0...2000 steps.
* A and B are synchronous to each other. Just the phase angle jumps.
Is all the above true?

Klaus

6. ## Re: Tracking Phase comparator Logic

I need a digital system and phase should be accumulated as it changes. To make it simple, whenever B lags or leads A, phase accumulator either increments or decrements to indicate the total change in phase (I am looking for a concept, as the time 5us indicated is only tentative and subject to change)

•

7. ## Re: Tracking Phase comparator Logic

Hi,

What about a sketch and/or timing diagram?

"Phase should be accumulated", means:at the beginning, if phase is 5us then the result is "5us" .... if at the next period the phase still is 5us ... the results accumulates up to "10us" ..... is this what you want?

Before you clearly said "B leads A" now you say "B lags or leads A" .... it contradicts...

Klaus

8. ## Re: Tracking Phase comparator Logic

If phase remains unchanged it should be still 5us. only when it changes to 10us, phase accumulator must detect this change and add with its past input. I need a tracking phase accumulator.

9. ## Re: Tracking Phase comparator Logic

well - you need to sit down and do some sketches and some design ... and try to largely work it out yourself

10. ## Re: Tracking Phase comparator Logic

If I understand the requirement and it has to be done digitally, an XOR function of the two signals will produce a high during the time phase difference. What you need to do is count at 5uS rate during that high period. At your reference time, look to see if the second signal is high or low to see whether you should be counting up or down.

Brian.

•

11. ## Re: Tracking Phase comparator Logic

Hi

If phase remains unchanged it should be still 5us. only when it changes to 10us, phase accumulator must detect this change and add with its past input. I need a tracking phase accumulator.
Then you donīt need to accumulate something, you just need to measure the phase difference.

If phase difference is 5us --> show 5us (= "1" )
If phase difference is 10us --> show 10us (= "2" )
If phase difference is X us --> show X us (= "X / 5us" )

If I understood correctly then you just measure in steps of 5us.

Klaus

12. ## Re: Tracking Phase comparator Logic

Originally Posted by curious_mind
If phase remains unchanged it should be still 5us. only when it changes to 10us, phase accumulator must detect this change and add with its past input. I need a tracking phase accumulator.
This makes zero sense. By your definition, if the phase difference is 5us, your output is 5. If it changes to 10uS you "add with its past input", so now your output is 15?

People keep asking you to explain what you're trying to do, and you lead us further and further down the rabbit hole.

I REALLY don't think you want a "phase accumulator"; I think (as everybody else here does) that you want a phase detector.

13. ## Re: Tracking Phase comparator Logic

Originally Posted by curious_mind
I have two waveforms, A and B of identical frequency. "A" is the reference wave which is fixed, "B" wave moves in steps of 5us- 20ms. All I need is to track the change in phase without recomputing every time. Can anybody suggest proven method in hardware
Though the problem requirement not very clear but you may consider two counters, one running on A signal and one on B. at reset force zeros on counters. Then they provide tracking. I will use a system clock faster than your signal and count up using the edge of A/B as clock enable. The difference of counters then indicates phase shift up to resolution of your counters.

--[[ ]]--