Hi Brian. Nobody knows for sure what black magic is :) Perhaps... It would be strange to expect 1 cycle precision from 3 cycle bit test loop. 2nd thing - in what internal clock ( out of 4 ) TMR1 is incrementing (write) and bit test command reads the bit value. Take a closer look in datasheet that might explain why you miss first three. One magic word is interrupt :) TMR1 is first in the queue. You might also want to change prescaler from 1 to say 4 to make life easier. ( in many situations prescaler=4 is good enough when main clock is 20 MHz ) Out of curiosity - what burst of pulses you are trying to generate with 19.6608 MHz crystal ? :) ( looks like something serial to me .. :) WBR Dmitriy. Brian Harris wrote: > > Greetings, > > I'm using a 16f628's TMR1 At 19.6608 MHz to generate bursts of pulses. > > With TMR1H staying at 0xff, I've noticed that changing TMR1L > from 0xff to 0xfe or 0xfd makes no difference to the loop time between > i_val and goto load in this segment. > > When observed programmed, on a logic analyser or on MPLab's stopwatch, > the loop time is the same for 0xff , 0xfe and 0xfd=4.069010us=20IC's > It changes at 0xfc--0xfa to 4.37962us=23IC's f9--f7=26IC's, f6--f4=32IC's > and 0xac--0xae=101IC's etc etc. > I've noticed this in another 16f870 TMR1 circuit too. > I'm wondering if anyone knows why it's skipping. > In threes by the look of it. > It's perplexing because the application needs to be able to use the finer increments to generate evenly spaced bursts over the range of 1-230 pulses/ms. > Any insight greatly appreciated. > > Thanks, > > Brian Harris > > load means get new values for cnt and int_ > > i_val bcf t1con,tmr1on ;stop tmr1 > movfw int_h ;load interval between pulses > movwf tmr1h > movfw int_l > movwf tmr1l > movlw b'00001001' ;prescaler=1 > movwf t1con ;start tmr1 > btfss pir1,tmr1if ;wait for Timer1 overflow > goto $-1 > bcf pir1,tmr1if > > bsf porta,1 ;output pulse > nop > nop ;*****timed at 2 nops****** > bcf porta,1 > > ;Count out bursts > > decfsz cnt,f > goto i_val > > goto load > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist