I'm trying to build a clock on a 16F870. This will part of another project, but starting with the clock. I'm using some sample code found at: http://www.piclist.com/techref/microchip/intsample.htm The sample uses a 4MHz crystal (I'm using a 4MHz resonator) and timer2 to generate an interupt every 1ms. It's setting the prescaler to 4, the post scaler to 10 and the period register to 25. Has anyone either used this sample or technique before. When I try to use it for controlling a 'clock', it seems to run a little slow (looses about 2-3 seconds over a 10 minute period). Now there part where I probably shot myself: I modified the sample. The original interput routine adds 1 to a 2 byte counter. When the counter his 500 it sets a flag. The main routine (outside of the interupt routine) loops on this flag waiting for it to get set, toggles an LED when it does get set and clears the flag. I've changed the sample interput routine to count up to 1000 (going for a 1 second flag). When the 'one second flag' get set in the interupt routine, in the main loop I add 1 to a single byte counter, convert the result to BCD and shift it out to a pair of cascaded 74HC595 shift registers controlling two 7 segment displays. The displayed seconds seem correct, but after observing the display for a some time (10 minutes), the 'clock' seems to run slow. Any advice would be greatly appreciated. Thanks, Kevin -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics