Hi ,
I am trying to blink the LED on my custom board present on the P1.1 and my interrupt pin is P2.2 . SO my main aim is to turn on the led and keep on until the interrupt is there. Also i am manually giving P2.2 the +5V signal when i want to check for interrupt .
LED -> P1.1
Interrupt Pin -> P1.2
This code is NOT showing error .But somehow this is not working, can you please help me in this problem.
Here is my code which i have tried
#include "driverlib.h"
#include <msp430.h>
void main(void) {
WDT_A_hold(WDT_A_BASE);
PMM_unlockLPM5();
//FRCTL0 = FRCTLPW | NWAITS_1;
//CS_setExternalClockSource(XT1CLK_frequency)(CS_DCORSEL_1, CS_DCOFSEL_4);
// Configure the clock time as the interrupt should be called on the interrupt call .
// The CS ACLK is for clk and vloclk will be for vlo and by default cs clock divider will be 1
// The MCLK is for other mclk and I had done the optional thing .
CS_initClockSignal(CS_ACLK, CS_VLOCLK_SELECT, CS_CLOCK_DIVIDER_1);
CS_initClockSignal(CS_MCLK, CS_VLOCLK_SELECT, CS_CLOCK_DIVIDER_1);
// Set P1.1 as the output and P1.2 as the interrupt pin
GPIO_setAsInputPin(GPIO_PORT_P1, GPIO_PIN1);
// First disable the Interrupt and then after that enable it
GPIO_disableInterrupt(GPIO_PORT_P1, GPIO_PIN2);
// clears all the interrupt flag if there are initially there
GPIO_clearInterrupt(GPIO_PORT_P1, GPIO_PIN2);
//at what time you want to have the interrupt that means on positive edge or negative edge
GPIO_selectInterruptEdge(GPIO_PORT_P1, GPIO_PIN2, GPIO_LOW_TO_HIGH_TRANSITION);
GPIO_enableInterrupt(GPIO_PORT_P1, GPIO_PIN2); // Here the interrupt is enabled
__enable_interrupt(); // enables the interrupt
while(1)
{
}
}
// Now from here the interrupt service routine starts in which the interrupt to do task is done yet it does not toggle the led we want due to some power advice
#pragma vector = PORT1_VECTOR;
__interrupt void Port_1 (void)
{
GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN1);
GPIO_clearInterrupt(GPIO_PORT_P1, GPIO_PIN2);
// If we did not clear the interrrupt than if the power is off on the corresponding switch then also it will stay in the interrupt irrespective of the change
}