<< Previous | Next >> | |
|
int cof_serXread( void * data, int length, unsigned long tmout ); /* X is A-F */
Description
- This single-user cofunction reads
length
characters from port X (where X is A, B, C, D, E or F) or untiltmout
milliseconds transpires between characters read. It yields to other tasks for as long as the input buffer is locked or whenever the buffer becomes empty as characters are read. A timeout will never occur if no characters have been read. This function is non-reentrant.
- The functions
cof_serEread()
andcof_serFread()
may be used with the Rabbit 3000 or Rabbit 4000.Parameters
- data
- Data structure into which characters are read.
- length
- The number of characters to read into
data
.
- tmout
- Millisecond wait period to allow between characters before timing out.
Return value
- Number of characters read into
data
.Library
- RS232.LIB
Example
// echoes a block of characters
main() {
int n;
char s[16];
serAopen(19200);
loopinit();
while (1) {
loophead();
costate {
wfd n = cof_serAread(s, 15, 20);
wfd cof_serAwrite(s, n);
}
}
serAclose();
}
Dynamic C Functions | << Previous | Next >> | rabbit.com |