Menu

I'm having a problem with the interrupt possibilitys

Ralf Pagel
6 days ago
5 days ago
  • Ralf Pagel

    Ralf Pagel - 6 days ago

    Hi,

    In GCB, there are two ways to use the interrupt:

    On Interrupt:

    Jumps from the specified interrupt vector to a subroutine created by GCB and calls my interrupt handler from there.

    Disadvantage:
    This modifies some registers.

    Subroutine Interrupt:
    Jumps directly from all interrupt vectors to my interrupt handler. If I have selected the NoContextSave option, no registers are modified by GCB (neither before nor after my code in the interrupt handler).

    Some controllers automatically clear their interrupt flags when they execute the interrupt vector.

    Disadvantage:
    If multiple interrupts are enabled, I cannot determine which interrupt is currently executing the code in my interrupt handler.

    For bar metal programming, I want both: no modified registers, and I want to be able to determine which interrupt is currently being executed. Is there a way to achieve both, perhaps by manipulating an include file?

    I envision it like this:

    (pseudo code)
    (xxx represents each of the existing vectors.)

    (clr)
    if not exist "Sub Interrupt" and not exist "On Interrupt xxx Call myIntHdlr" then 
      "all interrupt vektors -> reti"
    end if 
    
    (overwrite)
    if exist "Sub Interrupt" then
      "all interrupt vectors -> rjmp Sub Interrupt"
    end if
    
    (overwrite every declared vector)
    do until (all declared vectors ready)
      if exist "On Interrupt xxx Call myIntHdlr" then 
        "xxx interrupt vector -> rjmp Sub xxx and call Sub myIntHdlr"
      else if exist "Sub Interrupt_xxx" then
        "xxx interrupt vector -> rjmp Sub Interrupt_xxx"
      end if
    loop
    

    I hope I have described that clearly.

    Cheers
    Ralf

     
  • Anobium

    Anobium - 6 days ago

    The compiler does all the control of the interrupt(s).

    You could change this behaviour by changing the source. But, it would be a huge piece of work.

    Working with the Sub Interrupt maybe your best way forward.

     
  • Ralf Pagel

    Ralf Pagel - 5 days ago

    Thanks for the quick reply.

    Ralf

     

Log in to post a comment.