Hello PICLIST, I found one delay routine in which I think it has errors the code and explanation is here http://techref.massmind.org/techref/piclist/weedfreq.htm I have one question for this part of code from WCT5.ASM: ; int_del movlw 0x05 ;delay 5.000 ms (4 MHz clock) movwf count1 d1 movlw 0xA5 movwf count2 d2 decfsz count2 ,f goto d2 decfsz count1 ,f goto d1 retlw 0x00 Why in comment it is said that this delay is 5 ms while actually it is 2.5ms ? I make my one calculation here it is (processor cycles is in '()' ): int_del movlw 0x05 (1) movwf count1 (1) ;494 + 2 d1 movlw 0xA5 (1) movwf count2 (1) ;this is for 3 cycles * 0xA5(165) = 495 -1 -this is for last ;iteration d2 decfsz count2 ,f (1) (2) goto d2 (2) | ;494 + 2 + 3 = 499 decfsz count1 ,f (1) (2) goto d1 (2) | ;499 * 5 -1 (for last iteration) = ;2494 + 2(first two instruction) + 2(return) = 2498 retlw 0x00 (2) if we add 2 for call of this delay function the processor cycles are 2500 * 1000uS = 2.500 ms not 5.000 ms ! If I'm wrong please say to me what I do wrong in my calculation. -- Best regards, Ivan mailto:i_dachev@prosyst.bg -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.