[time-nuts] precision timing pulse

Bryan _ bpl521 at outlook.com
Thu Nov 17 16:26:41 EST 2016


As you were gracious to release the source code for these excellent little dividers, I would suspect someone who is somewhat fluent in assembly could just modify so it counts a specific number of pulses and then toggles a output off. The ARM could be used to restart etc. Although I think the OP wanted to know the time taken between a run of a number of cycles.

Been playing around with the PD15 to replace 2 -14 pin clock dividers and it seems to work like a charm, although I can't seem to find any information if the inputs on a 12F675 are Schmitt trigger inputs. Can't seem to find anything in the datasheet.


From: time-nuts <time-nuts-bounces at febo.com> on behalf of Tom Van Baak <tvb at LeapSecond.com>
Sent: November 16, 2016 3:27 PM
To: Discussion of precise time and frequency measurement
Subject: Re: [time-nuts] precision timing pulse

Chris & Chris,

Yes the "TVB dividers" are instruction loops where every cycle is counted by hand, and then verified with a simulator, and then checked with a time interval counter. All the code is out there at www.leapsecond.com/pic/<http://www.leapsecond.com/pic/>

I use PIC's for historical and technical reasons. Modern CPU's and MCU's have so many layers of optimization that they are no longer deterministic at the cycle level. This makes them worthless for precise time applications. In addition many of them use clock edge or PLL tricks to increase speed, but this introduces jitter. Or they enable interrupts which kills precise timing. The PIC's are old-school, fully synchronous and use only one clock edge so the jitter is down at the picosecond level. My code is isochronous and doesn't use interrupts for timing. It acts like a poor man's FPGA.

Arduino probably uses compiled code, external libraries, and interrupts so that also is a no-no for precise time. I'm not sure about bare metal AVR. I hope someone can do measurements on an AVR divider one day so we can compare PIC and AVR jitter. I worry about how AVR implements the clock. So this is an open question. But I know how PIC's work so that's what I use. BTW, these are "ancient" PIC 12F parts. It's possible modern 16- and 32-bit PIC's also go to the dark side and optimize for performance rather than picosecond determinism. Another open question.

Realize that using a MCU for a frequency divider is a weird niche use of the chip, so none of what I say applies if you plan to use any of these as a general purpose computing system.

Also, we don't know if OP is looking for microsecond, nanosecond, or picosecond precision in his timing pulses.


Chris Albertson:
> I'm wondering why everyone seems to be assuming a PIC is the right
> processor.   Of course it could work for this but I'd select whatever is
> the easiest to program and debug.   Those tend to the they little single
> board development systems that sell for under $10.  They typically have USB
> connections to a computer and don't require any specialized equipment to
> program.   The Arduino is the prime example of these although I've moved to
> ARM based uP because they can be less expensive with an order of magnitude
> better performance and can use the same Arduino IDE and run Arduino
> sketches.    The PIC is not so beginner friendly and requires some study
> before it can be used.    But if you as said of course a PIC could work,
> this is a pretty simple application

Chris Caudle:
> You could use AVR (arduino), but once you get to most of the ARM
> processors it is harder to make them deterministic because of caches.  You
> want a processor where the number of clocks is constant for all or almost
> all instructions, and is easy enough that you can code the loops by hand.
> Code like TVB's divider probably doesn't even use interrupts, it's just a
> tight loop where the number of instructions is counted to give the
> behavior wanted.

time-nuts mailing list -- time-nuts at febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
time-nuts Info Page - American Febo Enterprises<https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts>
time-nuts is a low volume, high SNR list for the discussion of precise time and frequency measurement and related topics. To see the collection of prior postings to ...

and follow the instructions there.

More information about the time-nuts mailing list