title: Pragma and Interrupt Vector Table : TI MSP430
body: <p>My program contains few global variables , whose values are set during the interrupt service routine (USCI_A0_ISR()) execution.</p>
  
  <p>Once the execution of USCI_A0_ISR() is done , will the global variables hold the value assigned or will be set back to void/0.????</p>
  
  <pre><code>//Global variables
  int ptr = 0;
  char rxBuffer[16]; 
  int flag = -1;
  int check[2];
  
  void __set_flag(void)
  {
  
      if (strcmp(rxBuffer,"OK") == 0) flag = 0; 
      else if (strcmp(rxBuffer,"CONNECT") == 0) flag = 1;
      else if (strcmp(rxBuffer,"NO CARRIER") == 0) flag = 3;
      else if (strcmp(rxBuffer,"ERROR") == 0) flag = 4;
  
  }
  
  void __GSM_client(void)
  {
      while (flag == -1);
      if (flag == 0) check[0] = buflen(rxBuffer);
  }
  
  void main(void)
  {
      __Buffer_init();
      __low_level_init();         //WDT 
      __UART0_init();                 //UART 
  
      __bis_SR_register(GIE);       //interrupts enabled
      __delay_cycles(1000);           // wait till UART intial
  
      __GSM_client();
  
      __no_operation();             // For debugger
  }
  
  #pragma vector=USCI_A0_VECTOR
  __interrupt void USCI_A0_ISR(void)
  {
      char byte;
      while (!(UCA0IFG&amp;UCTXIFG));             
      byte=  UCA0RXBUF;
      UCA0TXBUF = byte;
      if (byte == '\r') { 
          //push_char(byte);
          ptr = 0;
          __set_flag();
          //__Buffer_init();              
      }
      else{                       
          push_char(byte);
      }
  }
  </code></pre>
  
  <p>Here is the code snippet of what I am doing. I am setting the <code>"flag"</code> based on the response obtained . When I see the register view in Code Composer Studio , the <code>"flag"</code> value is set correctly , but if try using the value of <code>"flag"</code> elsewhere the value of <code>"flag "</code> is not reflected.</p>
  
  <p>Any pointers over concepts of the interrupt service routine or when loopholes in my coding method appreciated
  Thanks in Advance
  <strong><em>AK</em></strong></p>