>> I'm running PIC with 4MHz crystal oscillator and I've been trying to implement a clock using TMR2 interrupt. I initialized TMR2 with prescaler 4, postscaler 1:1 and period 250. So, I'm getting interrupts every millisecond. When a counter inside ISR reaches 1000 I increment seconds and zero the counter. Am I right so far? << Yep. I've done this many times. Your clock should be as accurate as your crystal. >> Anyway, clock lags behind about a second in 4 minutes. << There is something seriously wrong here. Either your crystal isn't what you think it is (is it specified for parallel operation?), or you have a bug that missing some ticks. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body