I'm having difficulty of breaking out of while loop through a port interrupt. When the execution point is inside this while loop, the port interrupt doesn't work any more.
So, when back and played with the first example code provided by TI and tried as below;
// Evan Wakefield // Texas Instruments Inc. // October 2016 // Built with IAR Embedded Workbench V6.50 & Code Composer Studio V6.2 //****************************************************************************** #include <msp430.h> int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer // Configure GPIO P1DIR |= BIT0; // Set P1.0 to output direction // Disable the GPIO power-on default high-impedance mode to activate // previously configured port settings PM5CTL0 &= ~LOCKLPM5; while (1) // Test P1.3 { if (P3IN & BIT0) P1OUT |= BIT0; // if P1.3 set, set P1.0 else P1OUT &= ~BIT0; // else reset } }
1. But the P3IN register value is always FF even if I press P3.0. What is going on?
2. And in the code of my project, the register value in the register viewer changes to FE. But scanning the value in the code didn't update accordingly.
3. And in the code of my project, when the execution is being done outside of this 'while loop', the '__interrupt void PORT3_ISR(void)' works just fine. What's going on?
Thank you in advance.