>Thanks for the idea of subtracting to set Timer 1. >I know about testing the lsb of the timer, and I >see how subtracting would also work. You don't need to do any special subtracting with timer 1. Remember that the timer counts from the value you load down to 0, and then when counting from 0 to -1 it sets the timer 1 flag that can generate the interrupt, when the interrupt flag is enabled. Each clock cycle will count further in the negative direction, so by the time you service the timer it might have reached -8 to -10. Now the trick is not to load the timer with the count value, but to ADD the count value to the negative value in the timer. This then automagically takes account of the number of clock counts since the flag was set as the count plus the negative count is loaded into the timer, and so deals with the program latency from when the flag was set. Doing things this way also allows the timer to be at a lower priority in the interrupt chain, or if it is being handled without interrupts allows a longer time period between flag checks, while still maintaining the timer accuracy. The only gotcha to doing this is that you STILL have to service the timer in less time than the time count, otherwise you will loose counts. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist