RS-232 Library Chapter 5
LabWindows/CVI Standard Libraries 5-4 © National Instruments Corporation
All functions, except the Open and Close functions, require the com port to be opened with
OpenCom or OpenComConfig.
If the program writes data to the output queue and then immediately closes the com port, the data
in the queue may be lost if it has not had time to be sent over the port. To guarantee that all bytes
were written before closing the port, monitor the length of the output queue with the
GetOutQLen function. When the output queue length becomes zero, it is safe to close the port.
If the XModemReceive function fails to complete properly, verify that the input queue length
is greater than or equal to the packet size. Refer to the functions OpenComConfig and
XModemConfig.
If the receiver appears to lose data transmitted by the sender, the input queue of the receiver may
be overflowing. This means that the input queue of the receiver is not emptied as quickly as data
is coming in. You can solve this problem using handshaking, provided both devices offer the
same handshaking support. Refer to the Handshaking section of this chapter for further
information.
If an XModem file transfer with a large packet size and a low baud rate fails, you might need to
increase the wait period. Ten seconds is sufficient for most transfers.
RS-232 Cable Information
An RS-232 cable consists of wires, or lines, that are joined with a connector at each end. The
connectors plug into the serial ports of each device to form a communications link over which
data and control signals flow. Each serial port consists of pins that are numbered and have
meaning. The PC pins are numbered and described as shown in Table 5-2.
Table 5-2. PC Cable Configuration
Pin Meaning
2 TxD—Transmit Data *
3 RxD—Receive Data
4 RTS—Request to Send *
5 CTS—Clear to Send
6 DSR—Data Set Ready
20 DTR—Data Terminal Ready *
7 Common
The items with an asterisk (*) indicate the lines that the PC drives, and all other items indicate
the lines the PC monitors.