; ***************************************************************************
; INTERUPT POINTS
org 0x000
goto start
org 0x004 ; memory location h004
; ***************************************************************************
; Interupt Service Routine MUST RUN FROM HERE ONLY !
;
; First run the Context Save Registers - you need to create the _temp files
isr_CS
movwf W_ISR_TEMP ; copy W to temp
swapf STATUS,W ; swap status to be saved into W
clrf STATUS ; bank 0
movwf STATUS_ISR_TEMP ; save status in bank O
movf PCLATH,W ; save pclath
movwf PCLATH_ISR_TEMP
clrf PCLATH ; clear to page 0 for ISR
movf FSR,W ; save FSR
movwf FSR_ISR_TEMP
; User Code - MUST STAY WITHING ISR BOUNDARIES - DO NOT USE GOTOs OUT OF THE ISR - USE NO CALLS
isr_UC bcf STATUS,RP0 ; set bank0 - - EXAMPLE CODE
btfsc PIR1,TMR1IF ; timer1 overflow int
goto tm1over ; timer1 has overflowed
goto isr_END ; not tmr1 overflow - error - go back
tm1over bcf PIR1,TMR1IF ; reset timer1
movlw 0x80 ; preload with 80
movwf TMR1H
ETC
ETC
; CONTEXT RESTORE REGISTERS
isr_END
movf FSR_ISR_TEMP,W
movwf FSR
movf PCLATH_ISR_TEMP,W
movwf PCLATH
swapf STATUS_ISR_TEMP,W ; swap status temp to w to set org bank
movwf STATUS ; movW to status
swapf W_ISR_TEMP,F ; restore W
swapf W_ISR_TEMP,W
retfie ; return from isr
; End of ISR
;****************************************************************************