Interrupts - again


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107

    Default Interrupts - again

    I have been going back and forth through the various assembly-language interrupt routines for PBP, but I keep getting confused.

    I'm using 18F parts. Can anyone tell me exactly which registers I must save and restore when writing an ISR that is entirely in assembly?

    STATUS, W?
    STATUS, W, PCLATH, FSR0? More?
    Charles Linquist

  2. #2
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Charles,
    You only need to save the value of registers that your ISR may change. The datasheet for the 18F series has an example for what would be considered as a bare minimum:
    Code:
    MOVWF  W_TEMP                        ; W_TEMP is in virtual bank
    MOVFF  STATUS, STATUS_TEMP    ; STATUS_TEMP located anywhere
    MOVFF  BSR, BSR_TEMP                ; BSR_TMEP located anywhere
    ;
    ; USER ISR CODE
    ;
    MOVFF  BSR_TEMP, BSR                ; Restore BSR
    MOVF   W_TEMP, W                     ; Restore WREG
    MOVFF  STATUS_TEMP, STATUS    ; Restore STATUS
    You may also need to save the PCL related registers and any FSRs you intend to use. So...
    Can anyone tell me exactly which registers I must save and restore when writing an ISR that is entirely in assembly?
    No. Unless, of course, you posted your code. However, your question may be more appropriate on the Microchip forum vs. the PIC BASIC pro forum. You may even find your answer there with a little searching.

    Steve

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 22:14
  2. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  3. Microcode studio - PIC16F877A Interrupts
    By mcbeasleyjr in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th January 2009, 06:10
  4. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48
  5. help: TMR0 interrupts disabling PORTAchange interrupts???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th August 2008, 15:10

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts