Alan B. Pearce wrote: >> 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. Hmm... When I was suggesting subtracting the period count, I was assuming that timer 1 /increments/ and that the timer flag gets set when it rolls over from 0x0000 to 0xffff. At least that's what my (possibly failing :) memory tells me. This provides the same mechanism you are describing, but with a subtraction instead of an addition. Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist