serialCount
Top  Previous  Next

inp = serialCount ( [ integer OutBuffer =0 ] )

Use this function to get the number of characters waiting in the currently open serial port.

Parameters
 
OutBuffer  
 
A boolean integer specifying whether the input or output buffer should be checked. Must be one of the following values:  
 
FALSE=0 – returns the number of characters waiting in the receive buffer.  
TRUE=0 – returns the number of characters waiting in the transmit buffer.  
Default value: FALSE  
 
Return value

The number of characters waiting in the specified buffer.  
 
Error flags
 
ERR_OK  
 
The flag set if successful.  
 
ERR_FAILED  
 
The flag set if failed.  
 
ERR_NOTFOUND  
 
No open port found.  

Remark
 
To open and configure a serial port, use serialOpen.  
 
Example
 
This set of statements counts characters in s a serial port until its receive buffer contains 5 characters, reads a string from the port and prints it in the terminal window:  
 
serialOpen (1,"19200,N,8,1")  
 
Do  
val=serialCount()  
Loop While val<5  
Print serialRead()  
serialClose()