K8048 TMR1 Interrupt. Using PIC16F627
I have set up code to use the timer and interrupt on overflow but the interrupt code is never called. Can anyone help please?
See code sections:
; Start of Code
ORG 0 ;Reset vector address
GOTO RESET ;goto RESET routine when boot.
ORG H'04' ;Interrupt address
BCF INTCON,GIE ;Disable interrupts
GOTO INT_CODE ;service interrupts
; This code is called from RESET …
SET_UP_TMR1 CLRF TMR1_HIGH ; Set TMR1 store to zero
CLRF TMR1_LOW ; Set TMR1 store to zero
MOVLW B’00110001’ ;set up bits to W
MOVWF T1CON ;Set TMR1 control
; Start TMR1
BCF PIR1,TMR1_INT ; Clear TMR1 interupt
BSF PIE1,TMR1_ENAB ; enable TMR1
; Set up interupt for TMR1
BSF INTCON,GIE ;Enable interrupts
RETURN
; This code should be called to deal with the interrupt …
INT_CODE MOVWF W_TEMP ;copy W to Temp Register
SWAPF STATUS,W ; swap status to be saved into W
BCF STATUS,RP0 ;change to bank 0 regardless
MOVWF STATUS_TEMP ;Save status to Bank 0 Register
; Main code for int…
; Interrupt Temp test code…
; =============================
BSF PORTB,3 ;LIGHT LED 4
; Return registers back to as they were…
SWAPF STATUS_TEMP,W ;Returns banks to orig status
MOVWF STATUS ;Move W into STATUS reg
SWAPF W_TEMP,F ;swap W_TEMP
SWAPF W_TEMP,W ;swap W_TEMP into W
BCF PIR1,TMR1_INT ; Clear TMR1 interupt
BSF INTCON,GIE ;Enable interrupts
RETFIE ;Return from interupt[code][/code]