James, Let me change my wording a little bit here. Won't those two=20 instructions put the settings back to the proper values so that the=20 timer counts the proper number of cycles to give me the 100mS delay? Thanks, rich! On 7/21/2014 11:34 PM, James Cameron wrote: > On Mon, Jul 21, 2014 at 11:09:04PM -0500, Richard R. Pope wrote: >> Joe, >> My resettimer function does this: >> resettimer() >> { >> TMR1H =3D 0x0B; >> TMR1L =3D 0xDC; >> } >> Doesn't that set the timer registers back to 0 and as soon as I >> turn the timer back on it will count to the proper value for 100mS? > No, that sets the timer to 0xbdc, or 3036 decimal. THR1H and TMR1L > together make up a 16-bit counter, H means high byte, L means low > byte. > > When the timer is allowed to run, it will count up and overflow to zero, > and when it reaches zero an interrupt will trigger and your ISR will > be started. > > This technique is called preloading the timer, as opposed to free > running the timer. > > The number of counts will be 0x10000 minus 0xbdc, which is 62500. > > How this relates to instruction cycles will depend on a prescaler > configuration. > > (By the way, if you read the timer in your ISR you will find it > advanced from zero by as many instruction cycles as were required to > get to that point in the ISR.) > --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .