I ended up doing just this and it worked out nicely. Using the timer hardware as a counter freed up the CPU for other tasks and could run in the background so I wouldn't miss any ticks. It turns out that using the built-in timer hardware was a lot easier than using external "jellybean" logic to accomplish the same thing, even if it took a bit of reading to better understand it.
I whipped up a quick-and-dirty Arduino sketch that I've made available at https://github.com/heypete/Frequency_Counter_32kHz/ for anyone who's interested. I make no claims to its quality, but I've tested it with runs from 10 seconds to 20,000 seconds and it seems to produce the expected results on both a standard Arduino Uno and a bare 16MHz ATmega328P. Any suggestions or improvements would be welcome. Also, thanks to everyone for your assistance. It was a fun learning experience and excursion outside the standard Arduino commands into the mysterious depths of the datasheet and hardware registers. Cheers! -Pete On Wed, Jun 29, 2016 at 6:49 AM, Scott Stobbe <[email protected]> wrote: > For pulse counting, the timer hardware is the way to go. Setup a 16-bit > timer clocked off your DUT. Then input capture on your PPS edge. This > leaves you plenty of processor time for string formatting and other tasks > you may wish to perform. > > If you do the decimation as post-processing on your PC (i.e. log cycle > count every PPS), you can use a zero-phase moving average filter, which may > provide more visual insight over just a single data point every 1000s. > > On Tue, Jun 28, 2016 at 3:48 PM, Hal Murray <[email protected]> wrote: > >> >> [email protected] said: >> > I have seen those, but I have little experience with PICs and the Wife >> > Acceptance Factor of buying more stuff for a one-off measurement is low. >> >> The PIC family is very similar to AVRs. The picPET and friends are 8 pin >> DIPs so the Wife is unlikely to notice the additional clutter. >> >> >> >> The PPS input on a PC may be be useful. >> > Indeed. I normally use it for NTP. >> >> Than you want a second serial port for things like this. >> >> Or maybe you can use the parallel port if your system is old enough to have >> one. I haven't tried it, but I think Linux has a module that supports it. -- Pete Stephenson _______________________________________________ time-nuts mailing list -- [email protected] To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts and follow the instructions there.
