XModemConfig
- Updated2023-02-21
- 3 minute(s) read
int XModemConfig (int portNumber, double startDelay, int maximumOfRetries, 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 |
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 |
startDelay | double | 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. If you pass 0 for this parameter, the function uses this default value. |
maximumOfRetries | int | 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. If you pass 0 for this parameter, the function uses this default value. |
waitPeriod | double | 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. If you pass 0 for this parameter, the function uses this default value. |
packetSize | int | 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. If you pass 0 for this parameter, the function uses this default value. |
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