Chapter 5 RS-232 Library
© National Instruments Corporation 5-3 LabWindows/CVI Standard Libraries
Using RS-485You can use all of the functions in the RS-232 Library with the National Instruments RS-485
AT-Serial board. The ComSetEscape function allows you to control the transceiver mode of
the board.
Reporting RS-232 ErrorsThe functions in the RS-232 Library return negative values when an error occurs. In addition, the
global variable rs232err is updated after each function call to the RS-232 Library. If the
function executes properly, it sets rs232err to zero. Otherwise, it sets rs232err to the same
error code that it returns. A list of the possible error conditions that can occur while using the
RS-232 Library functions are at the end of this chapter.
XModem File Transfer FunctionsWith the XModem functions, you can transfer files using a data transfer protocol. The protocol
uses a generally accepted technique for serial file transfers with error-checking. Files transfer
packets that contain data from the files plus error-checking and synchronization information.
You do not need to understand the protocol to use the functions. To transfer a file, open the com
port, use the XModemSend function on the sender side of the transfer and the
XModemReceive function on the receiver side of the transfer, and then close the com port.
The XModem functions handle all aspects of the transfer protocol.
You can treat the XModem functions as higher-level functions that perform a more precisely
defined task than the functions ComToFile and ComFromFile. Use ComToFile and
ComFromFile if you need finer control over the file operations. Remember that the Xmodem
functions calculate the check sum and retransmit when an error is detected, whereas
ComToFile and ComFromFile do not do so.
TroubleshootingEstablishing communication between two RS-232 devices can be difficult because of the many
different possible configurations. When using this library, you must know the device
requirements, such as baud rate, parity, number of data bits, and number of stop bits. Basically,
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. Refer also to the section RS-232 Cable Information later in this
chapter.