RS232SetHandshake
CAPL Functions » RS232 » RS232SetHandshakeFunction Syntax
Description
Sets handshake parameters on serial port. Note: If you use hardware handshake, then the functions which change signal lines directly (RS232SetSignalLine, RS232EscapeCommFunc, RS232EscapeCommExt) may conflict with the automatic handshaking.Parameters
- port: A number between 1 and 255 identifying a serial port.
-
handshake: Sets variant of handshake to use. Allowed values:
- 0: no handshake at all
- 1: hardware handshake, use DTR
<->DSR - 2: hardware handshake, use RTS
<->CTS - 3: hardware handshake, use RTS
<->CTS, use “toggle” variant - 4: software handshake, use Xon and Xoff characters
RTS: Request-To-Send (from sender).
DSR: Data-Set-Ready (from receiver).
CTS: Clear-To-Send (from receiver). Note: Mixtures of hardware and software handshake are not supported. For sake of compatibility, it is possible to set signal lines to fixed levels with this function. Please prefer for that purpose RS232SetSignalLine. - XonLimit: Parameter for software flow control. Specifies the minimum number of bytes allowed in the input buffer before the XonChar is sent.
- XoffLimit: Parameter for software flow control. Specifies the maximum number of bytes in the input buffer before the XoffChar is sent. The maximum number of bytes allowed is calculated by subtracting this value from the size, in bytes, of the input buffer. Note: XonLimit and XoffLimit must be set properly to prevent errors, i.e. XonLimit < (input buffer size – XoffLimit) must apply.
- XonChar: Parameter for software flow control. It specifies the value of the XON character to start an operation (transmission as well as reception).
- XoffChar: Parameter for software flow control. It specifies the value of the XOFF character to suspend an operation (transmission as well as reception). Note: The transmitted data must not contain the XON and XOFF characters if software flow control is used. XON and XOFF are sent only once for each transition.
-
timeout: Timeout in milliseconds for all send and receive operations.
- -1: infinite
< 10: not allowed
Return Values
- 0: error
- The error occurs if:
- the serial port with the given number does not exist on the system
- the port has not been opened
- The error occurs if:
- 1: success