Coding Interrupts
Coding Interrupts
As previously discussed, the code within your interrupt service routine will vary slightly based on
whether it handles a dedicated, single interrupt or if it handles a grouped interrupt. We will cover
both cases; starting with the easier, dedicated case.
Dedicated ISR (Interrupt Service Routine)
Memory Map
0xFFFF
Interrupt Vectors & Priorities (F5529)
The watchdog interrupt flag vector (WDTIFG) is a dedicated interrupt; therefore, your ISR code
only needs to respond to the single interrupt condition. Additionally, because it is a dedicated
interrupt, the CPU hardware automatically clears the WDTIFG bit when responding to the
interrupt and branching to your ISR.
When writing an ISR for dedicated interrupts, you code must address three items:
1. Put the ISR address into the vector table (using the vector #pragma)
2. Save/Restore the CPU context (using the __interrupt keyword)
3. Write your interrupt handler code (in other words, “Do what needs doing”)
5 - 22 MSP430 Workshop - Interrupts