UART interrupt routine

hi guys,

can i have some help regarding the given code below.

in the code i am capable of using the interrupt based receiving.

but i have to tell how much byte i m sending.

Now i wish whenever the data come it should go to IRQ handler

void UART0_IRQHandler(void)
{
  if(UART_GetITStatus(UART0, UART_IT_Receive) != RESET)
  {
        RxBuffer[RxCounter++] = UART0->DR;
        RxBuffer[RxCounter++] = UART0->DR;
        RxCounter==rxNum +2;
        if(rxNum == 0)
        {
         rxNum = (RxBuffer[0] * 256) + RxBuffer[1];
         while((RxCounter - 2) != rxNum)
         {
          test_num++;
          if((UART_GetFlagStatus(UART0, UART_FLAG_RxFIFOEmpty) != SET)&&(RxCounter < RxBufferSize))
            {
              RxBuffer[RxCounter++] = UART0->DR;
            }
          }
          rxNum = 0;
          test_num = 0;
        }
    }
}


Parents Reply Children
No data
More questions in this forum