Return to Snippet

Revision: 1957
at November 29, 2006 07:35 by okalex


Initial Code
ISR:
; Save processor context
movwf	wSave, 0
movff	STATUS, statSave
movff	BSR, bsrSave

; Save FSR0
movff	FSR0L, fsr0lSave
movff	FSR0H, fsr0hSave

; Insert code here

End_Isr:
; Restore FSR0
movff	fsr0lSave, FSR0L
movff	fsr0hSave, FSR0H

; Restore processor context and return
movff	bsrSave, BSR
movf	wSave, w, 0
movff	statSave, STATUS
retfie	0

Initial URL


Initial Description
This code is used to save and restore the context registers of a PIC18F device before executing an interrupt service routine.  FSR0 only needs to be saved

Initial Title
PIC Interrupt Context Save and Restore

Initial Tags


Initial Language
Assembler