[En-Nut-Discussion] Uart, detecting if there are characters waiting in the queue without blocking

Brett Abbott Brett.Abbott at digital-telemetry.com
Mon Mar 24 23:43:07 CET 2003


Hi

I have set up a uart FILE device.  Is there a simple method to check if 
there are incoming characters in the buffer waiting to be read?  From 
time to time I wish to see if there are characters waiting but dont wish 
to block if no characters have been received.  Perhaps there is a simple 
means to check incoming queue length?

In particular, Im prompting the user to press a key (via the uart) 
within 10 seconds in response to an event.  If I can help it, I'd rather 
not use a blocking function call.

The uart has been inititalised in the normal way.....

   NutRegisterDevice(&devUart0, 0, 0);
   uart = fopen("uart0", "r+b");
    _ioctl(_fileno(uart), UART_SETSPEED, &baud);

Any Help appreciated.
Brett

-- 
-----------------------------------------------------------------
Brett Abbott, Managing Director, Digital Telemetry Limited
Email: Brett.Abbott at digital-telemetry.com
PO Box 24 036 Manners Street, Wellington, New Zealand
Phone +64 (4) 5666-860  Mobile +64 (21) 656-144
------------------- Commercial in confidence --------------------





More information about the En-Nut-Discussion mailing list