;Retardos Generados para un Oscilador de 4Mhz
;ret10ms ret20ms ret30ms ret40ms
;ret50ms ret100ms ret200ms ret250ms ret300ms ret400ms
;ret500ms ret1seg
cblock
	PDel0
	PDel1
endc

retardo10ms
;-------------------------------------------------------------
; Generado con PDEL ver SP  r 1.0  el 08/04/2005 Hs 13:57:44
; Descripcion: Delay 10000 ciclos
;-------------------------------------------------------------
;DEMORA  movlw     .8       ; 1 set numero de repeticion  (B)
        movwf     PDel0		; 1 |
PLoop1_10ms
	    movlw     .249      ; 1 set numero de repeticion  (A)
        movwf     PDel1		; 1 |
PLoop2_10ms  
		clrwdt              ; 1 clear watchdog
        clrwdt              ; 1 ciclo delay
        decfsz    PDel1, 1  ; 1 + (1) es el tiempo 0  ? (A)
        goto      PLoop2_10ms    ; 2 no, loop
        decfsz    PDel0,  1 ; 1 + (1) es el tiempo 0  ? (B)
        goto      PLoop1_10ms    ; 2 no, loop
PDelL1_10ms
	    goto PDelL2_10ms        ; 2 ciclos delay
PDelL2_10ms
		clrwdt              ; 1 ciclo delay
        return              ; 2+2 Fin.
;-------------------------------------------------------------


retardo50ms 
;-------------------------------------------------------------
; Generado con PDEL ver SP  r 1.0  el 01/04/2005 Hs 0:42:56
; Descripcion: Delay 50000 ciclos
;-------------------------------------------------------------
;DEMORA
		movlw     .55       ; 1 set numero de repeticion  (B)
        movwf     PDel0     ; 1 |
PLoop1_50ms
		movlw     .181      ; 1 set numero de repeticion  (A)
        movwf     PDel1     ; 1 |
PLoop2_50ms  
		clrwdt              ; 1 clear watchdog
        clrwdt              ; 1 ciclo delay
        decfsz    PDel1, 1  ; 1 + (1) es el tiempo 0  ? (A)
        goto      PLoop2_50ms    ; 2 no, loop
        decfsz    PDel0,  1 ; 1 + (1) es el tiempo 0  ? (B)
        goto      PLoop1_50ms    ; 2 no, loop
        return              ; 2+2 Fin.
;-------------------------------------------------------------

retardo500ms
;-------------------------------------------------------------
; Generado con PDEL ver SP  r 1.0  el 08/04/2005 Hs 14:08:11
; Descripcion: Delay 500000 ciclos
;-------------------------------------------------------------
;DEMORA  movlw     .239      ; 1 set numero de repeticion  (B)
        movwf     PDel0     ; 1 |
PLoop1  movlw     .232      ; 1 set numero de repeticion  (A)
        movwf     PDel1     ; 1 |
PLoop2  clrwdt              ; 1 clear watchdog
PDelL1  goto PDelL2         ; 2 ciclos delay
PDelL2  goto PDelL3         ; 2 ciclos delay
PDelL3  clrwdt              ; 1 ciclo delay
        decfsz    PDel1, 1  ; 1 + (1) es el tiempo 0  ? (A)
        goto      PLoop2    ; 2 no, loop
        decfsz    PDel0,  1 ; 1 + (1) es el tiempo 0  ? (B)
        goto      PLoop1    ; 2 no, loop
PDelL4  goto PDelL5         ; 2 ciclos delay
PDelL5  goto PDelL6         ; 2 ciclos delay
PDelL6  goto PDelL7         ; 2 ciclos delay
PDelL7  clrwdt              ; 1 ciclo delay
        return              ; 2+2 Fin.
;-------------------------------------------------------------


ret10ms macro
	call retardo10ms
endm

ret20ms macro
	ret10ms
endm

ret30ms macro
	ret10ms
	ret20ms
endm

ret40ms macro
	ret40ms
	ret20ms
endm

ret50ms macro
	call retardo50ms
endm

ret100ms macro
		ret50ms
		ret50ms
endm

ret200ms macro
		ret100ms
		ret100ms
endm

ret250ms macro
		ret200ms
		ret50ms
endm

ret300ms macro
		ret100ms
		ret200ms
endm

ret400ms macro
		ret200ms
		ret200ms
endm


ret500ms macro
		call retardo500ms
endm

ret1seg macro
		ret500ms
		ret500ms
endm	
