; **** Encabezado ****
list p=16F88
include <P16F88.INC>
ERRORLEVEL -302
__CONFIG _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_ON & _MCLR_OFF & _PWRTE_ON & _WDT_OFF & _XT_OSC
__CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF
CLOCK equ 8000000
;-----------------------------------------------------------------------------------------------------------
; Definiciones de la memoria RAM
cblock 20
PDel0
PDel1
PDel2
endc
;-----------------------------------------------------------------------------------------------------------
ORG .0 ; Vector del inicio/reset
bcf STATUS,RP0 ;Selecciono el banco 0
bcf STATUS,RP1
goto INICIO
ORG .4 ; Vector de interrupciones
clrf INTCON ; Borro todas las interrupciones
return
; Programa principal
INICIO ; etiqueta
clrf INTCON ; Borro todas las interrupciones
bsf STATUS,RP0 ; pone a uno el bit 5 del registro STATUS (el rp0 para pasar al banco 1)
movlw B'00000' ; carga 00000 en W
movwf TRISA ; puerto a todos salidas pasa w que es 00000 a trisa
movlw B'00000000' ; carga 00000000 en W
movwf TRISB ; puerto b todos salidas
bcf STATUS,RP0 ; pone a cero el bit 5 del registro STATUS (el rp0 para pasar al banco 1)
clrf PORTA ; Borro todo el puerto A
clrf PORTB ; Borro todo el puerto B
RETORNO
movlw B'00000000' ; Borro puerto B
movwf PORTB
call DEMORA
movlw B'11111111' ; Seteo puerto B
movwf PORTB
call DEMORA
goto RETORNO
;-------------------------------
; Rutina de demora
DEMORA movlw .14 ; 1 set numero de repeticion (C)
movwf PDel0 ; 1 |
PLoop0 movlw .72 ; 1 set numero de repeticion (B)
movwf PDel1 ; 1 |
PLoop1 movlw .247 ; 1 set numero de repeticion (A)
movwf PDel2 ; 1 |
PLoop2 clrwdt ; 1 clear watchdog
decfsz PDel2,f ; 1 + (1) es el tiempo 0 ? (A)
goto PLoop2 ; 2 no, loop
decfsz PDel1,f ; 1 + (1) es el tiempo 0 ? (B)
goto PLoop1 ; 2 no, loop
decfsz PDel0,f ; 1 + (1) es el tiempo 0 ? (C)
goto PLoop0 ; 2 no, loop
PDelL1 goto PDelL2 ; 2 ciclos delay
PDelL2 clrwdt ; 1 ciclo delay
return ; 2+2 Fin.
;-----------------------------------------------------------------------------------------------------------
END