On Tue, 17 Dec 2002 09:21:15 -0500, you wrote: >The way I've been measuring is to measure the time - let it run for 8 >hours, and compare it to a better standard. I use my PC's clock, since I >use NTP to sync the clock to the atomic standard, so the PC clock is >accurate over the course of several hours. I don't have access to a freq >counter, unfortunately. I could try using the PIC's clock (20 MHz xtal) = to >measure the period of the watch xtal, but I don't know how accurate that= is >either! > >Unfortunately, the osc is running slow, so a trimmer will make things >worse, not better. I can try making the caps in the osc circuit smaller = and >see what happens there. > >Making one adjustment every 8 hours is a slow way to do things. Maybe I >should just compensate in the code. Just add 1 second every once in a >while. Sort of a software trimmer capacitor. That's how I handle analog >calibration - rather than trim the gain of an op amp, I just use a >precision resistor as close as I can get, and calibrate and compensate = in >the code. ..but you don't need to do adjustments that long apart.... an accurate frequency counter with interval capability would give you a much quicker answer.=20 6 seconds in 8 hours is 208 microseconds in 1 second - even the cheapest frequency counter will give 100nS resolution on a 1 second measurement period, and you can calabrate the counter to within a few PPM with a TXCO module from a scrap cellphone.=20 Software calibration would be a prefectly reasonable way to correct for the measured error. If you want to get really clever, you could inject a known low-frequency signal into a pin, and have the code measure it against the 32K xtal to generate the correction factors.=20 Come to think about it, you could just inject an accurately known frequency into the PICs OSCIN pin (overriding the crystal resonator), and use the PIC to accurately measure the 32K osc frequency and either generate its own correction factor, or spit the measurement out serially on an I/O pin to allow the correction factor to be calculated and programmed into eeprom or OTP. >Larry > >At 01:39 PM 12/17/2002 +0000, you wrote: >>These xtals often need tuning by tweaking the capacitance. >>remember also that they are designed to run over a fairly narrow temp >>range (i.e. strapped to people) and accuracy will fall off outside >>that range. >>All the watch modules I've ever taken apart have had a trimmer. >>Obviously you can't trim by measuring the xtal freq as the measuring >>probe will change the capacitance - you need to generate a signal from >>the PIC to measure, but remember that you will get jitter from the >>PIC's main clock sampling the 32K xtal, so you need to measure over a >>reasonably long period - probably several seconds at least.. >> >>On Tue, 17 Dec 2002 08:17:47 -0500, you wrote: >> >> >Any idea what sort of accuracy I should get from a cheap watch xtal = in a >> >PIC oscillator? >> > >> >I'm using one as the T1 osc on a '877. I let the timer free-run (I = don't >> >preset it - it rolls over in 2 seconds), and have an interrupt = routine that >> >keeps track of time-of-day. When I compare the time of day from this = with >> >the actual time, the PIC has lost about 6 seconds in 8 hours. Not = very good. >> > >> >Larry >> > >> >Larry Bradley >> >Orleans (Ottawa), Ontario, CANADA >> >>-- >>http://www.piclist.com hint: To leave the PICList >>mailto:piclist-unsubscribe-request@mitvma.mit.edu > >Larry Bradley >Orleans (Ottawa), Ontario, CANADA -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu