We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Ballyhoo


Posted By

okalex on 11/29/06


Tagged

Pic Picbasic Interrupt Assembly


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

hkmd


PIC Interrupt Context Save and Restore


Published in: Assembler 


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


  1. ISR:
  2. ; Save processor context
  3. movwf wSave, 0
  4. movff STATUS, statSave
  5. movff BSR, bsrSave
  6.  
  7. ; Save FSR0
  8. movff FSR0L, fsr0lSave
  9. movff FSR0H, fsr0hSave
  10.  
  11. ; Insert code here
  12.  
  13. End_Isr:
  14. ; Restore FSR0
  15. movff fsr0lSave, FSR0L
  16. movff fsr0hSave, FSR0H
  17.  
  18. ; Restore processor context and return
  19. movff bsrSave, BSR
  20. movf wSave, w, 0
  21. movff statSave, STATUS
  22. retfie 0

Report this snippet 

You need to login to post a comment.