My problem: measure powerline frequency accurate to 2 decimals. If the frequency is 59.99 Hz, I want to know that much, and not round it off to 60 Hz.
What I know: I will require an accurate and stable master timebase. No worries, mate. I have a +/- 1 ppm TCXO
Straightforward but not very practical solution: Measure for 100 secs to obtain the required resolution.
Alternate solution: Count the number of master clock cycles from a powerline leading edge to the next leading edge. For instance, if the master clock is 1 Mhz, there will be 16,666 cycles at 60.00 Hz, and only 16,669 at 59.99 Hz.
I know the Picaxe is too slow to count 1 Mhz. What I was planning to do, is to employ an external 16 bit counter 74LV8154, which will be gated, read and reset by a Picaxe 20X2 or 18 M2.
So, if you have the hardware figured out, what is the question?: How do I actually perform the cycle count to Hertz conversion. I was originally thinking of using a lookup table, but the number of entries is humongous!! Between 59 and 61 Hz there are 200 entries.