Searching \ for 'Interrupt Save/Restore for 16Cxx (was: "external r' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ints.htm?key=interrupt
Search entire site for: 'Interrupt Save/Restore for 16Cxx (was: "external r'.

Truncated match.
PICList Thread
'Interrupt Save/Restore for 16Cxx (was: "external r'
1995\06\27@215118 by Andrew Warren

face
flavicon
face
Fernando Soares <spam_OUTFernando.Manuel.Ramos.SoaresTakeThisOuTspamUNINOVA.PT> wrote:

{Quote hidden}

This works on the 16C71/61 (if you don't care about saving/restoring
PCLATH), but it will not work on any 16Cxx parts whose general-purpose
registers aren't accessible from all pages (e.g., all the other 16Cxx
devices).  For those, save registers with:

   INTW    EQU [any register on page 0]
   INTW1   EQU SAVEW + 080H

   INTS    EQU [any register on page 0]
   INTP    EQU [any register on page 0]
   INTF    EQU [any register on page 0]

   INT_SERVICE:

       MOVWF   INTW            ;STORE W-REG IN CURRENT DATA-SEGMENT.

       MOVF    STATUS,W        ;GRAB THE STATUS REGISTER.

       BCF    STATUS,RP0       ;SWITCH TO PAGE 0.

       MOVWF   INTS            ;STORE THE STATUS REGISTER.

       MOVF    PCLATH,W        ;STORE THE PCLATH REGISTER.
       MOVWF   INTP            ;

       MOVF    FSR,W           ;STORE THE FSR.
       MOVWF   INTF            ;

At the end of your interrupt-handler, do this to restore the registers:

   INT_EXIT:

       MOVF    INTF,W         ;RESTORE THE FSR.
       MOVWF   FSR             ;

       MOVF    INTP,W         ;RESTORE THE PCLATH REGISTER.
       MOVWF   PCLATH          ;

       MOVF    INTS,W         ;RESTORE THE STATUS REGISTER,
       MOVWF   STATUS          ;

       SWAPF   INTW            ;RESTORE THE W-REGISTER.
       SWAPF   INTW,W       ;

       RETFIE                  ;RETURN AND RE-ENABLE INTERRUPTS.

-Andy

P.S.  As far as I know, Klaus Borchers was the first to publicize this
pair of routines.

--
Andrew Warren - .....fastfwdKILLspamspam@spam@ix.netcom.com
Fast Forward Engineering, Vista, California

More... (looser matching)
- Last day of these posts
- In 1995 , 1996 only
- Today
- New search...