[time-nuts] 10 MHz to 32.768 kHz converter

Tom Van Baak tvb at LeapSecond.com
Sun Mar 20 18:01:41 EDT 2016


Hi Martyn,

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

This thread may also be of interest:
https://www.febo.com/pipermail/time-nuts/2008-October/034020.html
https://www.febo.com/pipermail/time-nuts/2012-February/063557.html


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

That's one way. Here two methods are tested, both on a PC and on a PIC:
http://www.leapsecond.com/tools/10m32k.c


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

When the PIC is in its 38 instruction loop the instantaneous output frequency is 32894.736842 Hz.
When the PIC is in its 39 instruction loop the instantaneous output frequency is 32051.282051 Hz.

Over exactly 1 second the average loop is 38.14697265625 instructions so the average frequency is 32768.000000 Hz. However, because of the PWM-like output, and depending on your gate time, your frequency counter may get confused and give readings between 32.1 kHz and 32.8 kHz, depending on which loop it sees at any given moment. If your frequency counter can generate exactly 1 second gate time in theory you should see an output of 32.768000000 kHz. What gate time are you using? What counter are you using? For testing a chip like this it's much better to use a totalizing or time interval counter instead of a frequency counter.

But here's an easier way to test your 10 MHz-to-32768 Hz divider:

1) divide your 10 MHz to 1 Hz with my PD07 (http://leapsecond.com/pic/src/pd07.asm)
2) divide same 10 MHz to 32768 Hz with your divider
3) divide said 32768 Hz to 1 Hz with my PD33 (http://leapsecond.com/pic/src/pd33.asm).
4) use a TIC to compare both 1 Hz signals

If the TI readings are constant you're done. If there's drift, then you have a cycle counting error.


> Does the actual model of PIC chip influence the accuracy?

No. I use PIC12F675 for all my dividers, but any PIC will work. You could use AVR too, adjusting the loop timings accordingly.

/tvb



----- Original Message ----- 
From: "Martyn Smith" <martyn at ptsyst.com>
To: <time-nuts at febo.com>
Cc: "'DM'" <usmarees at hotmail.com>
Sent: Sunday, March 20, 2016 11:26 AM
Subject: [time-nuts] 10 MHz to 32.768 kHz converter


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 -- time-nuts at febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


More information about the time-nuts mailing list