/[avr-libc]/avr-libc/doc/api/interrupts.dox
ViewVC logotype

Diff of /avr-libc/doc/api/interrupts.dox

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by joerg_wunsch, Sun Oct 23 08:46:10 2005 UTC revision 1.9 by joerg_wunsch, Fri Nov 4 22:55:15 2005 UTC
# Line 25  Line 25 
25    
26  /* $Id$ */  /* $Id$ */
27    
28  /** \defgroup avr_interrupts <avr/interrupt.h> <avr/signal.h>: Interrupts and Signals  /** \defgroup avr_interrupts <avr/interrupt.h>: Interrupts
29    
30  \note This discussion of interrupts and signals was originally taken from Rich Neswold's  \note This discussion of interrupts was originally taken from Rich Neswold's
31  document. See \ref acks.  document. See \ref acks.
32    
33  <h3>Introduction to avr-libc's interrupt handling</h3>  <h3>Introduction to avr-libc's interrupt handling</h3>
# Line 51  enabled by tagging the interrupt functio Line 51  enabled by tagging the interrupt functio
51    
52  These details seem to make interrupt routines a little messy, but all these  These details seem to make interrupt routines a little messy, but all these
53  details are handled by the Interrupt API. An interrupt routine is defined with  details are handled by the Interrupt API. An interrupt routine is defined with
54  SIGNAL(). This macro register and mark  ISR(). This macro register and mark
55  the routine as an interrupt handler for the specified peripheral. The  the routine as an interrupt handler for the specified peripheral. The
56  following is an example definition of a handler for the ADC interrupt.  following is an example definition of a handler for the ADC interrupt.
57    
58  \code  \code
59  #include <avr/signal.h>  #include <avr/interrupt.h>
60    
61  SIGNAL(ADC_vect)  ISR(ADC_vect)
62  {  {
63      // user code here      // user code here
64  }  }
# Line 73  If an unexpected interrupt occurs (inter Line 73  If an unexpected interrupt occurs (inter
73  installed, which usually indicates a bug), then the default action is to reset  installed, which usually indicates a bug), then the default action is to reset
74  the device by jumping to the reset vector. You can override this by supplying  the device by jumping to the reset vector. You can override this by supplying
75  a function named \c __vector_default which should be defined with  a function named \c __vector_default which should be defined with
76  SIGNAL() as such.  ISR() as such.
77    
78  \code  \code
79  #include <avr/signal.h>  #include <avr/interrupt.h>
80    
81  SIGNAL(__vector_default)  ISR(__vector_default)
82  {  {
83      // user code here      // user code here
84  }  }
# Line 107  handler by declaring the handler the fol Line 107  handler by declaring the handler the fol
107    
108  \anchor attr_interrupt  \anchor attr_interrupt
109  \code  \code
110  void SIG_XXX(void) __attribute__((interrupt));  void XXX_vect(void) __attribute__((interrupt));
111  void SIG_XXX(void) {  void XXX_vect(void) {
112    ...    ...
113  }  }
114  \endcode  \endcode
115    
116  where \c SIG_XXX is the name of a valid interrupt vector for the MCU  where \c XXX_vect is the name of a valid interrupt vector for the MCU
117  type in question, as explained below.  type in question, as explained below.
118    
119  <h3>Chosing the vector: Interrupt vector names</h3>  <h3>Chosing the vector: Interrupt vector names</h3>
# Line 138  available for the AVR that use a similar Line 138  available for the AVR that use a similar
138  The historical naming style might become deprecated in a future  The historical naming style might become deprecated in a future
139  release, so it is not recommended for new projects.  release, so it is not recommended for new projects.
140    
141  \note The SIGNAL() macro cannot really spell-check  \note The ISR() macro cannot really spell-check
142  the argument passed to them.  Thus, by misspelling one of the names  the argument passed to them.  Thus, by misspelling one of the names
143  below in a call to SIGNAL(), a function will be created  below in a call to ISR(), a function will be created
144  that, while possibly being usable as an interrupt function, is not  that, while possibly being usable as an interrupt function, is not
145  actually wired into the interrupt vector table.  The compiler will  actually wired into the interrupt vector table.  The compiler will
146  generate a warning if it detects a suspiciously looking name of a  generate a warning if it detects a suspiciously looking name of a
147  SIGNAL() function (i.e. one that after macro replacement does not  ISR() function (i.e. one that after macro replacement does not
148  start with "__vector_").  start with "__vector_").
149    
150  */  */

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26