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)ifnotexist"Sub Interrupt"andnotexist"On Interrupt xxx Call myIntHdlr"then"all interrupt vektors -> reti"end if(overwrite)ifexist"Sub Interrupt"then"all interrupt vectors -> rjmp Sub Interrupt"end if(overwriteeverydeclaredvector)dountil(alldeclaredvectorsready)ifexist"On Interrupt xxx Call myIntHdlr"then"xxx interrupt vector -> rjmp Sub xxx and call Sub myIntHdlr"elseifexist"Sub Interrupt_xxx"then"xxx interrupt vector -> rjmp Sub Interrupt_xxx"end ifloop
I hope I have described that clearly.
Cheers
Ralf
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.)
I hope I have described that clearly.
Cheers
Ralf
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.
Thanks for the quick reply.
Ralf