If you plan to write your own ISR, be sure to include the following lines at the top of your program files:
#include <avr/io.h> #include <avr/signal.h>
The first line allows the compiler and header files automatically determine which MCU is being used, then automatically include the proper macro definitions. For a list of applicable interrupts for a particular MCU, do the following:
include/avr from the main folder. For linux
installations, the main folder is often /usr/avr,
for WinAVR installations, the main folder is often
C:\WinAVR.
iom128.h.
SIG.
SIG_. Note that
entry 0 is missing because that is the main reset vector.
Once you have found the name of the interrupt you want to handle, define a shell ISR as follows:
SIGNAL(SIG_OVERFLOW1)
{
}
This example is a shell to handle overflow interrupts from timer 1.
Note that the macro SIGNAL automatically specifies the necessary
compiler options so that the ISR uses the special return instruction
at the end.
Copyright © 2006-02-15 by Tak Auyeung