How about Bresenham's Algorithm to alternate imperfect periods to produce an average that matches any "perfect" period.

Refer to Bob Ammerman work to use Bresenham-type system for PIC MCU. He was using the counter works in the background, either by polling or Interrupt-Driven. So, the "SuperCycle" continues to run. The timer count the value is stored in a 3-byte register that is decremented by the software.

Regards,
Vlad

On 2016-03-20 14:26, Martyn Smith wrote:
Hello,



First of all quick apologies for sending an email last week without
deleting all the old information from previous postings.



I have been playing around with producing 32.768 kHz from 10 MHz using
a PIC chip.



I  have a real time clock calendar chip that requires a 32.768 kHz
crystal.  I want to feed it with 10 MHz signal instead, so it is
synchronised to my main 10 MHz in a frequency standard I am designing.



The method I’m using has been documented before where we have two
loops running 9632 times through a 39 instruction loop and
55904 times through a 38 instruction loop, each time toggling the output pin.



I have done this and am getting approximately 32.768 kHz with the FM
modulation as described by previous authors.



My question is should I expect exactly 32.768000000 kHz (obviously
assuming we use the same 10 MHz to drive the divider and all test
equipment)?



The closest I can get the 32.768 kHz is within about 0.1 Hz.



Does the actual model of PIC chip influence the accuracy?



Regards



Martyn







_______________________________________________
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.

--
WBW,

V.P.
_______________________________________________
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.

Reply via email to