Hola
Estoy escribiendo un c=F3digo para el TIMER1 para capturar su interrupci=F3n por desbordamiento y la int no salta.
=BFQu=E9 tengo mal en este c=F3digo?
;---------------------------------- CABECERA
----------------------------------
list p=3D16f877A ; list directive to define processor #include ; processor specific variable definitions
__CONFIG _CP_OFF & _BODEN_ON & _WDT_OFF & _PWRTE_ON & _LVP_ON & _DEBUG_OFF & _CPD_OFF
;--------------------------------- VARIABLES
----------------------------------
;***** variables de almacenado de contexto en SDI w_temp equ 0x70 status_temp equ 0x71 pclath_temp equ 0x72
;--------------------------- DIRECCIONES DE INICIO
----------------------------
org 0x00 goto Inicio
org 0x04 goto SDI
;----------------------------------- INICIO
-----------------------------------
Inicio bcf STATUS, RP1 bsf STATUS, RP0 movlw 0x07 ; 00000111 se desactivan los... movwf CMCON ; ...comparadores anal=F3gicos bcf STATUS, RP1 bcf STATUS, RP0 bsf INTCON, GIE ; habilita todas las interrupciones bsf INTCON, PEIE ; permite el contr=F3l de interrupciones PIE1 bsf PIE1, TMR1IE ; habilita la interrupci=F3n por TMR1 bcf T1CON,TMR1ON ; apaga el timer bcf T1CON, T1CKPS1 bcf T1CON, T1CKPS0 movlw 0xE7 movwf TMR1H movlw 0x96 movwf TMR1L bsf T1CON,TMR1ON ; enciende el timer goto Dormir
;------------------------- SERVICIO DE INTERRUPCIONES
-------------------------
SDI movwf w_temp ;Copy W to TEMP register swapf STATUS,W ;Swap status to be saved into W clrf STATUS ;bank 0, regardless of current bank, Clears IRP,RP1,RP0 movwf status_temp ;Save status to bank zero STATUS_TEMP register movf PCLATH, W ;Only required if using pages 1, 2 and/or 3 movf pclath_temp ;Save PCLATH into W clrf PCLATH ;Page zero, regardless of current page ;------------------------------------------------------------------
; c=F3digo de SDI btfss PIR1, TMR1IF ; es timer1? goto SDI_FIN ; no, abandona el SDI
bcf PIR1, TMR1IF ; si, borra la bandera
decfsz cntTMR1 ; lleg=F3 a cero? goto SDI_Cont ; no, contin=FAa movlw 0xFF ; si, reinicia el contador movwf cntTMR1
SDI_Cont bcf T1CON, TMR1ON ; apaga el timer1 bsf INTCON, GIE movlw 0xFF movwf TMR1L ; carga el byte bajo de timer1 movlw 0xFF movwf TMR1H ; carga el byte alto de timer1 bsf T1CON, T1OSCEN ; activa el oscilador bsf PIR1, TMR1IE ; activa la interrupci=F3n bsf T1CON, TMR1ON ; enciende el timer1
SDI_FIN ;-----------------------------------------------------------------=
- movf pclath_temp, W ;Restore PCLATH movwf PCLATH ;Move W into PCLATH swapf status_temp, W ;Swap STATUS_TEMP register into W ;(sets bank to original state) movwf STATUS ;Move W into STATUS register swapf w_temp, F ;Swap W_TEMP swapf w_temp, W ;Swap W_TEMP into W retfie
;----------------------------------- DORMIR
-----------------------------------
Dormir nop goto Dormir
;------------------------------------ FIN
-------------------------------------
end
;--------------------------------------------------------------------------=