title: ISR not execute in rs484 with msp430fg6626 in receiving mode
body: <p>Why code stucked in the ISR routine in msp430fg6626 microcontroller? here i performing the rs485 communiction with this uc and SN75176A max485 ic.during this i was set the buad rate at 9600 here data was successfully sent from uc and same received at the max485 ic but in receiving time data was not received at uc from max485 ic. why this occured i will share the code of same here please check and answer me.</p>
  <p>i will share the samw code below
  code was stuck in this line -&gt;    __bis_SR_register(LPM3_bits + GIE);</p>
  <p>#include &lt;msp430.h&gt;</p>
  <p>int ReceiveData;
  int main(void)
  {</p>
  <pre><code>  WDTCTL = WDTPW | WDTHOLD;                 // Stop WDT
  
  
    CTSD16CCTL0 |= CTSD16SC;                  // Workaround for CTSD16OFFG errata
    do
    {
        CTSD16CTL &amp;= ~CTSD16OFFG;
    }
    while (CTSD16CTL&amp;CTSD16OFFG);            // End of CTSD16OFFG workaround
  
    while(BAKCTL &amp; LOCKBAK)                    // Unlock XT1 pins for operation
        BAKCTL &amp;= ~(LOCKBAK);
        UCSCTL6 &amp;= ~(XT1OFF);                     // XT1 On
        UCSCTL6 |= XCAP_3;                        // Internal load cap
  
  
    // Loop until XT1 fault flag is cleared
    do
    {
      UCSCTL7 &amp;= ~(XT2OFFG | XT1LFOFFG | DCOFFG);
                                              // Clear XT2,XT1,DCO fault flags
      SFRIFG1 &amp;= ~OFIFG;                      // Clear fault flags
    }while (SFRIFG1&amp;OFIFG);                   // Test oscillator fault flag
  
    //------------ Configuring MAX485 Control Lines ---------------//
  
    P8SEL |= BIT4;                            // Assign P8.4 to ~RE DE and...
    P8DIR  |= BIT4;                           // P8.4 -&gt; DE,-&gt; ~RE output
    P8OUT  &amp;= ~(BIT4);                           // ~RE  &amp; DE SET TO ZERO IN RECEIVING MODE
  
    P8SEL |= 0x0C;                            // Assign P8.2 to UCA0TXD and...
    P8DIR |= 0x0C;                            // P8.3 to UCA0RXD
  
    UCA1CTL1 |= UCSWRST;                      // **Put state machine in reset**
    UCA1CTL1 |= UCSSEL_1;                     // CLK = ACLK
    UCA1BR0 = 0x03;                           // 32kHz/9600=3.41 (see User's Guide)
    UCA1BR1 = 0x00;                           //
    UCA1MCTL = UCBRS_3|UCBRF_0;               // Modulation UCBRSx=3, UCBRFx=0
    UCA1CTL1 &amp;= ~UCSWRST;                     // **Initialize USCI state machine**
    UCA1IE |= UCRXIE;                         // Enable USCI_A1 RX interrupt
  
    __bis_SR_register(LPM3_bits + GIE);       // Enter LPM3, interrupts enabled***
    __no_operation();                         // For debugger
  
      while(1)
      {
          while (!(UCA1IFG&amp;UCTXIFG));             // USCI_A1 TX buffer ready?
  </code></pre>
  <p>//               UCA1TXBUF = 0x55;                  // TX -&gt; RXed character
  //               __delay_cycles (160000);</p>
  <pre><code>    }
  }
  
  // Echo back RXed character, confirm TX buffer is ready first
  #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
  #pragma vector=USCI_A1_VECTOR
  __interrupt void USCI_A1_ISR(void)
  #elif defined(__GNUC__)
  void __attribute__ ((interrupt(USCI_A1_VECTOR))) USCI_A1_ISR (void)
  #else
  #error Compiler not supported!
  #endif
  {
    switch(__even_in_range(UCA1IV,4))
    {
        case 0:break;                             // Vector 0 - no interrupt
        case 2:                                   // Vector 2 - RXIFG
          while (!(UCA1IFG&amp;UCTXIFG));             // USCI_A1 TX buffer ready?
          ReceiveData=UCA1RXBUF;
          P8OUT |= BIT4;                          // ~RE &amp; DE SET TO HIGH FOR TRANSMITTING MODE
          __delay_cycles (16000);
          UCA1TXBUF = ReceiveData;                  // TX -&gt; RXed character
          __delay_cycles (16000);
          P8OUT  |= ~(BIT4);                           // ~RE  &amp; DE SET TO ZERO IN RECEIVING MODE
          __delay_cycles (16000);
          break;
        case 4:break;                             // Vector 4 - TXIFG
        default: break;
    }
  }
  </code></pre>