
13
ATmega8515(L)
2512A–AVR–04/02
When using the SEI instruction to enableinterrupts, theinstruction following SEI will be
executedbeforeanypending interrupts, asshowninthis example.
Interrupt Response Time Theinterruptexecution response for all theenabled AVR interrupts isfourclock cycles
minimum. Afterfourclock cycles theProgram Vector address for theactual interrupt
handling routine is executed. During thisfourclock cycle period, theProgram Counter is
pushed onto the Stack.TheVector is normally a jump to theinterrupt routine, and this
jump takes three clock cycles. If an interruptoccurs during execution of amulti-cycle
instruction, this instruction iscompletedbeforetheinterruptisserved. If an interrupt
occurs when the MCU is in sleep mode, theinterruptexecution responsetimeis
increasedbyfourclock cycles.This increase comes in addition to the start-up time from
the selectedsleep mode.
A return from an interrupt handling routine takesfourclock cycles. During these four
clock cycles, theProgram Counter(two bytes) ispoppedback from the Stack, the Stack
Pointer is incrementedbytwo, and the I-bit in SREG isset.
Assembly Code Example
sei
; set global interrupt enable
sleep
; enter sleep, waiting for interrupt
; note: will enter sleep before any pending
; interrupt(s)
CCode Example
_SEI();
/* set global interrupt enable */
_SLEEP();
/* enter sleep, waiting for interrupt */
/* note: will enter sleep before any pending interrupt(s) */
Commenti su questo manuale