# XModemConfig

int XModemConfig (int COMPort, double startDelay, int maximumNumOfRetries, double waitPeriod, int packetSize);

## Purpose

Sets the XModem configuration parameters for a COM port.

XModemSend and XModemReceive use the baud rate and the input/output queue sizes you specify when you call OpenComConfig. They ignore the data bits, the parity, and the stop bits settings of OpenComConfig and always use 8 bits, no parity, and one stop bit. Instead of using the timeout value you set by calling SetComTime, XModem functions use a 1-second timeout between data bytes. For transfers with a large packet size and a low baud rate, NI recommends a large delay period.

Generally, call this function before any XModem transfer function.

## 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
startDelay | double-precision | The timing for the initial connection between the two communication parties. When a LabWindows/CVI program assumes the role of receiver, startDelay sets the interval, in seconds, to send the initial negative acknowledgement (NAK) character to the sender. The receiver sends this character to inform the sender that it is ready to receive data. The character is sent each startDelay seconds for maximumNumOfRetries times. When a LabWindows/CVI program assumes the role of sender, startDelay specifies the interval, in seconds, during which the sender waits for the initial negative acknowledgment. The transmitter waits up to (startDelay × maximumNumOfRetries) seconds. The default value of startDelay is 10.0.
maximumNumOfRetries | integer | The maximum number of times the sender retries sending a packet to the receiver on the occurrence of an error. The default value of maximumNumOfRetries is 10.
waitPeriod | double-precision | The amount of time, in seconds, that the sender waits for an acknowledgment from the receiver after sending a packet. waitPeriod also specifies the amount of time, in seconds, the receiver waits for the next packet from the sender after sending out the acknowledgment of the previous packet. The default is 5.
packetSize | integer | The packet size, in bytes, to use with the XModem protocol. Data is sent over the COM port in packets that each contain packetSize bytes of data. The packet size must be less than or equal to the input and output queue sizes (whose default is 512 bytes or set with OpenComConfig). The standard XModem protocol recognizes only 128 and 1,024 as valid packet size. If you communicate with an application not written in LabWindows/CVI, use one of these sizes. The default value of packetSize is 128.

## 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.