Hi Reggie, Doh! Yes, of course, you are right, I was a bit over zealous in my analysis there! However, both methods are valid loops (although, mine is not isochronous). Yours gives a greater maximum number of cycles than mine,too. Dennis also pointed out that my expression is wrong for the case where Y=0 or X=0. Yes, although you can count Y=0 as Y=256 and X=0 as X=256,and then it works. I should have mentioned that. Thanks for the corrections. Sean At 10:22 AM 5/7/99 +0800, you wrote: >Hi Sean, > >I think this is not the case, my routine has a "goto $+2" not a "goto >loop" after the first increment (to be isochronous to 5 cycles per >loop). The total cycles should be: > >Cycles = (65536 - (hi * 256 + lo)) * 5 > >Except when hi and lo is zero which is 65536*5 cycles. > >regards, >Reggie > >-- >e-mail: rberdin@bigfoot.com >ICQ#: 31651436 >URL: http://www.bigfoot.com/~rberdin > > >Sean Breheny wrote: >> In case anyone wants to use this loop, the more general form is: >> >> movlw x >> movwf xf >> movlw y >> movwf xy >> delay(A) >> aloop delay(B) >> decfsz xf,f >> goto aloop >> delay(C) >> decfsz yf,f >> goto aloop >> >> Which has the timing expression: >> >> total cycles = (770+256*B+C)*Y + (B+3) * X + A + 2 >> >> In the case given by Reggie, where A=B=C=0: >> >> total cycles = 770*Y + 3*X + 2 >> >> Sean >> >> At 09:42 AM 5/7/99 +0800, you wrote: >> >Hi Scott, >> > >> >How about, 5 cycles per loop, doesn't use W: >> > >> > clrf lo >> > clrf hi >> > >> >loop incfsz lo,f >> > goto $+2 >> > incfsz hi,f >> > goto loop > | | Sean Breheny | Amateur Radio Callsign: KA3YXM | Electrical Engineering Student \--------------=---------------- Save lives, please look at http://www.all.org Personal page: http://www.people.cornell.edu/pages/shb7 mailto:shb7@cornell.edu ICQ #: 3329174