Interrupt for check if smth come with UART

Newcomers to Astrobe and Oberon are welcome to ask any beginner-level questions here
Post Reply
Ivan Denisov
Posts: 8
Joined: Tue Sep 06, 2011 3:53 pm
Location: Russia

Interrupt for check if smth come with UART

Post by Ivan Denisov » Mon Oct 10, 2011 6:18 am

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;
}

cfbsoftware
Site Admin
Posts: 525
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: Interrupt for check if smth come with UART

Post by cfbsoftware » Mon Oct 10, 2011 7:25 am

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

Post Reply