Hello,
I have been trying to get a basic interrupt to work on my MSP-EXP430FR6989 eval board. It has a red LED on port 1.0 and a pushbutton on port 1.1 and I want the LED to toggle when I push the button.
I know this is super simple but for some reason nothing I've looked at will fix the problem. It seems like the right bits are being set to enable the port 1.1 interrupts as well as global interrupts.
It must be something obvious that I just can't see or something buried in the datasheet that I haven't learned about yet. Any ideas? Thank you.
#include <msp430.h>
#include <stdint.h>
#include <driverlib.h>
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
PM5CTL0 = 0xFFFE; // Unlock I/O
GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0); // Set LED as an output
GPIO_enableInterrupt(GPIO_PORT_P1, GPIO_PIN1);
GPIO_selectInterruptEdge(GPIO_PORT_P1, GPIO_PIN1, GPIO_HIGH_TO_LOW_TRANSITION);
GPIO_clearInterrupt(GPIO_PORT_P1, GPIO_PIN1);
_BIS_SR(GIE); // Enable global interrupts
GPIO_setOutputHighOnPin(GPIO_PORT_P1, GPIO_PIN0); // Turns the LED on so I know the program made it this far
while(1);
}
// Port 1 interrupt service routine
#pragma vector = PORT1_VECTOR
__interrupt void Port_1_ISR(void)
{
GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0); // Toggle LED
GPIO_clearInterrupt(GPIO_PORT_P1, GPIO_PIN1); // Clear interrupt flag
}