> you misunderstoot my post. TIMER0 is what i want to use for this new function, i'm already using, or are planning > on using, TIMER1 and TIMER2 OK, that's a little bit more work. To recap, you want an interrupt every 250,000 instructions and you want to not use timer 1 or timer 2 for this purpose. One way or the other, you are going to get multiple timer 0 interrupts for each of your 250mS periods. There are lots of ways to set up the details, however: 1 - How accurate does it need to be? 250,000 / 256 = 976.5625. The simplest approach is to do the 250mS processing every 977 timer 0 interrupts. That will be every 250,112 instructions, or only .045% off. If you can tolerate a little more error and want to use less cycles, you can increase the prescaler value. With a 2:1 prescaler setting, you do the 250mS processing every 488 interrupts for .058% error. Since 488 is divisible by 8, you can use a prescaler of 16:1 and do the processing every 61 interrupts for the same .058% error. If you can tolerate .058% error, this is the best way to go because it is the simplest and requires the least overhead. 2 - Note that 250,000 is 256 * 976 + 144. This means that each period you can take 976 "whole" timer 0 interrupts and adjust the timer so that one period ends up only being 144 cycles long. 256 - 144 = 112, which is the amount you want to add to timer 0 to adjust it to a 144 cycle period between interrupts. However, you actually need to add 2 less, since timer 0 increments are inhibited for the two instructions following the add. 3 - If you can tolerate some jitter for each interrupt but don't want accumulating long term error, do a Bresenham to determine the number of timer 0 interrupts per period. This will bounce between 976 and 977, with no long term error. ******************************************************************** Olin Lathrop, embedded systems consultant in Littleton Massachusetts (978) 742-9014, olin@embedinc.com, http://www.embedinc.com -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads