Re: interrupt
I always start in this way, for any 16 and 12 family:
org 0x00000
goto start
org 0x0004
: interrupt code here:
:
:
:
iret
start: movlw asaslkñjdf
this is an example of my program, with a macro for save w reg and status before got into interrupt:
push macro
movwf WBuffer ;save w reg in Buffer
swapf WBuffer, F ;swap it
swapf STATUS,W ;get status
movwf StatBuffer ;save it
endm
;
pop macro
swapf StatBuffer,W ;restore status
movwf STATUS ; /
swapf WBuffer,W ;restore W reg
endm
;
org 0
goto Start ;skip over interrupt vector
;
org 4
;It is always a good practice to save and restore the w reg,
;and the status reg during a interrupt.
push
call ServiceInterrupts
pop
retfie
;
Start
clrf TempE
call InitPorts
call InitTimers