Rabbit 2000 Getting Started - page 28
Getting Started Manual
23
4.3.2 Non-Cofunction Blocking Input Functions
These are simple functions that do not use Dynamic C costatements. If no input data are
available when called, they return immediately with appropriate status information in their
return value. Once they begin to receive characters, they do not yield to other tasks until
they complete their operation or until a character-to-character timeout period elapses.
int serXgetc ( );
Gets a single character. Always returns immediately, either with the next available input byte, or with –1
if none is available.
Parameters
None
Return Value
An integer with return character in the low byte. No characterisrepresented by a return of –1.
int serXread (void *data, int length, unsigned long tmout);
Reads a block of characters. Returns the number of bytes read from an input serial stream. The stream is
considered to be ended when all
length
bytes have been read or when the timeout period elapses wait-
ing for data to appear in the input buffer.
Parameters
data
—Destination data structure. The user must ensure data is allocated for at least length bytes.
length
—The number of bytes to read.
tmout
—The number of milliseconds to wait for receipt of each byte before timing out.
Return Value
The number of bytes read into data until timed out or until all length bytes have been read.