Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
learn:microprocessor:tutorials:pic32-interrupts-appendices:start [2017/12/21 18:39] – created Marthalearn:microprocessor:tutorials:pic32-interrupts-appendices:start [2022/10/04 11:38] (current) – external edit 127.0.0.1
Line 5: Line 5:
 ===== Alternate Methods for Declaring Interrupt Service Routines ===== ===== Alternate Methods for Declaring Interrupt Service Routines =====
 The following three examples of declaring a function to service a Timer 1 interrupt as an ISR are equivalent. Although method “a” is probably the simplest to write, methods “b” and “c” are provided because they may be used by other sources that the reader may encounter. The following three examples of declaring a function to service a Timer 1 interrupt as an ISR are equivalent. Although method “a” is probably the simplest to write, methods “b” and “c” are provided because they may be used by other sources that the reader may encounter.
 +\\
 +\\
 +<html>
 +<a href="/learn/microprocessor/tutorials/pmodstep-parts-layout/start" class="btn btn-success" role="button">Using Interrupts</a>
 +</html>
 +\\
 +\\
  
 <html> <html>
-<ol>+<ol start="1">
 <li>This method eliminates the requirement of a function prototype. The _ISR is a macro that is expanded by the compiler to method b below. This method saves some typing. (Section 11.3.3 of MPLAB® XC32 Compiler UG.)</li> <li>This method eliminates the requirement of a function prototype. The _ISR is a macro that is expanded by the compiler to method b below. This method saves some typing. (Section 11.3.3 of MPLAB® XC32 Compiler UG.)</li>
 </ol> </ol>
 </html> </html>
 +
 <code> <code>
 void __ISR(_TIMER_1_VECTOR, ipl2) Timer1Handler(void)  void __ISR(_TIMER_1_VECTOR, ipl2) Timer1Handler(void) 
Line 17: Line 25:
 } }
 </code> </code>
 +
 <html> <html>
 <ol start="2"> <ol start="2">
 <li>Using the attribute declaration (Section 11.3.1 XC32 Compiler UG).</li> <li>Using the attribute declaration (Section 11.3.1 XC32 Compiler UG).</li>
 </html> </html>
 +
 <code> <code>
 void __attribute__( (interrupt(ipl2),  void __attribute__( (interrupt(ipl2), 
Line 30: Line 40:
 } }
 </code> </code>
-<hmtl>+ 
 +<html>
 <ol start="3"> <ol start="3">
 <li>Using a pragma declaration (no longer recommended!). Requires the vector number to be entered numerically.</li> <li>Using a pragma declaration (no longer recommended!). Requires the vector number to be entered numerically.</li>
 </html> </html>
 +
 <code> <code>
 #pragma interrupt Timer1Handler ipl2 vector 4 #pragma interrupt Timer1Handler ipl2 vector 4