+ Post New Thread
Results 1 to 13 of 13
  1. #1
    Member level 3
    Points: 394, Level: 4

    Join Date
    Apr 2019
    Posts
    58
    Helped
    0 / 0
    Points
    394
    Level
    4

    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

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 80,117, Level: 69
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,254
    Helped
    3686 / 3686
    Points
    80,117
    Level
    69

    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

    Added:
    Please enlighten us. What does:
    * "track ....without recomputing"
    * "every time"
    mean for you.

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

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  3. #3
    Advanced Member level 5
    Points: 12,344, Level: 26

    Join Date
    Aug 2015
    Location
    Melbourne
    Posts
    2,014
    Helped
    742 / 742
    Points
    12,344
    Level
    26

    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. #4
    Member level 3
    Points: 394, Level: 4

    Join Date
    Apr 2019
    Posts
    58
    Helped
    0 / 0
    Points
    394
    Level
    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. #5
    Super Moderator
    Points: 80,117, Level: 69
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,254
    Helped
    3686 / 3686
    Points
    80,117
    Level
    69

    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
    You may use an additional DFF to find lead/lag information.

    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
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  6. #6
    Member level 3
    Points: 394, Level: 4

    Join Date
    Apr 2019
    Posts
    58
    Helped
    0 / 0
    Points
    394
    Level
    4

    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)



    •   AltAdvertisement

        
       

  7. #7
    Super Moderator
    Points: 80,117, Level: 69
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,254
    Helped
    3686 / 3686
    Points
    80,117
    Level
    69

    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
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  8. #8
    Member level 3
    Points: 394, Level: 4

    Join Date
    Apr 2019
    Posts
    58
    Helped
    0 / 0
    Points
    394
    Level
    4

    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. #9
    Advanced Member level 5
    Points: 12,344, Level: 26

    Join Date
    Aug 2015
    Location
    Melbourne
    Posts
    2,014
    Helped
    742 / 742
    Points
    12,344
    Level
    26

    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. #10
    Super Moderator
    Points: 82,552, Level: 70
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,549
    Helped
    4514 / 4514
    Points
    82,552
    Level
    70

    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.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



  11. #11
    Super Moderator
    Points: 80,117, Level: 69
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,254
    Helped
    3686 / 3686
    Points
    80,117
    Level
    69

    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
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  12. #12
    Advanced Member level 5
    Points: 24,650, Level: 38
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,726
    Helped
    1048 / 1048
    Points
    24,650
    Level
    38

    Re: Tracking Phase comparator Logic

    Quote Originally Posted by curious_mind View Post
    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.



    •   AltAdvertisement

        
       

  13. #13
    Newbie level 3
    Points: 100, Level: 1

    Join Date
    Aug 2019
    Posts
    4
    Helped
    0 / 0
    Points
    100
    Level
    1

    Re: Tracking Phase comparator Logic

    Quote Originally Posted by curious_mind View Post
    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.



--[[ ]]--