Hi Can, For a simple analog solution, you might try a 74HC4046 phase detector followed by a diode and RC network as used in Lars Walenius' GPSDO, described here in the archives:
https://www.febo.com/pipermail/time-nuts/2014-February/082820.html The phase detector produces a pulse whose width equals the time difference between the two pulses. The RC network converts this to a voltage proportional to the time difference, which you then measure with the MCU's A/D converter. Using the rising edge of the signal at pin 14 as the interrupt source triggers the A/D converter at the end of the pulse, which corresponds to the peak of the analog signal.. The 1 meg resistor discharges the capacitor between pulses. Lars' code also includes a filtering algorithm which does a nice job of controlling one of the oscillators to match the 1-PPS generated by the GPS. I have enhanced this if you are interested. On Mon, Sep 21, 2015 at 1:45 PM, Can Altineller <altinel...@gmail.com> wrote: > > > I probably need a hardware to measure the time pulses more precisely. I > thought of XOR'ing the clocks, and measuring both rising and falling edges > trough interrupts, but when the pulse is close enough, it will lead to same > condition. > > Are there any solutions to this problem? Maybe an analog hack? And what > are the mostly used algorithms to tune an oscillator to another? Currently > my algorithm sign corrects the result difference, and adjusts aging > register simply by adding to it, then runs a conversion command each second > to add or substract the ppms. > > This looks a lot of fun, > > Best Regards, > Can Altineller > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to > https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there. > -- --Jim Harman _______________________________________________ time-nuts mailing list -- time-nuts@febo.com To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts and follow the instructions there.