• Libraries
  • Shop
  • Doc
  • Free Modbus
  • Support
  • Login
FieldTalk Modbus Slave C++ Library  Library version 2.10.0
  • Introduction
  • Chapters
  • Modules
  • Classes
    Macros | Functions
    Error Management

    Macros

    #define FTALK_SUCCESS   0
     Operation was successful. More...
     
    #define FTALK_ILLEGAL_ARGUMENT_ERROR   1
     Illegal argument error. More...
     
    #define FTALK_ILLEGAL_STATE_ERROR   2
     Illegal state error. More...
     
    #define FTALK_EVALUATION_EXPIRED   3
     Evaluation expired. More...
     
    #define FTALK_NO_DATA_TABLE_ERROR   4
     No data table configured. More...
     
    #define FTALK_ILLEGAL_SLAVE_ADDRESS   5
     Slave address 0 illegal for serial protocols. More...
     
    #define FTALK_INSUFFICIENT_BUFFER   6
     Size of response buffer insufficient. More...
     

    Functions

    const TCHAR * getBusProtocolErrorText (int errCode)
     Translates a numeric error code into a description string. More...
     

    Fatal I/O Errors

    Errors of this class signal a problem in conjunction with the I/O system.

    If errors of this class occur, the operation must be aborted and the protocol closed.

    #define FTALK_IO_ERROR_CLASS   64
     I/O error class. More...
     
    #define FTALK_IO_ERROR   65
     I/O error. More...
     
    #define FTALK_OPEN_ERR   66
     Port or socket open error. More...
     
    #define FTALK_PORT_ALREADY_OPEN   67
     Serial port already open. More...
     
    #define FTALK_TCPIP_CONNECT_ERR   68
     TCP/IP connection error. More...
     
    #define FTALK_CONNECTION_WAS_CLOSED   69
     Remote peer closed TCP/IP connection. More...
     
    #define FTALK_SOCKET_LIB_ERROR   70
     Socket library error. More...
     
    #define FTALK_PORT_ALREADY_BOUND   71
     TCP port already bound. More...
     
    #define FTALK_LISTEN_FAILED   72
     Listen failed. More...
     
    #define FTALK_FILEDES_EXCEEDED   73
     File descriptors exceeded. More...
     
    #define FTALK_PORT_NO_ACCESS   74
     No permission to access serial port or TCP port. More...
     
    #define FTALK_PORT_NOT_AVAIL   75
     TCP port not available. More...
     
    #define FTALK_LINE_BUSY_ERROR   76
     Serial line busy/noisy. More...
     

    Communication Errors

    Errors of this class indicate either communication faults or Modbus exceptions reported by the slave device.

    #define FTALK_BUS_PROTOCOL_ERROR_CLASS   128
     Fieldbus protocol error class. More...
     
    #define FTALK_CHECKSUM_ERROR   129
     Checksum error. More...
     
    #define FTALK_INVALID_FRAME_ERROR   130
     Invalid frame error. More...
     
    #define FTALK_INVALID_REPLY_ERROR   131
     Invalid reply error. More...
     
    #define FTALK_REPLY_TIMEOUT_ERROR   132
     Reply time-out. More...
     
    #define FTALK_SEND_TIMEOUT_ERROR   133
     Send time-out. More...
     
    #define FTALK_INVALID_MBAP_ID   134
     Invalid MPAB indentifer. More...
     
    #define FTALK_LINE_ERROR   135
     Serial line error. More...
     
    #define FTALK_OVERRUN_ERROR   136
     Serial buffer overrun. More...
     
    #define FTALK_MBUS_EXCEPTION_RESPONSE   160
     Modbus exception response. More...
     
    #define FTALK_MBUS_ILLEGAL_FUNCTION_RESPONSE   161
     Illegal Function exception response. More...
     
    #define FTALK_MBUS_ILLEGAL_ADDRESS_RESPONSE   162
     Illegal Data Address exception response. More...
     
    #define FTALK_MBUS_ILLEGAL_VALUE_RESPONSE   163
     Illegal Data Value exception response. More...
     
    #define FTALK_MBUS_SLAVE_FAILURE_RESPONSE   164
     Slave Device Failure exception response. More...
     
    #define FTALK_MBUS_GW_PATH_UNAVAIL_RESPONSE   170
     Gateway Path Unavailable exception response. More...
     
    #define FTALK_MBUS_GW_TARGET_FAIL_RESPONSE   171
     Gateway Target Device Failed exception response. More...
     

    Detailed Description

    This module documents all the error and return codes reported by the various library functions.

    Macro Definition Documentation

    ◆ FTALK_SUCCESS

    #define FTALK_SUCCESS   0

    Operation was successful.

    This return codes indicates no error.

    ◆ FTALK_ILLEGAL_ARGUMENT_ERROR

    #define FTALK_ILLEGAL_ARGUMENT_ERROR   1

    Illegal argument error.

    A parameter passed to the function returning this error code is invalid or out of range.

    ◆ FTALK_ILLEGAL_STATE_ERROR

    #define FTALK_ILLEGAL_STATE_ERROR   2

    Illegal state error.

    The function is called in a wrong state. This return code is returned by all functions if the protocol has not been opened succesfully yet.

    ◆ FTALK_EVALUATION_EXPIRED

    #define FTALK_EVALUATION_EXPIRED   3

    Evaluation expired.

    This version of the library is a function limited evaluation version and has now expired.

    ◆ FTALK_NO_DATA_TABLE_ERROR

    #define FTALK_NO_DATA_TABLE_ERROR   4

    No data table configured.

    The slave has been started without adding a data table. A data table must be added by either calling addDataTable or passing it as a constructor argument.

    ◆ FTALK_ILLEGAL_SLAVE_ADDRESS

    #define FTALK_ILLEGAL_SLAVE_ADDRESS   5

    Slave address 0 illegal for serial protocols.

    A slave address or unit ID of 0 is used as broadcast address for ASCII and RTU protocol and therefor illegal.

    ◆ FTALK_INSUFFICIENT_BUFFER

    #define FTALK_INSUFFICIENT_BUFFER   6

    Size of response buffer insufficient.

    The received response was larger then the buffer provided. This error only applies to function codes with a variable response length.

    ◆ FTALK_IO_ERROR_CLASS

    #define FTALK_IO_ERROR_CLASS   64

    I/O error class.

    Errors of this class signal a problem in conjunction with the I/O system.

    ◆ FTALK_IO_ERROR

    #define FTALK_IO_ERROR   65

    I/O error.

    The underlaying I/O system reported an error.

    ◆ FTALK_OPEN_ERR

    #define FTALK_OPEN_ERR   66

    Port or socket open error.

    The TCP/IP socket or the serial port could not be opened. In case of a serial port it indicates that the serial port does not exist on the system.

    ◆ FTALK_PORT_ALREADY_OPEN

    #define FTALK_PORT_ALREADY_OPEN   67

    Serial port already open.

    The serial port defined for the open operation is already opened by another application.

    ◆ FTALK_TCPIP_CONNECT_ERR

    #define FTALK_TCPIP_CONNECT_ERR   68

    TCP/IP connection error.

    Signals that the TCP/IP connection could not be established. Typically this error occurs when a host does not exist on the network or the IP address or host name is wrong. The remote host must also listen on the appropriate port.

    ◆ FTALK_CONNECTION_WAS_CLOSED

    #define FTALK_CONNECTION_WAS_CLOSED   69

    Remote peer closed TCP/IP connection.

    Signals that the TCP/IP connection was closed by the remote peer or is broken. One reason can be that the Slave Address does not match and was rejected.

    ◆ FTALK_SOCKET_LIB_ERROR

    #define FTALK_SOCKET_LIB_ERROR   70

    Socket library error.

    The TCP/IP socket library (e.g. WINSOCK) could not be loaded or the DLL is missing or not installed.

    ◆ FTALK_PORT_ALREADY_BOUND

    #define FTALK_PORT_ALREADY_BOUND   71

    TCP port already bound.

    Indicates that the specified TCP port cannot be bound. The port might already be taken by another application or hasn't been released yet by the TCP/IP stack for re-use.

    ◆ FTALK_LISTEN_FAILED

    #define FTALK_LISTEN_FAILED   72

    Listen failed.

    The listen operation on the specified TCP port failed..

    ◆ FTALK_FILEDES_EXCEEDED

    #define FTALK_FILEDES_EXCEEDED   73

    File descriptors exceeded.

    Maximum number of usable file descriptors exceeded.

    ◆ FTALK_PORT_NO_ACCESS

    #define FTALK_PORT_NO_ACCESS   74

    No permission to access serial port or TCP port.

    You don't have permission to access the serial port or TCP port. Run the program as root. If the error is related to a serial port, change the access privilege. If it is related to TCP/IP use TCP port number which is outside the IPPORT_RESERVED range.

    ◆ FTALK_PORT_NOT_AVAIL

    #define FTALK_PORT_NOT_AVAIL   75

    TCP port not available.

    The specified TCP port is not available on this machine.

    ◆ FTALK_LINE_BUSY_ERROR

    #define FTALK_LINE_BUSY_ERROR   76

    Serial line busy/noisy.

    The serial line is receiving characters or noise despite being in a state where there should be no traffic.

    ◆ FTALK_BUS_PROTOCOL_ERROR_CLASS

    #define FTALK_BUS_PROTOCOL_ERROR_CLASS   128

    Fieldbus protocol error class.

    Signals that a fieldbus protocol related error has occured. This class is the general class of errors produced by failed or interrupted data transfer functions. It is also produced when receiving invalid frames or exception responses.

    ◆ FTALK_CHECKSUM_ERROR

    #define FTALK_CHECKSUM_ERROR   129

    Checksum error.

    Signals that the checksum of a received frame is invalid. A poor data link typically causes this error.

    ◆ FTALK_INVALID_FRAME_ERROR

    #define FTALK_INVALID_FRAME_ERROR   130

    Invalid frame error.

    Signals that a received frame does not correspond either by structure or content to the specification or does not match a previously sent query frame. A poor data link typically causes this error.

    ◆ FTALK_INVALID_REPLY_ERROR

    #define FTALK_INVALID_REPLY_ERROR   131

    Invalid reply error.

    Signals that a received reply does not correspond to the specification.

    ◆ FTALK_REPLY_TIMEOUT_ERROR

    #define FTALK_REPLY_TIMEOUT_ERROR   132

    Reply time-out.

    Signals that a fieldbus data transfer timed out. This can occur if the slave device does not reply in time or does not reply at all. A wrong unit adress will also cause this error. In some occasions this exception is also produced if the characters received don't constitute a complete frame.

    ◆ FTALK_SEND_TIMEOUT_ERROR

    #define FTALK_SEND_TIMEOUT_ERROR   133

    Send time-out.

    Signals that a fieldbus data send timed out. This can only occur if the handshake lines are not properly set.

    ◆ FTALK_INVALID_MBAP_ID

    #define FTALK_INVALID_MBAP_ID   134

    Invalid MPAB indentifer.

    Either the protocol or transaction identifier in the reply is incorrect. A slave device must return the identifiers received from the master.

    ◆ FTALK_LINE_ERROR

    #define FTALK_LINE_ERROR   135

    Serial line error.

    A receive error was detected by the UART. This can be a parity error, character overrun or frame error.

    ◆ FTALK_OVERRUN_ERROR

    #define FTALK_OVERRUN_ERROR   136

    Serial buffer overrun.

    More characters have been received then expected.

    ◆ FTALK_MBUS_EXCEPTION_RESPONSE

    #define FTALK_MBUS_EXCEPTION_RESPONSE   160

    Modbus exception response.

    Signals that a Modbus exception response was received. Exception responses are sent by a slave device instead of a normal response message if it received the query message correctly but cannot handle the query. This error usually occurs if a master queried an invalid or non-existing data address or if the master used a Modbus function, which is not supported by the slave device.

    ◆ FTALK_MBUS_ILLEGAL_FUNCTION_RESPONSE

    #define FTALK_MBUS_ILLEGAL_FUNCTION_RESPONSE   161

    Illegal Function exception response.

    Signals that an Illegal Function exception response (code 01) was received. This exception response is sent by a slave device instead of a normal response message if a master sent a Modbus function, which is not supported by the slave device.

    ◆ FTALK_MBUS_ILLEGAL_ADDRESS_RESPONSE

    #define FTALK_MBUS_ILLEGAL_ADDRESS_RESPONSE   162

    Illegal Data Address exception response.

    Signals that an Illegal Data Address exception response (code 02) was received. This exception response is sent by a slave device instead of a normal response message if a master queried an invalid or non-existing data address.

    ◆ FTALK_MBUS_ILLEGAL_VALUE_RESPONSE

    #define FTALK_MBUS_ILLEGAL_VALUE_RESPONSE   163

    Illegal Data Value exception response.

    Signals that a Illegal Value exception response was (code 03) received. This exception response is sent by a slave device instead of a normal response message if a master sent a data value, which is not an allowable value for the slave device.

    ◆ FTALK_MBUS_SLAVE_FAILURE_RESPONSE

    #define FTALK_MBUS_SLAVE_FAILURE_RESPONSE   164

    Slave Device Failure exception response.

    Signals that a Slave Device Failure exception response (code 04) was received. This exception response is sent by a slave device instead of a normal response message if an unrecoverable error occured while processing the requested action. This response is also sent if the request would generate a response whose size exceeds the allowable data size.

    ◆ FTALK_MBUS_GW_PATH_UNAVAIL_RESPONSE

    #define FTALK_MBUS_GW_PATH_UNAVAIL_RESPONSE   170

    Gateway Path Unavailable exception response.

    Signals that a Gateway Path Unavailable exception response (code 0A) was received. This exception is typically sent by gateways if the gateway was unable to establish a connection with the target device.

    ◆ FTALK_MBUS_GW_TARGET_FAIL_RESPONSE

    #define FTALK_MBUS_GW_TARGET_FAIL_RESPONSE   171

    Gateway Target Device Failed exception response.

    Signals that a Gateway Target Device failed exception response (code 0B) was received. This exception is typically sent by gateways if the gateway was unable to receive a response from the target device. Usually means that the device is not present on the network.

    Function Documentation

    ◆ getBusProtocolErrorText()

    const TCHAR* getBusProtocolErrorText ( int  errCode)

    Translates a numeric error code into a description string.

    Parameters
    errCodeFieldTalk error code
    Returns
    Error text string
    • FieldTalk Modbus Slave C++ Library Library version 2.10.0
    Speak to the Experts
    Modbus Organization Member logo

    We are member of the Modbus Organization, Inc.

    Buy with Confidence
    30-day money back guarantee All our FieldTalk web sales are backed by a 30-day Money Back Guarantee.
    We Accept
    Bank VISA MasterCard PayPal
    Customer Info
    • Info & Contact
    • Customer Login
    • Terms of Service
    • Terms of Sale
    • Privacy Policy
    © 2005-2025 proconX Pty Ltd. All rights reserved. proconX and FieldTalk are trademarks of proconX Pty Ltd.
    All other trademarks and registered trademarks appearing on www.modbusdriver.com are the property of their respective owners.