[time-nuts] algorithms and hardware for comparing clock pulses

Bill Hawkins bill at iaxs.net
Thu Sep 24 02:31:14 EDT 2015


Perhaps I can do this in words, as I have no schematic software.

Start with the input to your favorite microprocessor's A/D converter.
Connect it to a suitable (more later) capacitor to analog ground.
Connect a cmos switch across the cap and call it S2. When S2 is on, it
discharges the cap.

Now build or buy a constant current generator connected from a suitable
positive voltage to another cmos switch called S1.
When S1 is on, all of the current generated flows to analog ground.

To make it all work, connect the anode of a diode from the junction of
the current source and S1 to the cap and analog input.

When S1 is on, no current gets to the cap. When S1 is off, all of the
current gets to the cap, if S2 is off. This causes a linear buildup of
voltage across the cap, for a suitable time.

When 1 PPS pulses are compared, suitable means one second to charge to
almost the maximum that the micro A/D supports.
The value of I is chosen to overwhelm diode leakage and A/D input
current. The value of C follows.

All that remains for a working system is a pair of flip-flops to control
S1 and S2.
FF 1 is set by PPS 1 and cleared by PPS 2, and by power on reset. When
FF1 is on, S1 is off.
FF 2 is set by PPS 1 and cleared by an output from the micro when the
A/D conversion is done. When FF2 is on, S2 is off.

And so C will charge from PPS 1 to PPS 2, hold the value while the A/D
conversion occurs, and be reset to zero volts when the micro is done
processing the input.

This gives the micro a linear conversion of pulse difference time rather
than an RC exponential value.

Feedback controllers do better with linear error signals.

But all of this is wasted if the PPS signals are not accurate due to
things that affect pulse rise and fall times.

If the above was not adequately clear, please ask for clarification. Or
do a schematic and ask for corrections.

Bill Hawkins

P.S. This will not work well for small differences between PPS 1 and 2.
It will work if the goal is 50% difference, or 90 degrees phase shift.


-----Original Message-----
From: Can Altineller
Sent: Wednesday, September 23, 2015 2:56 AM

--------%< ------

4. I think an analog solution like Bill Hawkins described, would be best
suited for this task. But I have not understood it enough to build it.

Best Regards,
C.A.




More information about the time-nuts mailing list