I'm using timer1 to divide the instruction clock and keep time. The problem that I am having is that I cannot seem to get 16 bit resolution out of the counter. I set up the TMR1H and TMR1L to count clock cycles and to roll over after 100mS. I was close and wanted to adjust the value and found that I was unable to get the resolution that 16 bits should provide. Clock = 4MHz Fosc/4 = 1MHz Prescale = 1:8 T1CON = %00110001 I calculate that I should have 8uS per count with this setup. 65536 counts will give an timer overflow at 0.524288 seconds. I set up TMR1H and TMR1L with 0, 0 and that was the time that it took to fill the counter. So far so good. I then programmed the registers with TMR1H = 207, TMR1L = 44 (16 bit: 53036) , the overflow occurred at 102.4mS (2.4ms too long) I figured, OK I know I have to account for instruction time in resetting the timers, but 2.4mS? That's approx. 2400 instructions, so something else is going on here. Next step was to program TMR1H and TMR1L up and down with values so that I could "dial in" the 100mS that I was looking for. I adjusted the values up and nothing happened until I got to TMR1H = 209, TMR1L = 196 (16bit: 53700), at that point the interval decreased to 94.5mS I adjusted the values down to get the transition point below 102.4mS and at TMR1H = 205, TMR1L = 236 (16 bit: 52716) the interval increased to 110.3 mS So I have a count delta of 53700 - 52716 = 984 counts My time delta between the two points is 102.4mS - 94.5mS = 15.8mS That works out to about 16uS per count. The problem is that the minimum change I can effect is 8mS increments and it takes 500 counts to do that. So much for the 8uS increments. I have included the update code below that I'm using to reset the timer for this test. Any ideas what I'm doing wrong??? Thanks Scott ----------------------------------------------------- oscH and oscL are bank0 bytes and loaded outside of the loop LoopStart clrf STATUS ;set to bank 0 btfss PIR1, 0 ;test the TMR1IF GoTo skipReset ; bit clear then skip the code movf oscH, W ;get the high byte movwf TMR1H ;save the high byte movf oscL, W ;get the low byte movwf TMR1L ; finish reset of timer1 movlw 4 xorwf PORTB, 1 ;TOGGLE LED bcf PIR1, 0 ;clear TMR1IF skipReset nop goto LoopStart _______________________________________________ http://www.piclist.com View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist