Hi, I implement long delays like below to be easy to compute and to avoid errors. ; delay = 7*(256*delay) + 3 movlw delay movwf tmp1 clrf tmp2 clrf tmp3 loop decfsz tmp3,f goto $+2 decfsz tmp2,f goto $+2 decfsz tmp1,f goto loop Adding extra decfsz and goto $+2 pairs, makes the delay longer. Trimming delays for accuracy, I use the routine below. ;********************************************************************** ; Adjustable delay from 11-256 cycles (for 14 bit core) ; W = count, cycle count excludes loading of W ; by Regulus Berdin delay: addlw -(.10+1) ;2+1 remove 1 count more for carry correction addlw -4 ; 1 skpnc ; 1/2 goto $-2 ; 2 sublw 0xFF ; 1 addwf PCL,f ; 2 delay7 nop ; delay adjuster delay6 nop ; delay5 nop ; delay4 return ;2 regards, Reggie Sean Breheny wrote: > > Hi Mark, > > Sorry, I don't have time at the moment to give you a full reply. I did find > out, though, while looking at what you were asking, that there is an error > on my PIC loop optimization page. The formula for form N2 is incorrect (so > therefore the program for calculating N2 and the N2 table are also > incorrect). > > I will try to answer your question and correct the error as soon as I can > (I am getting blitzed with assignments here at school right now!) > > Sean > > At 11:40 AM 4/17/00 MDT, you wrote: > > I am new to PIC and have a limited understanding of timing loops. > > I have toiled over several PIC books and Microchip Docs to find a simple > >explaination for timing loops(to no avail). If you have a simple format or > > [SNIP] > | > | 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