Lab 5 – Interrupts
Add a Simple Interrupt Service Routine (ISR)
20. Add your Port 1 (P1.1) ISR to the bottom of main.c.
Here’s a simple ISR routine that you can copy/paste into your code.
//*********************************************************************
// Interrupt Service Routines
//*********************************************************************
#pragma vector= ?????
__interrupt void pushbutton_ISR (void)
{
// Toggle the LED on/off
GPIO_toggleOutputOnPin( GPIO_PORT_P1, GPIO_PIN0 );
}
Don‘t forget to fill in the ???? with your answer from question 11 from the worksheet (see
page 5-40).
21. Build your program to test for any errors.
You should have gotten the error …
This error example (from the ‘F5529) is telling us that the linker cannot fit all the
PORT1_VECTOR is defined twice.
We just created one of these vectors, where is the other one coming from?
__________________________________________________________________________
First, how did we recognize this error?
1. It says, “errors encountered during linking”. This tells us the complilation was fine, but
there was a problem in linking.
2. Next, “symbol “__TI_int47”” redefined”. Oops, too many definitions for this symbol. It also
tells us that this symbol was found in both unused_interrupts.c as well as main.c.
(OK, is says that the offensive files were .obj, but these were directly created from their
.c counterparts.
3. Finally, what’s with the name, “__TI_int47”? Go back and look at the Interrupt Vector
Location (sometimes it’s also called Interrupt Priority) in the Interrupt Vector table. You
can find this in the chapter discussion or the datasheet. Once you’ve done so, you should
see the correlation with the PORT1_VECTOR.
5 - 48 MSP430 Workshop - Interrupts