# Troubleshooting

Establishing communication between two RS-232 devices can be difficult because of the many different possible configurations. When using the RS-232 Library, you must know the device requirements, such as baud rate, parity, number of data bits, and number of stop bits. These configurations must match between the two parties of communication.

If you encounter difficulty in establishing initial communication with the device, refer to an elementary RS-232 communications handbook for information about cable requirements and general RS-232 communication. Also refer to RS-232 Cable Information.

You must call OpenCom or OpenComConfig to open a COM port before using any of the other functions.

If the program writes data to the output queue and then immediately closes the COM port, the data in the queue might be lost if LabWindows/CVI does not have time to send the data over the port. To guarantee that all bytes are written before the port closes, monitor the length of the output queue with GetOutQLen. When the output queue length becomes zero, it is safe to close the port.

If XModemReceive fails to complete properly, verify that the input queue length is greater than or equal to the packet size. Refer to OpenComConfig and XModemConfig for more information.

If the receiver appears to lose data the sender transmits, the input queue of the receiver might be overflowing. This means that the receiver does not empty its input queue as quickly as data is coming in. You can solve this problem using handshaking, provided both devices offer the same handshaking support.

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.