Sei sulla pagina 1di 2

;Nom del programador: Pablo Jose Velasquez Martinez

;Nom del Programa:


;Explicaci:
;Data:
;Versio:
;----------------------------------------
;Vectors
;RESET
ORG 0 ;Vector Reset
Goto Init
;INTERRUPCIO
ORG 04 ;Vector d'interrupcio
goto INTERRUPCIO
;----------------------------------------
;ETIQUETES
T1 equ 0ch ;Temps
T2 equ 0dh ;espera
T3 equ 0eh ;Milis
t4 equ 0fh ;conta
t5 equ 10h ;direccio
;----
Dades1 equ 10H ;Dades1 ->DADES1
Dades2 equ 20H ;Dades2 ->DADES2
Resul equ 30H ;Resul ->RESULTAT
Oper equ 40H ;Oper ->OPERACIONS
;OPER+1 = Comptador_TEMP
S
;----------------------------------------
Init ;Inicialitza el Programa
org 10
call Init_Ports
call Init_INTCON
call INIT_ESPERA
Call INIT_TEMPS
call Init_Timer
call Init_TMR0
clrf porta
clrf oper
goto PROG
;*****************************************
;----------------PROGRAMA----------------
;*****************************************
Prog
call fantastic
;*****************************************
;-------------------RUTINES-------------------
;*****************************************
INTERRUPCIO
BCF INTCON,GIE ;enabe general = 0
;----
GUARDAR ;Rutina salvar registres
movwf tem1_w ;Guarda W
swapf status,w ;Status SWAP a W (sns modifica status)
movwf tem1_s ;Guarda status (inertit)
;---- ;Rutina d'interrupcio
call INIT_TMR0
decf oper+1,f ;Comptador temps
btfss status,2
goto recuperar
Sortida
call INIT_TEMPS
comf oper,f
btfss oper,3
goto In0
bsf porta,3
goto recuperar
In0
bcf porta,3
;----
Recuperar ;Rutina recuperacio reg.
swapf tem1_s,w ;Invertim Temp1_S a W
movwf status ;Status recuperat
swapf tem1_w,f ;invertim el registre
swapf tem1_w,w ;tornem a invertir enviant a W
;----
bsf INTCON,GIE ;EnABLE GENERAL = 1
RETFIE ;TORNEM a posicio anterior a int
errupcio
;========================================
;Includes
__config _WDT_OFF
Include <P16F84A.INC>
Include ESPERA.asm
Include ETIQUETES.asm
Include RUTINES_INIT.asm
Include RUTINA_FANTASTIC.asm
END

Potrebbero piacerti anche