#include <p12f629.inc>
LIST p=12F629
PDel0 equ 21h ; variable de temporizacion
PDel1 equ 22h ; variable de temporizacion
PDel2 equ 23h ; variable de temporizacion
contador equ 24h ; variable que cuenta los minutos que faltan
;W_TEMP equ 25h
;PCLATH_TEMP equ 26h
;STATUS_TEMP equ 27h
org 0000h ; Origen de reset
goto inicio
org 04h ; origen de interrupcion
; MOVWF W_TEMP
; SWAPF STATUS,W
; CLRF STATUS
; MOVWF STATUS_TEMP
; MOVF PCLATH, W
; MOVWF PCLATH_TEMP
; CLRF PCLATH
movlw b'00000010'
movwf GPIO
bcf INTCON,INTF ;limpiar flag de interrupcion GP2(¡GP2 posee interr exclusiva!)
tmp ; tiempo de 1 segundo para que permanezca encendido el led antes de irse de la interrupcion
movlw .14 ; 1 set number of repetitions (C)
movwf PDel0 ; 1 |
PLoop0 movlw .72 ; 1 set number of repetitions (B)
movwf PDel1 ; 1 |
PLoop1 movlw .247 ; 1 set number of repetitions (A)
movwf PDel2 ; 1 |
PLoop2 clrwdt ; 1 clear watchdog
decfsz PDel2,1 ; 1 + (1) is the time over? (A)
goto PLoop2 ; 2 no, loop
decfsz PDel1,1 ; 1 + (1) is the time over? (B)
goto PLoop1 ; 2 no, loop
decfsz PDel0,1 ; 1 + (1) is the time over? (C)
goto PLoop0 ; 2 no, loop
PDelL1 goto PDelL2 ; 2 cycles delay
PDelL2 clrwdt ; 1 cycle delay
; MOVF PCLATH_TEMP, W
; MOVWF PCLATH
; SWAPF STATUS_TEMP,W
; MOVWF STATUS
; SWAPF W_TEMP,F
; SWAPF W_TEMP,W
retfie
;********** Declaracion de entradas y salidas **********
inicio
movlw 0x07
movwf CMCON ;GP<2:0> digitales
bsf STATUS,RP0 ; cambia a banco 1
movlw b'10010000' ; habilito la interrupcion
movwf INTCON
movlw b'00110100' ; 0,1 y 3 como salidas. 2,4 y 5 como entradas
movwf TRISIO
bcf STATUS,RP0 ; regresa al banco 0
bucle
clrf GPIO
goto bucle
end