Hello, i am trying to send continous data from my MSP430f2xxx uC to cmputer via UART. in the UI on computer, i have programmed in such a way, that when i receive (FFFFFFFFF)h from uC, the UI sends back a command to uC saying STOP sending data. now, on the MSP430, whenever i get any data on UART RX port, it generates an intr, and i have written the routine for that as well...
however, when i send this STOP command from UI, the prog below fails to understand the interrupt, and keeps on sending data to the computer. can anyone please tell me what could be goind wrong with the code?
/********************************************************/
#pragma vector = USCIAB1RX_VECTOR
__interrupt void USCI1RX_ISR(void)
{
Recvd_Char[Buffer_Index] = UCA1RXBUF; // Take Data from RX Buffer
if(Recvd_Char[Buffer_Index] == 'Z') // check the end of data stream from UI
{
__bic_SR_register_on_exit(LPM3_bits);
}
else
Buffer_Index++;
}
/********************************************************/
int Download_Data()
{
static int Read_Block_Cntr;
static char Read_Page_Cntr;
// static char Read_Col_Cntr;
// static char Prog_Page_Index;
Buffer_Index = 0;
__bis_SR_register(LPM3_bits + GIE); // Enter LPM3*/
RETURN:
if(Recvd_Char[0] == 'R') //check for start of data transfer command
{
__delay_cycles(10);
while (!(UC1IFG & UCA1TXIFG)); // USCI_A0 TX buffer ready?
UCA1TXBUF = 0x40;
Buffer_Index = 0;
for(Read_Block_Cntr = 0; Read_Block_Cntr <4096; Read_Block_Cntr++)
{
for(Read_Page_Cntr = 0; Read_Page_Cntr <128; Read_Page_Cntr++)
{
NAND_ReadData((Read_Block_Cntr*128)+Read_Page_Cntr, 0, NAND_PAGE_SIZE_READ);
}
}
__delay_cycles(10);
}
else
if(Recvd_Char[0] == '$') // check if end of data sent by UI
{
ShutDown(); // if yes, shutdown
}
else
goto RETURN; return (rc);
}
/********************************************************/
void NAND_ReadData(
unsigned long int a_uiPageNum,
unsigned short a_usColNum,
unsigned short a_usReadSizeByte)
{
int i;
/////////// R E A D B Y T E S ////////////
PORT4_DIR_IN; //Assign Port4 as Input
for(i=0;i< a_usReadSizeByte;i++)
{
NAND_READ_LOW; //RE# = 0; while(txbuf is ready)
while (!(UC1IFG & UCA1TXIFG));
UCA1TXBUF = P4IN; //READ DATA FROM FLASH //txbuf = P4IN;
NAND_READ_HIGH; //RE# = 1;
}
/*End of Read Bytes Routine*/
//return 0;
} /* NAND_ReadData */