[time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

Brooke Clarke brooke at pacific.net
Wed Jun 29 12:44:50 EDT 2016


Hi David:

I built a number of clocks based on PIC uC and using interrupts. The idea is to use the output from a frequency standard 
as the heart beat of the clock.
Depending on what the PIC was doing when interrupted the delay can different by one cycle and a simple test corrects 
that.  Clock settable to 1ms and keeps perfect time.
http://www.prc68.com/I/PRC68COM.shtml#07092006
I wrote this directly using the Microchip assembler.  I'm not a fan of C.

My first uC was the SWTP kit that came with no software.  I learned to write directly in hex machine language.  The 
problem with that is every time code is changed inside a loop the target address needs to be recomputed.  Later I got a 
copy of the Motorola assembler and editor which was a big help.
http://www.prc68.com/I/comp.shtml#SWTP

-- 
Have Fun,

Brooke Clarke
http://www.PRC68.com
http://www.end2partygovernment.com/2012Issues.html
The lesser of evils is still evil.

-------- Original Message --------
> O M G..
>
> So I followed the link and saw how they do it.    Wow.  They write interrupts like the DMV processes applications. I can only imagine what this looks like on the PIC, where every instruction takes 4x as many cycles.
> All of that pushing and popping is PRECISELY what you need to avoid.
> Pushing any register that the ISR does not actually change is totally insane.
> My average ISR is far shorter than their intro and outro code.
>
> "C" does not cooperate easily with this, but you can declare your interrupts "naked" and write them in assembler so as to avoid this insanity.
>
> I say this as someone who has been developing on the AVR platform for something like 20 years.   My first application was on the 8515, and they didn't even have production silicon yet. My development was done on a chip with date code "ES"  (Engineering Sample)
>
>
> _______________________________________________
> 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