Jeffrey Siegel wrote: > I'm trying to create an interrupt every millisecond...and I'm > really really close, but not perfect.... > .... > I did check the listing file and the compiler is putting 0xEC78 > (decimal -5000) into the TMR1L/TMR1H counter. Jeffrey: The inaccuracy is caused by the delay between the Timer1 timeout and the reloading of the TMR1H:L registers in your interrupt-service routine. In other words, by the time you get around to resetting it to -5000, Timer1 has already counted past 0 (it's counted all the way to 46, judging from the comments you made later in your message). You can fix this two ways: 1. Instead of loading TMR1H:L with -5000, load it with THE CURRENT VALUE OF TMR!H:TMRL MINUS 5000. That'll compensate for the additional Timer1 counts that will have occurred before the ISR loads the registers. 2. Use the Timer1 "Compare" feature, as documented in the "CCP (Compare/Capture/PWM)" section of the data sheet. -Andy === Andrew Warren - fastfwd@ix.netcom.com === Fast Forward Engineering - Vista, California === http://www.geocities.com/SiliconValley/2499 === === The reports of my demise have been greatly exaggerated.