Author :
Craig
Steiner
Source :
8052.com
What
Events
Can
Trigger
Interrupts,
and
where do
they go?
We can
configure
the 8051
so that
any of
the
following
events
will
cause an
interrupt:
-
Timer
0
Overflow.
-
Timer
1
Overflow.
-
Reception/Transmission
of
Serial
Character.
-
External
Event
0.
-
External
Event
1.
In other
words,
we can
configure
the 8051
so that
when
Timer 0
Overflows
or when
a
character
is
sent/received,
the
appropriate
interrupt
handler
routines
are
called.
Obviously
we need
to be
able to
distinguish
between
various
interrupts
and
executing
different
code
depending
on what
interrupt
was
triggered.
This is
accomplished
by
jumping
to a
fixed
address
when a
given
interrupt
occurs.
Interrupt |
Flag |
Interrupt Handler Address |
External 0 |
IE0 |
0003h |
Timer 0 |
TF0 |
000Bh |
External 1 |
IE1 |
0013h |
Timer 1 |
TF1 |
001Bh |
Serial |
RI/TI |
0023h |
By
consulting
the
above
chart we
see that
whenever
Timer 0
overflows
(i.e.,
the TF0
bit is
set),
the main
program
will be
temporarily
suspended
and
control
will
jump to
000BH.
It is
assumed
that we
have
code at
address
000BH
that
handles
the
situation
of Timer
0
overflowing.