clSerialRead
Top  Previous  Next

str = clSerialRead ( [ integer Timeout ])

Use this function to read a string of characters from the currently open camera-link serial device. The function will wait for the specified number of milliseconds for data in the receive buffer. In the case that data is in the receive buffer, the buffer will be read until empty.

Parameters
Timeout  
Integer specifying the maximum time to wait for data in the receive buffer, in milliseconds. If no data is in the receive buffer after the timeout has expired, a timeout error flag will be raised. If this parameter is omitted, the timeout will never occur.  
 
Return value
The string containing the data from the receive buffer.  
 
Error flags
ERR_OK  
The flag set if successful.  
ERR_FAILED  
The flag set if failed.  
ERR_NOTFOUND  
No open serial device found.  
ERR_TIMEOUT  
The timeout occurred.  
ERR_NOSPACE  
Too many characters in the receive buffer (>1024)  
 

Remark
To open and configure a serial port, use clSerialOpen.  
 
Example
 
This set of statements retrieves a serial number of a Dalsa Piranha2 camera by sending a corresponding request through a camera-link serial port. Refer to Dalsa documentation for a list of available commands:  
 
clSerialOpen (0)  
clSerialWrite("get_camera_serial\n")  
wait(100)  
Print clSerialRead()  
clSerialClose()