Part Number: MSP430FR2355
Hello, everyone:
I have some problems about interrupts. The goal of my work is to press pin2.3 and let the LED shine and then press pin 4.1 to turn off the LED.
The followings are my code to attempt to the goal. However, Debugger shows an error "#10234-D unresolved symbols remain ".
I cannot solve the problem, so hope someone can help me to resolve the problem.
The problem is that there are not many interrupts to exist in codes at the same time?
Thank you for your assistance.
#include <driverlib.h>
#define ONE_SECOND 500000
/**
* main.c
*/
void initGPIO(void);
void iniGPIO(void);
void main(void)
{
//volatile unsigned short usiButton1 = 1;
// GPIO_setAsInputPinWithPullUpResistor( GPIO_PORT_P2, GPIO_PIN3 );
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
GPIO_setAsOutputPin( GPIO_PORT_P1, GPIO_PIN0 );
GPIO_setOutputLowOnPin( GPIO_PORT_P1, GPIO_PIN0 );
PMM_unlockLPM5();
GPIO_setAsInputPinWithPullUpResistor( GPIO_PORT_P4, GPIO_PIN1 );
GPIO_setAsInputPinWithPullUpResistor( GPIO_PORT_P2, GPIO_PIN3 );
initGPIO();
iniGPIO();
__bis_SR_register( GIE );
}
void initGPIO(void){
PMM_unlockLPM5();
GPIO_setAsInputPinWithPullUpResistor( GPIO_PORT_P2, GPIO_PIN3 );
GPIO_selectInterruptEdge( GPIO_PORT_P2, GPIO_PIN3,GPIO_LOW_TO_HIGH_TRANSITION);
GPIO_clearInterrupt( GPIO_PORT_P2, GPIO_PIN3 );
GPIO_enableInterrupt(GPIO_PORT_P2, GPIO_PIN3);
}
void iniGIPO(void){
PMM_unlockLPM5();
GPIO_setAsInputPinWithPullUpResistor( GPIO_PORT_P4, GPIO_PIN1 );
GPIO_selectInterruptEdge( GPIO_PORT_P4, GPIO_PIN1,GPIO_LOW_TO_HIGH_TRANSITION);
GPIO_clearInterrupt( GPIO_PORT_P4, GPIO_PIN1 );
GPIO_enableInterrupt(GPIO_PORT_P4, GPIO_PIN1);
}
#pragma vector=PORT2_VECTOR
__interrupt void pushbutton_ISR (void)
{
switch(__even_in_range(P2IV,0*10)){
case P2IV_NONE:
__no_operation();
break;
case P2IV_P2IFG0:
__no_operation();
break;
case P2IV_P2IFG1:
__no_operation();
break;
case P2IV_P2IFG2:
__no_operation();
break;
case P2IV_P2IFG3:
while(1){ GPIO_setOutputHighOnPin(GPIO_PORT_P1,GPIO_PIN0);
_delay_cycles( ONE_SECOND );
GPIO_setOutputLowOnPin(GPIO_PORT_P1,GPIO_PIN0);
_delay_cycles( ONE_SECOND );
}
case P2IV_P2IFG4:
__no_operation();
break;
case P2IV_P2IFG5:
__no_operation();
break;
case P2IV_P2IFG6:
__no_operation();
break;
case P2IV_P2IFG7:
__no_operation();
break;
default: _never_executed();
}}
#pragma vector=PORT4_VECTOR
__interrupt void pushbutton1_ISR (void)
{
switch(__even_in_range(P4IV,0*10)){
case P4IV_NONE:
__no_operation();
break;
case P4IV_P4IFG0:
__no_operation();
break;
case P4IV_P4IFG1:
GPIO_setOutputLowOnPin(GPIO_PORT_P1,GPIO_PIN0);
break;
case P4IV_P4IFG2:
__no_operation();
break;
case P4IV_P4IFG3:
__no_operation();
break;
case P4IV_P4IFG4:
__no_operation();
break;
case P4IV_P4IFG5:
__no_operation();
break;
case P4IV_P4IFG6:
__no_operation();
break;
case P4IV_P4IFG7:
__no_operation();
break;
default: _never_executed();
}
}
