Page 1 of 1

Interrupt for check if smth come with UART

Posted: Mon Oct 10, 2011 6:18 am
by Ivan Denisov
I need non blocking UART read function in my program.

In the examples to lpc2103 educational board form Embedded Artists was the exaple in C. How to realise this in Astrobe?

How to set up an interrupt for UART buffer to run procedure if smth new comes?

Code: Select all

tU8
uart0GetChar(tU8 *pRxChar)
{
  tU32 tmpTail;

  /* buffer is empty */
  if(uart0RxHead == uart0RxTail)
    return FALSE;

  tmpTail     = (uart0RxTail + 1) & RX_BUFFER_MASK;
  uart0RxTail = tmpTail; 

  *pRxChar = uart0RxBuf[tmpTail];
  return TRUE;
}

Re: Interrupt for check if smth come with UART

Posted: Mon Oct 10, 2011 7:25 am
by cfbsoftware
I don't know whether it answers your specific question but there is a sample of interrupt driven UART code in the topic "Buffered UART Routines":

viewtopic.php?f=2&t=74