Lab 6a – Simple Timer Interrupt
Debug/Run
12. Launch the debugger.
13. Set a breakpoint inside the ISR.
We found it worked well to set a breakpoint on the ‘switch’ statement.
14. Run your code.
If all worked well, when the counter rolled over to zero, an interrupt should have occurred …
which should have resulted in the processor halting at a breakpoint inside the ISR.
15. If the breakpoint occurred, skip to the next step …
If you did not reach the breakpoint inside your ISR, here’s a few thing to look for:
− Is the interrupt flag bit (IFG) set?
− Is the interrupt enable bit (IE) set?
− Are interrupts enabled globally?
16. If the breakpoint occurred, then resume running again.
You should always verify that your interrupts work by taking more than ‘one’ of them. A
common cause of problems occurs when the IFG bit is not cleared. This means you take one
interrupt, but never get a second one.
In our current example, reading the TA0IV should clear the flag, so the likelihood of this
problem occurring is small, but for one reason or another, the problem occurs more often
than you might expect.
17. Did the LED toggle?
If you are executing the ISR (i.e. hitting the breakpoint) and the LED is not toggling, try single-
stepping from the point where the breakpoint occurs. Make sure your program is executing
the GPIO instruction.
A common error, in this case, is accidentally putting the “do something” code (in our case, the
GPIO toggle function) into the wrong ‘case’ statement.
MSP430 Workshop - Timers 6 - 43