[time-nuts] precision timing pulse

Chris Albertson albertson.chris at gmail.com
Thu Nov 17 17:45:32 EST 2016

For counting and timing the ARM has hardware counbter/timmer that is made
with logic gates so you don't need software or to disable interrupts.
Most modern uP has loads and loads of peripheral hardware built-in.   With
the ARM there is a lot more of these peripheral devices than there are pins
on the chip so the hard part is learning how to configure the chip (each is

So rather then doing like the PicDiv does, counting cycles in software you
would load up a bunch of config registers to set up a hardware divide by N

The little AVR chip on the Arduino also has built-in counter but that ARV
chip is pretty low-end so the counter has not the best specs and there are
not so many independent counters

With these counters we could build a scintillation counter that is as good
as you can build using logic gates and not have to resort to assembly
language.   We can program counters to do things like latch their contents
so that if the interrupt handler takes some time to read a value it is OK
because we have a hardware latch.

It takes time to learn to use this, but there are library functions to call
that provide a standard API across several different processors.

>From a software developer's point of view one of the biggest reasons for
using a modern uP is debugging.  Many times we can step through code, line
by line as it executes inside the chip.  Unfortunately the Arduino
environment does not take advantage of this but most professional level
IDEs do.  If time is money source level debugging in C is worth a mint.

Again, you really can get accurate counting, that function in moved to
specialized hardware now that is built into the uP chip.

On Wed, Nov 16, 2016 at 7:17 PM, Hal Murray <hmurray at megapathdsl.net> wrote:

> tvb at LeapSecond.com said:
> > Arduino probably uses compiled code, external libraries, and interrupts
> so
> > that also is a no-no for precise time.
> There are two parts to the Arduino ecosystem.  One is low cost hardware.
> The
> other is a software package that is easy for non-wizards to use.
> I'd be very surprised if somebody hasn't figured out how to call
> subroutines
> coded in assembly language.  If so, you can use their hardware and their
> software environment and write your code like it was running on a bare
> machine as long as you add a wrapper to call it from their environment and
> start your code with a disable interrupts.
> --
> These are my opinions.  I hate spam.
> _______________________________________________
> time-nuts mailing list -- time-nuts at febo.com
> To unsubscribe, go to https://www.febo.com/cgi-bin/
> mailman/listinfo/time-nuts
> and follow the instructions there.


Chris Albertson
Redondo Beach, California

More information about the time-nuts mailing list