You can a software correction which automatically applies an offset and places it in EEPROM. However for production you might find it a pain doing this automatically over a 20 hour period. You would need an accurate pulse source as well - say once per hour. I can let you know some more ideas on this if you drop an email. Robin Abbott Forest Electronics - the home of the WIZ-C PIC RAD C Compiler system robin.abbott@fored.co.uk www.fored.co.uk -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of Brooke Clarke Sent: 17 July 2006 16:46 To: piclist@mit.edu Subject: [PIC] TMR2 Not keeping Time? Hi: I'm using Timer 2 as an 8 ms tick interrupt clock. The 16F88 gets it's external clock from a 1.00000000000000 MHz source. But after running for 20 hours the clock is 4 to 5 seconds fast. Any ideas why? Timer 2 is setup: ; Fin Fclk Pre Cntr Freq Post Int Hz Int ms ; 1M 250k 4 250 250 2 125 8 banksel T2CON movlw 0x0D ; 2 post, Cntr On, 4 Pre: 1 MHz in movwf T2CON banksel PR2 movlw .251 ; count to 250 for 10, 5, 1 MHz movwf PR2 banksel PORTA The mid range reference manual says that after TMR2 gets to PR2 it's reset to FF and the 16F88 manual says it's reset to 0. Ten minutes of running shows that PR2 needs to be set to .251 not the 250 that seemed correct. I like the idea that the counter gets automatically reset. In a prior clock using Timer 1 it was a hassle to load the registers and keep track of the latency, but it did work. Have Fun, Brooke Clarke -- w/Java http://www.PRC68.com w/o Java http://www.pacificsites.com/~brooke/PRC68COM.shtml http://www.precisionclock.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist