Interrupts can be used to interrupt the sequential execution of
the program flow(called asynchronous processing - that is, we are
processing the interrupt events outside the regular execution of the
main program.)
Interrupt sources can be
- external events (e.g. change of signal at PORTB2).
- internal events.
Interrupts (IR):
Hardware interrupt
(e.g. timer
overflow).
Software interrupt
(which occur in response
to a command issued in
software-Exception
Handling )
doesn’t depend on global interrupt enable in processor status word
Usually it’s external interrupt(Ex : Reset).
Maskable Interrupts:
Depends on global interrupt enable in processor status word
May be :
External interrupt from external pin
Internal interrupt from peripheral
Interrupts (IR):con’t
Firstly, the AVR's global Interrupts Enable bit (I) must be set in
the MCU control register SREG.
Secondly, the individual interrupt source's enable bit must be
set. Each interrupt source has a separate interrupt enable bit in
the related peripheral's control registers, which turns on the
ISR for that interrupt.
Thirdly, The condition for the interrupt must be met - for
example, for the USART Receive Complete (USART RX)
interrupt, a character must have been received(i.e flag that
indicate interrupt raised)