Reloj digital 16f84a
;UNIVERSIDAD DEL VALLE DE GUATEMALA
;DEPARTAMENTO DE INGENIERIA MECATRONICA
;MICROCONTROLADORES APLICADOS A LA INDUSTRIA
;
;Kimberly Ma. B. Alvarez Carne 05698
;PROYECTO No. 1
;RELOJ DIGITAL
;**********************************************************************
list p=16F84A;define processor
#include ;processor specific variable definitions
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _HS_OSC
;***********************************************************************
;----------------------DECLARACION DE VARIABLES--------------------------
;***********************************************************************
UDATA 0x35 ;sirvep/declarar variables, variables inician en 0x39
w_temp res 1
status_temp res 1
cont1 res 1 ;contador para retardo
conts res 1 ;contador para segundos
BANDERAS res 1 ;bandera de ususario
UN_SEG res 1
DEC_SEG res 1 ;contadores decena y unidad de segundo.
AUX_US res 1
AUX_DS res 1 ;auxiliares decena y unidad de segundo.
UN_MIN res 1DEC_MIN res 1 ;contadores decena y unidad de segundo.
AUX_UM res 1
AUX_DM res 1 ;auxiliares decena y unidad de segundo.
UN_HORA res 1
DEC_HORA res 1 ;contadores decena y unidad de HORA.
AUX_UH res 1
AUX_H res 1
AUN_MIN res 1
ADEC_MIN res 1 ;contadores decena y unidad de segundo ALARMA
A_UM res 1
A_DM res 1 ;auxiliares decena y unidad de segundoALARMA
AUN_HORA res 1
ADEC_HORA res 1 ;contadores decena y unidad de HORA ALARMA y aux
A_UH res 1
A_H res 1
;**********************************************************************
;----------------------INICIO DE PROGRAMA------------------------------
;**********************************************************************
RESET_VECTOR CODE 0x0000 ;processor reset vector
goto start ; go to beginning of program
ISR CODE 0x0004 ; interrupt vector location
;**********************************************************************
;--------------------INICIO DE INTERRUPCION----------------------------
;**********************************************************************
Interrupt:movwf w_temp ; save off current W register contents
movf STATUS,w ; move status register into W register
movwf status_temp ; save off contents of STATUS register
;INTERRUPCION ESPECIFICA
INCF cont1,1 ;cont1 mas 1
MOVLW H'63' ;mover 99 a TMR0
MOVWF TMR0
BCF INTCON,2 ;reset t0if
BRANCHI1:
BTFSC cont1,0;es 0 LSB cont1?
GOTO ACTBI1 ;es 1, saltar
GOTO ACTBI2 ;es 0, saltar
ACTBI1:
BSF FSR,0 ;establecer el bit 0 de FSR
GOTO LSB3 ;saltar a verificacion de 3 lsb de file banderas
ACTBI2:
BCF FSR,0 ;limpiar el bit 0 de port FSR
LSB3:
BTFSC BANDERAS,0 ;es 0 lsb de banderas?
GOTO FININT ;es 1, entonces solo salir
BTFSC BANDERAS,1 ;es0, entonces ver: es bit 1 banderas 0?
GOTO FININT ;es 1, no cumple, salir
BTFSC BANDERAS,2 ;es 0, entonces ver: es bit 2 banderas 0?
GOTO FININT ;es 1, no cumple, salir
BSF BANDERAS,0 ;es 0, setear bit 0 BANDERAS.
FININT:
movf status_temp,w ; retrieve copy of STATUS register
movwf STATUS ; restore pre-isr STATUS registercontents
swapf w_temp,f
swapf w_temp,w ; restore pre-isr W register contents
retfie ; return from interrupt
;**********************************************************************
;--------------------INICIO DE PROGRAMA PRINCIPAL----------------------
;**********************************************************************...
Regístrate para leer el documento completo.