AnsweredAssumed Answered

Access variable outside interrupt

Question asked by NTan on Jun 2, 2013
Latest reply on Jun 10, 2013 by CraigG

Good Day Everyone!


     I'm using a BF537 EZ Kit Lite and Visual DSP ++ 5.0, Update 10.1. I have an UART RX interrupt which stores the data in UartRcvBuff. It is declared as char UartRcvBuf[STRINGSIZE]; in my uart.c file. However, I would like to access the value of UartRcvBuff in my main function (found in main.c). I've tried initializing it as volatile char UartRcvBuf[STRINGSIZE], but it still doesn't work.


     May I have any suggestions on how I may access a variable outside an interrupt? Below are the snippets of the code. (I've removed some code so it would be easier to understand).


===== UART.C FILE =====

char rcvbuf[STRINGSIZE];




          /* some code here */

         if (*pUartLsr & DR) {

                   UartGets(UartNum, rcvbuf);



===== MAIN.C FILE =====

int main(void)


    /* some code here */

    while(*pIMASK & 0x4000 && check < 30 ) {  //Sends A 30 times and stops when interrupt in rx pin is disabled

                   UartPutc(0, 'A');

          check ++; 



    if (rcvbuf[0] == 'B'){


          return 0;



          /*some code here*/




Thank you and any suggestion would be appreciated