Safely getting out of an interrupt


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Location
    Alabama,USA
    Posts
    232


    Did you find this post helpful? Yes | No

    Default Re: Safely getting out of an interrupt

    All I'm after is to transfer to a location other than where the INT occurred. I'm going to take a closer look at DT_INTs-14 and try to figure out if there are any system var that need to be dealt with. Other than that I think the only thing that is needed is to pop the stack and loose the address.

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,641


    Did you find this post helpful? Yes | No

    Default Re: Safely getting out of an interrupt

    I think the only thing that is needed is to pop the stack and loose the address
    dream on

    typical stack implementation from data sheet core14 non enhanced pic
    4.3.2 STACK
    The PIC16F627A/628A/648A family has an 8-level
    deep x 13-bit wide hardware stack (Figure 4-1). The
    stack space is not part of either program or data space
    and the Stack Pointer is not readable or writable. The
    PC is PUSHed onto the stack when a
    CALL instruction
    is executed or an interrupt causes a branch. The stack
    is POPed in the event of a
    RETURN, RETLW or a
    RETFIE
    instruction execution. PCLATH is not affected
    by a PUSH or POP operation.





    Note
    1: T
    here are no Status bits to indicate stack overflow or stack underflow conditions.2:There are no instructions/mnemonics called PUSH or POP. These are actions that occur from the execution of the
    CALL, RETURN, RETLW and RETFIE instructions, or the vectoring to an interrupt address.







    Warning I'm not a teacher

  3. #3
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Safely getting out of an interrupt

    A safer approach is to simply have the interrupt set a flag and return. You main program can be a tight loop that checks flags. When to detects the flag, it GOSUBs to the new location.

  4. #4
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: Safely getting out of an interrupt

    Code:
    ;Interrupt Processor:
    ASM
    INT_LIST  macro    ; IntSource,  Label,     Type, ResetFlag? 
            INT_Handler   INT_INT,   _OK,       PBP,  yes   ;USART CS
            INT_Handler   AT1_INT,   _Fire,     PBP,  yes   ;Fires Coil
            INT_Handler   IOC_INT,   _Wipe,     PBP,  yes   ;Fires Output
            INT_Handler   RX_INT,    _Grab,     PBP,  yes   ;USART Transmission Received
            INT_Handler   T1G_INT,   _Get_RPM,  PBP,  yes   ;Count Pulses to Determine RPM
            INT_Handler   TMR3_INT,  _Stall,    PBP,  yes   ;RPM Below Limits of TMR1
        endm
        INT_CREATE                      ;Creates the interrupt processor
    ENDASM
    This is a typical DT_INT Declaration. As you can see, when an external interrupt occurs the program jumps to a Label called "OK". When an Angular Timer Interrupt occurs it jumps to "Fire". Each Interrupt has a different Label the DT_INT INCLUDE will sent the PC to. An IOC INT directs the PC to "Wipe", and so forth. This may be the part you missed based on your comment,

    "All I'm after is to transfer to a location other than where the INT occurred."

Similar Threads

  1. Replies: 0
    Last Post: - 27th August 2004, 07:20

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