LabWindows/CVI

Content Type
Programming Language
Current manual

SetCTSMode

int SetCTSMode (int portNumber, int hardwareHandshaking);

Purpose

Sets the hardware handshaking mode.

By default, hardware handshaking is not used.

When you enable hardware handshaking, the CTS line is monitored to determine when it is safe to send characters to the receiver. Also, the RTS line is raised only when there is space in the input queue to receive additional characters. Optionally, you can tie the DTR line to the RTS line.

SetCTSMode returns an error if you have not opened the port or if you pass an invalid parameter value.

Parameters

Input
Name Type Description
portNumber int A number that indicates the COM port on which to operate.

This number maps to the COM port specified by deviceName in the call to OpenCom or OpenComConfig. The portNumber 1, for example, may not necessarily map to COM1.

(Linux) The portNumber 1, for example, may not necessarily map to /dev/ttyS0.

Valid Range: 1—1,000
hardwareHandshaking int The hardware handshaking mode for the selected port.

Use hardware handshaking to control the flow of data between the sender and receiver so that the receiver's input buffer does not overflow.

Value Defined Constant Description
0 LWRS_HWHANDSHAKE_OFF Hardware handshaking is disabled. The library ignores the CTS line, and raises the RTS and DTR lines the entire time the port is open.
1 LWRS_HWHANDSHAKE_CTS_RTS_DTR Hardware handshaking is enabled. The library monitors the CTS line and uses the RTS and DTR lines for handshaking.
2 LWRS_HWHANDSHAKE_CTS_RTS Hardware handshaking is enabled. The library monitors the CTS line, uses the RTS for handshaking, and raises the DTR line the entire time the port is open.

Return Value

Name Type Description
returnValue int The result of this function call. This code is a negative value that specifies the type of error that occurred.

Additional Information

Library: RS-232 Library

Include file: rs232.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later

Examples

Refer to the following examples that use the SetCTSMode function:

  • rs232\commcallback.cws

    Open example
  • rs232\serial.cws

    Open example
Was this information helpful?

Previous

SetXMode

Previous

SetXMode

Log in to get a better experience

Help us improve your future ni.com experience.

What are you trying to do?

Submit