"Michael A. Powers" wrote: > > Hello, > > I have been experimenting with TMR0 and the prescaler to provide timing delays in my application. It seems pretty easy to do if you want short delays. However, when you are using a 4MHz clock, it seems to get difficult to get long delays, say like 1s. I can set the prescaler to 1:128 and start TMR0 at 0, and have the timer overflow every 32,768 cycles. At 4MHz, that's orders of magnitude away from a 1s delay, and I would like to have delays of 24 hrs or more! The only way I can think of getting around this is having the interrupt routine increment another register, and be able to count the cycles to a second that way. But again, that's a very inconvenient way if you want a routine to function every 24 hrs, you would need quite a lot of bits! I guess I have two other options, slowing the instruction clock down to the kilohertz range, or putting a secondary oscillator on T0CKI. If anyone has any advice to share, I'd be grateful to hear it. > > Thank You, > -Mike TMR0 can cycle every 65mS with the PS at 1:256 @4MHz That is roughly 15 counts per second and would need some trimming. There was some info about error free timing not long back. 86400 seconds in a day 15 X 86400 = 1296000 counts. 129600 = 13 C6 80 in HEX so you would need 3 registers. You could also 5 registers for these... 15 loop counter 1 second count - increments every 15 cycles 1 minute count - increments every 60 sec 1 hour count - increments every 60 min 1 day count - increments every 24 hour -- Best regards Tony mICros http://www.bubblesoftonline.com mailto:sales@bubblesoftonline.com -- 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