Miscellaneous Topics
Miscellaneous Topics
Handling Unused Interrupts
While you are not required to provide interrupt vectors – or ISR’s – for every CPU interrupt, it’s
considered good programming practice to do so. To this end, the MSP430 compiler issues a
warning whenever there are “unhandled” interrupts.
The following code is an example that you can include in all your projects. Then, as you
implement an interrupt and write an ISR for it, just comment the associated #pragma line from
this file.
Handling Unused Interrupts
The MSP430 compiler issues warning whenever all interrupts are not handled
(i.e. when you don’t have a vector specified for each interrupt)
Here’s a simple example of how this might be handled:
// Example for UNUSED_HWI_ISR()
#pragma vector=ADC12_VECTOR
#pragma vector=COMP_B_VECTOR
#pragma vector=DMA_VECTOR
#pragma vector=PORT1_VECTOR
...
#pragma vector=TIMER1_A1_VECTOR
#pragma vector=TIMER2_A0_VECTOR
#pragma vector=TIMER2_A1_VECTOR
#pragma vector=UNMI_VECTOR
#pragma vector=USB_UBM_VECTOR
#pragma vector=WDT_VECTOR
__interrupt void UNUSED_HWI_ISR (void)
{
__no_operation();
}
Note: The TI code generation tools distinguish between “warnings” and “errors”. Both represent
issues found during compilation and build, but whereas a warning is issued and code
building continues … when an error is encountered, an error statement is issued and the
tools stop before creating a final executable.
5 - 28 MSP430 Workshop - Interrupts