On a sunny day (Sun, 06 Sep 2009 09:11:55 +0300) it happened Paul Keinanen wrote in :
Here are some test output (real) from measuring my CB transmitter on channel 39, comments added later:
Ah, I made a mistake, was already surprised all was so stable. This sequence shows the mistake:
27389568 27,389,568 Hz
27389536 27,389,536 Hz
27389920 27,389,920 Hz
27389952 27,389,952 Hz
When slowly changing the crystal frequency, the display makes 32 Hz steps. The resolution is only 32 Hz!
This is because of the / 32 pre-scaler used for the high frequencies. This is the timer 0 pre-scaler. A software issue, as timer0 is only 8 bits, and to get a < 4MHz signal at the output of timer0 for an theoretical maximum input frequency of say 100 MHz, so a PIC with 20 MHz crystal and instruction cycle of 20 / 4 = 5 MHz can measure the timer0 output, you need to divide by 25, and that is not a binary value, and the next one up is :32.
This could be improved by using timer1 perhaps, it is a 16 bit timer. And there is a Microchip application note that shows how to get the value of the prescaler counter, so 1 Hz is possible. But that would require a rewrite, I used the counter code from somebodies 7 segment display project, not my own. I would have to rewrite the whole thing.... In the mean time 32 Hz is not bad as resolution on the highest frequency range. I will keep the 8 digits :-)
Hope I understood it now :-)