Author :
Craig
Steiner
Source :
8052.com
What
Happens
When an
Interrupt
Occurs?
When an
interrupt
is
triggered,
the
following
actions
are
taken
automatically
by the
microcontroller:
-
The
current
Program
Counter
is
saved
on
the
stack,
low-byte
first.
-
Interrupts
of
the
same
and
lower
priority
are
blocked.
-
In
the
case
of
Timer
and
External
interrupts,
the
corresponding
interrupt
flag
is
cleared.
-
Program
execution
transfers
to
the
corresponding
interrupt
handler
vector
address.
-
The
Interrupt
Handler
Routine
executes.
Take special note of the third step: If the interrupt being
handled
is a
Timer or
External
interrupt,
the
microcontroller
automatically
clears
the
interrupt
flag
before
passing
control
to your
interrupt
handler
routine.
This
means it
is not
necessary
that you
clear
the bit
in your
code.