https://hades.mech.northwestern.edu//index.php?title=NU32v2:_Interrupts&feed=atom&action=historyNU32v2: Interrupts - Revision history2024-03-28T12:16:29ZRevision history for this page on the wikiMediaWiki 1.35.9https://hades.mech.northwestern.edu//index.php?title=NU32v2:_Interrupts&diff=23713&oldid=prevLynch at 11:26, 16 January 20162016-01-16T11:26:37Z<p></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 11:26, 16 January 2016</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>'''THIS PAGE REFERS TO A PRE-RELEASE VERSION OF THE NU32 PIC32 DEVELOPMENT BOARD. FOR INFORMATION, SAMPLE CODE, AND VIDEOS RELATED TO THE PRODUCTION VERSION (2016 AND LATER), AND TO THE CORRESPONDING BOOK "EMBEDDED COMPUTING AND MECHATRONICS WITH THE PIC32 MICROCONTROLLER," VISIT [[NU32|THE NU32 PAGE]].'''</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><br /></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>Say your PIC is attending to some mundane task when an important event occurs. For example, the user has pressed a button. We want the PIC to respond immediately. To do so, we have this event generate an ''interrupt'', or ''interrupt request'' (IRQ), which interrupts the program and sends the CPU to execute some other code, called the ''interrupt service routine'' (or ISR). Once this code has completed, the CPU returns to its original task. </div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>Say your PIC is attending to some mundane task when an important event occurs. For example, the user has pressed a button. We want the PIC to respond immediately. To do so, we have this event generate an ''interrupt'', or ''interrupt request'' (IRQ), which interrupts the program and sends the CPU to execute some other code, called the ''interrupt service routine'' (or ISR). Once this code has completed, the CPU returns to its original task. </div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
</table>Lynchhttps://hades.mech.northwestern.edu//index.php?title=NU32v2:_Interrupts&diff=20127&oldid=prevLynch: /* Sample Code */2011-02-04T01:36:54Z<p><span dir="auto"><span class="autocomment">Sample Code</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 01:36, 4 February 2011</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 65:</td>
<td colspan="2" class="diff-lineno">Line 65:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>== Sample Code ==</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>== Sample Code ==</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><br /></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>'''See pages on specific peripherals to see how to create interrupts with those peripherals (e.g., counter/timers).'''</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>Configuring the system to be able to handle multiple interrupts:</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>Configuring the system to be able to handle multiple interrupts:</div></td>
</tr>
</table>Lynchhttps://hades.mech.northwestern.edu//index.php?title=NU32v2:_Interrupts&diff=20039&oldid=prevLynch at 11:21, 31 January 20112011-01-31T11:21:06Z<p></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 11:21, 31 January 2011</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td class="diff-deletedline diff-side-deleted"><div>'''*** UNDER CONSTRUCTION ***'''</div></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td class="diff-deletedline diff-side-deleted"><br /></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>Say your PIC is attending to some mundane task when an important event occurs. For example, the user has pressed a button. We want the PIC to respond immediately. To do so, we have this event generate an ''interrupt'', or ''interrupt request'' (IRQ), which interrupts the program and sends the CPU to execute some other code, called the ''interrupt service routine'' (or ISR). Once this code has completed, the CPU returns to its original task. </div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>Say your PIC is attending to some mundane task when an important event occurs. For example, the user has pressed a button. We want the PIC to respond immediately. To do so, we have this event generate an ''interrupt'', or ''interrupt request'' (IRQ), which interrupts the program and sends the CPU to execute some other code, called the ''interrupt service routine'' (or ISR). Once this code has completed, the CPU returns to its original task. </div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
</table>Lynchhttps://hades.mech.northwestern.edu//index.php?title=NU32v2:_Interrupts&diff=20038&oldid=prevLynch: /* Library Functions */2011-01-31T11:20:13Z<p><span dir="auto"><span class="autocomment">Library Functions</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 11:20, 31 January 2011</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 52:</td>
<td colspan="2" class="diff-lineno">Line 52:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>Usually we will not directly manipulate the interrupt registers. Instead, we will use library functions, found in pic32-libs/include/peripheral, the files beginning with "int". Below are some relevant functions. In addition to these, you will need library functions for the specific peripheral to enable the appropriate interrupt bit in IECx and to set interrupt flags in IFSx. See information on the specific peripheral. </div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>Usually we will not directly manipulate the interrupt registers. Instead, we will use library functions, found in pic32-libs/include/peripheral, the files beginning with "int". Below are some relevant functions. In addition to these, you will need library functions for the specific peripheral to enable the appropriate interrupt bit in IECx and to set interrupt flags in IFSx. See information on the specific peripheral. </div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><br /></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>'''"Legacy"''' (but you are more likely to use these):</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><br /></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_3_3_lhs">⚫</a></td>
<td class="diff-addedline diff-side-added"><div><a name="movedpara_1_3_rhs"></a>* void INTEnableSystemMultiVectoredInt(void): Performs the tasks of IntEnableInterrupts() above (enables CPU for interrupts) and INTConfigureSystem(INT_SYSTEM_CONFIG_MULT_VECTOR). In pic32-libs/peripheral/int/source.</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_3_4_lhs">⚫</a></td>
<td class="diff-addedline diff-side-added"><div><a name="movedpara_1_4_rhs"></a>* mT2ClearIntFlag(): Clears the interrupt flag for Timer 2. Many similar such definitions in pic32-libs/include/peripheral/legacy/int_5xx_6xx_7xx_legacy.h.</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><br /></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>Also, in pic32-libs/include/peripheral/int.h:</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>* void INTConfigureSystem(xxx): xxx could be INT_SYSTEM_CONFIG_MULT_VECTOR (the usual case) or INT_SYSTEM_CONFIG_SINGLE_VECTOR. Sets up the interrupts to be single vector or multi-vector.</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>* void INTConfigureSystem(xxx): xxx could be INT_SYSTEM_CONFIG_MULT_VECTOR (the usual case) or INT_SYSTEM_CONFIG_SINGLE_VECTOR. Sets up the interrupts to be single vector or multi-vector.</div></td>
</tr>
<tr>
<td colspan="2" class="diff-lineno">Line 58:</td>
<td colspan="2" class="diff-lineno">Line 65:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>* void INTClearFlag(xxx): To be executed at the end of the ISR. The xxx appear to be defined in int_5xx_6xx_7xx.h, and include INT_T1 (timer 1), INT_INT0 (external interrupt 0), etc.</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>* void INTClearFlag(xxx): To be executed at the end of the ISR. The xxx appear to be defined in int_5xx_6xx_7xx.h, and include INT_T1 (timer 1), INT_INT0 (external interrupt 0), etc.</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>* void INTSetVectorPriority(xxx,yyy): xxx is the vector (e.g., INT_EXTERNAL_0_VECTOR) declared in int_5xx_6xx_7xx.h (but since it is a memory location, it is defined elsewhere, not in C) and yyy is the priority level (e.g., INT_PRIORITY_LEVEL_4 defined in int.h, or just 4).</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>* void INTSetVectorPriority(xxx,yyy): xxx is the vector (e.g., INT_EXTERNAL_0_VECTOR) declared in int_5xx_6xx_7xx.h (but since it is a memory location, it is defined elsewhere, not in C) and yyy is the priority level (e.g., INT_PRIORITY_LEVEL_4 defined in int.h, or just 4).</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td class="diff-deletedline diff-side-deleted"><br /></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td class="diff-deletedline diff-side-deleted"><div>'''Legacy'''</div></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td class="diff-deletedline diff-side-deleted"><br /></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_1_3_rhs">⚫</a></td>
<td class="diff-deletedline diff-side-deleted"><div><a name="movedpara_3_3_lhs"></a>* void INTEnableSystemMultiVectoredInt(void): Performs the tasks of IntEnableInterrupts() above (enables CPU for interrupts) and INTConfigureSystem(INT_SYSTEM_CONFIG_MULT_VECTOR). In pic32-libs/peripheral/int/source.</div></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_1_4_rhs">⚫</a></td>
<td class="diff-deletedline diff-side-deleted"><div><a name="movedpara_3_4_lhs"></a>* mT2ClearIntFlag(): Clears the interrupt flag for Timer 2. Many similar such definitions in pic32-libs/include/peripheral/legacy/int_5xx_6xx_7xx_legacy.h.</div></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>== Sample Code ==</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>== Sample Code ==</div></td>
</tr>
</table>Lynchhttps://hades.mech.northwestern.edu//index.php?title=NU32v2:_Interrupts&diff=20037&oldid=prevLynch: /* Sample Code */2011-01-31T11:16:38Z<p><span dir="auto"><span class="autocomment">Sample Code</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 11:16, 31 January 2011</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 81:</td>
<td colspan="2" class="diff-lineno">Line 81:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>Note that the vector names (like _TIMER_2_VECTOR) can be found in pic32-libs/include/proc/p32mx795f512l.h, and priority level can be written as ipl{1..7}. '''Note that this priority level must match the priority level assigned to the function/peripheral generating the interrupt.''' You can name your ISR routine whatever you want (here it is Timer2Handler). Macros for clearing different interrupt flags can be found in pic32-libs/include/peripheral/legacy/int_5xx_6xx_7xx_legacy.h.</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>Note that the vector names (like _TIMER_2_VECTOR) can be found in pic32-libs/include/proc/p32mx795f512l.h, and priority level can be written as ipl{1..7}. '''Note that this priority level must match the priority level assigned to the function/peripheral generating the interrupt.''' You can name your ISR routine whatever you want (here it is Timer2Handler). Macros for clearing different interrupt flags can be found in pic32-libs/include/peripheral/legacy/int_5xx_6xx_7xx_legacy.h.</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td class="diff-deletedline diff-side-deleted"><div><del class="diffchange diffchange-inline">Alternative</del> for clearing the same interrupt flag include</div></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div><ins class="diffchange diffchange-inline">Alternatives</ins> for clearing the same interrupt flag include</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div><pre></div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div><pre></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>IFS0bits.T2IF = 0;</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>IFS0bits.T2IF = 0;</div></td>
</tr>
</table>Lynchhttps://hades.mech.northwestern.edu//index.php?title=NU32v2:_Interrupts&diff=20036&oldid=prevLynch: /* Sample Code */2011-01-31T11:16:14Z<p><span dir="auto"><span class="autocomment">Sample Code</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 11:16, 31 January 2011</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 68:</td>
<td colspan="2" class="diff-lineno">Line 68:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>Configuring the system to be able to handle multiple interrupts:</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>Configuring the system to be able to handle multiple interrupts:</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div><pre></div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div><pre></div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td class="diff-deletedline diff-side-deleted"><div>// first your code setting up<del class="diffchange diffchange-inline"> the</del> peripherals to generate interrupts, then...</div></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>// first your code setting up peripherals to generate interrupts<ins class="diffchange diffchange-inline"> (with priorities)</ins>, then...</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>IntEnableSystemMultiVectoredInt();</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>IntEnableSystemMultiVectoredInt();</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div></pre></div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div></pre></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td class="diff-deletedline diff-side-deleted"><div>Writing <del class="diffchange diffchange-inline">your</del> ISR:</div></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>Writing <ins class="diffchange diffchange-inline">an</ins> ISR:</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div><pre></div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div><pre></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>void __ISR(_TIMER_2_VECTOR, ipl2) Timer2Handler(void){ </div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>void __ISR(_TIMER_2_VECTOR, ipl2) Timer2Handler(void){ </div></td>
</tr>
<tr>
<td colspan="2" class="diff-lineno">Line 79:</td>
<td colspan="2" class="diff-lineno">Line 79:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>}</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>}</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div></pre></div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div></pre></div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td class="diff-deletedline diff-side-deleted"><div>Note that the vector names (like _TIMER_2_VECTOR) can be found in pic32-libs/include/proc/p32mx795f512l.h, and priority level can be written as ipl{1..7}. You can name your ISR routine whatever you want (here it is Timer2Handler). Macros for clearing <del class="diffchange diffchange-inline">the</del> interrupt <del class="diffchange diffchange-inline">flag</del> can be found in pic32-libs/include/peripheral/legacy/int_5xx_6xx_7xx_legacy.h.</div></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>Note that the vector names (like _TIMER_2_VECTOR) can be found in pic32-libs/include/proc/p32mx795f512l.h, and priority level can be written as ipl{1..7}.<ins class="diffchange diffchange-inline"> '''Note that this priority level must match the priority level assigned to the function/peripheral generating the interrupt.'''</ins> You can name your ISR routine whatever you want (here it is Timer2Handler). Macros for clearing <ins class="diffchange diffchange-inline">different</ins> interrupt <ins class="diffchange diffchange-inline">flags</ins> can be found in pic32-libs/include/peripheral/legacy/int_5xx_6xx_7xx_legacy.h.</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><br /></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>Alternative for clearing the same interrupt flag include</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div><pre></div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>IFS0bits.T2IF = 0;</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div></pre></div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>(see p32mx795f512l.h) and </div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div><pre></div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>IntClearFlag(INT_T2);</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div></pre></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>== More Information ==</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>== More Information ==</div></td>
</tr>
</table>Lynchhttps://hades.mech.northwestern.edu//index.php?title=NU32v2:_Interrupts&diff=20035&oldid=prevLynch: /* Sample Code */2011-01-31T11:06:12Z<p><span dir="auto"><span class="autocomment">Sample Code</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 11:06, 31 January 2011</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 79:</td>
<td colspan="2" class="diff-lineno">Line 79:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>}</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>}</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div></pre></div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div></pre></div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td class="diff-deletedline diff-side-deleted"><div>Note that the vector names can be found in pic32-libs/include/proc/p32mx795f512l.h, and priority level can be written as ipl{1..7}. You can name your ISR routine whatever you want (here it is Timer2Handler). Macros for clearing the interrupt flag can be found in pic32-libs/include/peripheral/legacy/int_5xx_6xx_7xx_legacy.h.</div></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>Note that the vector names<ins class="diffchange diffchange-inline"> (like _TIMER_2_VECTOR)</ins> can be found in pic32-libs/include/proc/p32mx795f512l.h, and priority level can be written as ipl{1..7}. You can name your ISR routine whatever you want (here it is Timer2Handler). Macros for clearing the interrupt flag can be found in pic32-libs/include/peripheral/legacy/int_5xx_6xx_7xx_legacy.h.</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>== More Information ==</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>== More Information ==</div></td>
</tr>
</table>Lynchhttps://hades.mech.northwestern.edu//index.php?title=NU32v2:_Interrupts&diff=20034&oldid=prevLynch: /* Sample Code */2011-01-31T11:05:33Z<p><span dir="auto"><span class="autocomment">Sample Code</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 11:05, 31 January 2011</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 68:</td>
<td colspan="2" class="diff-lineno">Line 68:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>Configuring the system to be able to handle multiple interrupts:</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>Configuring the system to be able to handle multiple interrupts:</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div><pre></div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div><pre></div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td class="diff-deletedline diff-side-deleted"><div>// <del class="diffchange diffchange-inline">here</del> your code setting up the peripherals to generate interrupts<del class="diffchange diffchange-inline">; for example</del>, <del class="diffchange diffchange-inline">Timer 2</del></div></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>// <ins class="diffchange diffchange-inline">first</ins> your code setting up the peripherals to generate interrupts, <ins class="diffchange diffchange-inline">then...</ins></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>IntEnableSystemMultiVectoredInt();</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>IntEnableSystemMultiVectoredInt();</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div></pre></div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div></pre></div></td>
</tr>
<tr>
<td colspan="2" class="diff-lineno">Line 79:</td>
<td colspan="2" class="diff-lineno">Line 79:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>}</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>}</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div></pre></div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div></pre></div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td class="diff-deletedline diff-side-deleted"><div>Note that the vector names can be found in pic32-libs/include/proc/p32mx795f512l.h, and priority level can be written as ipl{1..7}. You can name your ISR routine whatever you want (here it is Timer2Handler). Macros for clearing the interrupt flag can be found in pic32-libs/include/peripheral/legacy/int_5xx_6xx_7xx_legacy.h.<del class="diffchange diffchange-inline"> </del></div></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>Note that the vector names can be found in pic32-libs/include/proc/p32mx795f512l.h, and priority level can be written as ipl{1..7}. You can name your ISR routine whatever you want (here it is Timer2Handler). Macros for clearing the interrupt flag can be found in pic32-libs/include/peripheral/legacy/int_5xx_6xx_7xx_legacy.h.</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>== More Information ==</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>== More Information ==</div></td>
</tr>
</table>Lynchhttps://hades.mech.northwestern.edu//index.php?title=NU32v2:_Interrupts&diff=20033&oldid=prevLynch at 11:05, 31 January 20112011-01-31T11:05:03Z<p></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 11:05, 31 January 2011</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 66:</td>
<td colspan="2" class="diff-lineno">Line 66:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>== Sample Code ==</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>== Sample Code ==</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>Configuring the system to be able to handle multiple interrupts:</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div><pre></div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_8_0_lhs">⚫</a></td>
<td class="diff-addedline diff-side-added"><div><a name="movedpara_1_2_rhs"></a>// here your code setting up the <ins class="diffchange diffchange-inline">peripherals</ins> to generate interrupts<ins class="diffchange diffchange-inline">; for example, Timer 2</ins></div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_12_0_lhs">⚫</a></td>
<td class="diff-addedline diff-side-added"><div><a name="movedpara_1_3_rhs"></a>IntEnableSystemMultiVectoredInt();</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div></pre></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>Writing your ISR:</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div><pre></div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div><pre></div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>void __ISR(_TIMER_2_VECTOR, ipl2) Timer2Handler(void){ </div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td class="diff-deletedline diff-side-deleted"><br /></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div> // your ISR code</div></td>
</tr>
<tr>
<td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_1_2_rhs">⚫</a></td>
<td class="diff-deletedline diff-side-deleted"><div><a name="movedpara_8_0_lhs"></a>// here your code setting up the <del class="diffchange diffchange-inline">peripheral</del> to generate interrupts</div></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div> mT2ClearIntFlag(); // clear the interrupt flag</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td class="diff-deletedline diff-side-deleted"><br /></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>}</div></td>
</tr>
<tr>
<td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_1_3_rhs">⚫</a></td>
<td class="diff-deletedline diff-side-deleted"><div><a name="movedpara_12_0_lhs"></a>IntEnableSystemMultiVectoredInt();</div></td>
<td colspan="2" class="diff-empty diff-side-added"></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div></pre></div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>Note that the vector names can be found in pic32-libs/include/proc/p32mx795f512l.h, and priority level can be written as ipl{1..7}. You can name your ISR routine whatever you want (here it is Timer2Handler). Macros for clearing the interrupt flag can be found in pic32-libs/include/peripheral/legacy/int_5xx_6xx_7xx_legacy.h. </div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>== More Information ==</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>== More Information ==</div></td>
</tr>
</table>Lynchhttps://hades.mech.northwestern.edu//index.php?title=NU32v2:_Interrupts&diff=20032&oldid=prevLynch: /* Sample Code */2011-01-31T10:58:21Z<p><span dir="auto"><span class="autocomment">Sample Code</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 10:58, 31 January 2011</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 66:</td>
<td colspan="2" class="diff-lineno">Line 66:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>== Sample Code ==</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>== Sample Code ==</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><br /></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div><pre></div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><br /></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>// here your code setting up the peripheral to generate interrupts</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><br /></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td class="diff-addedline diff-side-added"><div>IntEnableSystemMultiVectoredInt();</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><br /></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td class="diff-context diff-side-deleted"><div>== More Information ==</div></td>
<td class="diff-marker"></td>
<td class="diff-context diff-side-added"><div>== More Information ==</div></td>
</tr>
</table>Lynch