LabWindows/CVI

Content Type
Programming Language
Current manual

RS-232 Error Codes

RS-232 Error Codes

The RS-232 Library returns status information through a global variable called rs232err. If this variable is negative after the function returns, an error occurred. Notice that many of the functions return a value in addition to setting the global variable. Usually, this value contains information about the result of the function that also can be used to detect a problem. Each function should be checked individually. The following table lists the error codeserror codes, defined constants, and error messages associated with functions in the the LabWindows/CVI RS-232 Library.

You can call ReturnRS232Err to obtain the error code, either zero or a negative value, from the most recent function call in the current thread. If the most recent call was successful but an asynchronous write operation failed, ReturnRS232Err returns the error code from the asynchronous operation. To ensure that a particular function call succeeded, use the return value from that function call. Use the GetRS232ErrorString function to convert the error code, returned by the ReturnRS232Err function, into meaningful error messages.

The rs232err global variable is the error code from the most recent function call or failed asynchronous write operation in your application, regardless of thread. In multithreaded applications, use ReturnRS232Err instead of rs232err.

Error codes are defined in the cvi\include\rs232.h file.

Note   Errors above 200 occur only on XModem function calls. The RS-232 Library records errors 261 through 265 when the maximum number of retries has been exhausted in trying to receive an XModem function packet.

For error code -1 (UnknownSystemError), call the GetRS232ErrorString function to obtain a specific Windows message string.
Code Defined Constant Error Message
-1 kRS_UnknownSysError Unknown system error.
-2 kRS_InvalidPortNum Invalid port number.
-3 kRS_PortNotOpen Port is not open.
-4 kRS_UnknownIOError Unknown I/O error.
-5 kRS_InternalError Unexpected internal error.
-6 kRS_NoPortFound No serial port found.
-7 kRS_CanNotOpenPort Cannot open port.
-8 kRS_NullPointerPassed A NULL pointer was passed when a non-NULL pointer was expected.
-11 kRS_OutOfMemory Out of memory.
-12 kRS_OutOfSystemResources Unable to allocate system resources.
-13 kRS_InvalidParameter Invalid parameter.
-14 kRS_InvalidBaudRate Invalid baud rate.
-24 kRS_InvalidParity Invalid parity.
-34 kRS_InvalidDataBits Invalid number of data bits.
-44 kRS_InvalidStopBits Invalid number of stop bits.
-90 kRS_BadFileHandle Bad file handle.
-91 kRS_FileIOError File I/O error.
-94 kRS_InvalidCount Invalid count; must be greater than or equal to 0.
-97 kRS_InvalidIntLevel Invalid interrupt level.
-99 kRS_IOTimeOut I/O operation timed out.
-104 kRS_InvalidBreakTime Break time must be a positive value.
-114 kRS_InvalidInQSize Requested input queue size must be 0 or greater.
-124 kRS_InvalidOutQSize Requested output queue size must be 0 or greater.
-151 kRS_GeneralIOFailure General I/O error.
-152 kRS_InvalidBufferPointer Buffer parameter is NULL.
-180 kRS_VISALibrariesMissing A necessary run-time library could not be found or loaded.
-257 kRS_NoAckReceived Packet was sent, but no acknowledgment was received.
-258 kRS_MaxRetriesBeforeSend Packet was not sent within retry limit.
-259 kRS_MaxRetriesBeforeReceived Packet was not received within retry limit.
-260 kRS_UnexpectedEOT End of transmission character encountered when start of data character expected.
-261 kRS_CanNotReadPackNum Unable to read packet number.
-262 kRS_InconsistentPackNum Inconsistent packet number.
-263 kRS_CanNotReadPackData Unable to read packet data.
-264 kRS_CanNotReadCheckSum Unable to read checksum.
-265 kRS_CheckSumError Checksum received did not match computed checksum.
-269 kRS_PackSizeGTInQ Packet size exceeds input queue size.
-300 kRS_OpenFileError Error opening file.
-301 kRS_ReadFileError Error reading file.
-302 kRS_NoInitNegAck Did not receive initial negative acknowledgment character.
-303 kRS_NoAckAfterEOT Did not receive acknowledgment after end of transmission character was sent.
-304 kRS_WriteFileError Error writing to file.
-305 kRS_NoSOHorEOT Did not receive either a start of data or end of transmission character when expected.
-402 kRS_TransferCancelled Transfer was canceled because CAN ASCII character was received.
-503 kRS_InvalidStartDelay Invalid start delay.
-504 kRS_InvalidMaxTries Invalid maximum number of retries.
-505 kRS_InvalidWaitPeriod Invalid wait period.
-506 kRS_InvalidPacketSize Invalid packet size.
-507 kRS_CanNotReadCRC Unable to read Cyclical Redundancy Check.
-508 kRS_CRCError Cyclical Redundancy Check error.
Was this information helpful?