From Andrew Warren
; This routine delays X cycles. Enter with X (in the range ; [20-271]) in the W register. ; ; Note that the delay is inclusive of the "MOVLW X", "CALL ; DELAY", and "RETURN" overhead, so a sequence like: ; ; MOVLW 100 ; CALL DELAY ; MOVLW 200 ; CALL DELAY ; ; will delay EXACTLY 300 cycles. DELAY: MOVWF COUNTER BTFSC COUNTER, 0 GOTO $+1 BTFSS COUNTER, 1 GOTO SKIP NOP GOTO $+1 SKIP: RRF COUNTER RRF COUNTER MOVLW 4 SUBWF COUNTER BCF COUNTER,6 BCF COUNTER,7 LOOP: NOP DECFSZ COUNTER GOTO LOOP RETURN
Interested: