# ComSetEscape

int ComSetEscape (int COMPort, int escapeCode);

## Purpose

Directs a COM port to carry out an extended function such as clearing or setting the RTS signal line or setting the transceiver mode for RS-485. The serial device driver defines the extended functions.

Not all device drivers support all escape codes. ComSetEscape returns Unknown System Error (-1) when the device driver does not support a particular escape code.

## Parameters

Input
Name | Type | Description
COMPort | integer | A number that indicates the COM port on which to operate. This number is paired with deviceName, which represents the COM port, during the OpenComConfig function call. Default Value: 1—COM1 Valid Range: 1—1,000
escapeCode | integer | The escape code of the extended function. Use the following values: CLRDTR—Clears the DTR (data-terminal-ready) signal. CLRRTS—Clears the RTS (request-to-send) signal. GETMAXCOM—Returns the maximum COM port identifier the system supports. This value ranges from 0x00 to 0x7F, such that 0x00 corresponds to COM1, 0x01 to COM2, 0x02 to COM3, and so on. SETDTR—Sends the DTR signal. SETRTS—Sends the RTS signal. SETXOFF—Causes the port to act as if it has received an XOFF character. SETXON—Causes the port to act as if it has received an XON character. You can use the following values only with the National Instruments RS-485 serial driver: WIRE_4—Sets the transceiver to four-wire mode. WIRE_2_ECHO—Sets the transceiver to two-wire DTR controlled with echo mode. WIRE_2_CTRL—Sets the transceiver to two-wire DTR controlled without echo. WIRE_2_AUTO—Sets the transceiver to two-wire auto TXRDY controlled mode.

## Return Value

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