FieldTalk Modbus Master C++ Library
Library version 2.13.2
|
Modbus RTU Master Protocol class. More...
Public Types | |
enum | { SER_DATABITS_7 = 7, SER_DATABITS_8 = 8 } |
enum | { SER_STOPBITS_1 = 1, SER_STOPBITS_2 = 2 } |
enum | { SER_PARITY_NONE = 0, SER_PARITY_EVEN = 2, SER_PARITY_ODD = 1 } |
Public Member Functions | |
MbusRtuMasterProtocol () | |
Constructs a MbusRtuMasterProtocol object and initialises its data. | |
virtual int | openProtocol (const char *const portName, long baudRate, int dataBits, int stopBits, int parity) |
Opens a Modbus RTU protocol and the associated serial port with specific port parameters. More... | |
virtual void | closeProtocol () |
Closes an open protocol including any associated communication resources (com ports or sockets). | |
virtual int | isOpen () |
virtual int | enableRs485Mode (int rtsDelay) |
Enables RS485 mode. More... | |
Bit Access | |
int | readCoils (int slaveAddr, int startRef, int bitArr[], int refCnt) |
Modbus function 1, Read Coil Status/Read Coils. More... | |
int | readInputDiscretes (int slaveAddr, int startRef, int bitArr[], int refCnt) |
Modbus function 2, Read Inputs Status/Read Input Discretes. More... | |
int | writeCoil (int slaveAddr, int bitAddr, int bitVal) |
Modbus function 5, Force Single Coil/Write Coil. More... | |
int | forceMultipleCoils (int slaveAddr, int startRef, const int bitArr[], int refCnt) |
Modbus function 15 (0F Hex), Force Multiple Coils. More... | |
16-bit Access | |
Table 4:00000 (Holding Registers) and Table 3:00000 (Input Registers) | |
int | readMultipleRegisters (int slaveAddr, int startRef, short regArr[], int refCnt) |
Modbus function 3, Read Holding Registers/Read Multiple Registers. More... | |
int | readInputRegisters (int slaveAddr, int startRef, short regArr[], int refCnt) |
Modbus function 4, Read Input Registers. More... | |
int | writeSingleRegister (int slaveAddr, int regAddr, short regVal) |
Modbus function 6, Preset Single Register/Write Single Register. More... | |
int | writeMultipleRegisters (int slaveAddr, int startRef, const short regArr[], int refCnt) |
Modbus function 16 (10 Hex), Preset Multiple Registers/Write Multiple Registers. More... | |
int | maskWriteRegister (int slaveAddr, int regAddr, short andMask, short orMask) |
Modbus function 22 (16 Hex), Mask Write Register. More... | |
int | readWriteRegisters (int slaveAddr, int readRef, short readArr[], int readCnt, int writeRef, const short writeArr[], int writeCnt) |
Modbus function 23 (17 Hex), Read/Write Registers. More... | |
32-bit Access | |
Table 4:00000 (Holding Registers) and Table 3:00000 (Input Registers) | |
int | readMultipleLongInts (int slaveAddr, int startRef, int int32Arr[], int refCnt) |
Modbus function 3 for 32-bit long int data types, Read Holding Registers/Read Multiple Registers as long int data. More... | |
int | readInputLongInts (int slaveAddr, int startRef, int int32Arr[], int refCnt) |
Modbus function 4 for 32-bit long int data types, Read Input Registers as long int data. More... | |
int | writeMultipleLongInts (int slaveAddr, int startRef, const int int32Arr[], int refCnt) |
Modbus function 16 (10 Hex) for 32-bit long int data types, Preset Multiple Registers/Write Multiple Registers with long int data. More... | |
int | readMultipleFloats (int slaveAddr, int startRef, float float32Arr[], int refCnt) |
Modbus function 3 for 32-bit float data types, Read Holding Registers/Read Multiple Registers as float data. More... | |
int | readInputFloats (int slaveAddr, int startRef, float float32Arr[], int refCnt) |
Modbus function 4 for 32-bit float data types, Read Input Registers as float data. More... | |
int | writeMultipleFloats (int slaveAddr, int startRef, const float float32Arr[], int refCnt) |
Modbus function 16 (10 Hex) for 32-bit float data types, Preset Multiple Registers/Write Multiple Registers with float data. More... | |
int | readMultipleMod10000 (int slaveAddr, int startRef, int int32Arr[], int refCnt) |
Modbus function 3 for 32-bit modulo-10000 long int data types, Read Holding Registers/Read Multiple Registers as modulo-10000 long int data. More... | |
int | readInputMod10000 (int slaveAddr, int startRef, int int32Arr[], int refCnt) |
Modbus function 4 for 32-bit modulo-10000 long int data types, Read Input Registers as modulo-10000 long int data. More... | |
int | writeMultipleMod10000 (int slaveAddr, int startRef, const int int32Arr[], int refCnt) |
Modbus function 16 (10 Hex) for 32-bit modulo-10000 long int data types, Preset Multiple Registers/Write Multiple Registers with modulo-10000 long int data. More... | |
64-bit Access | |
Table 4:00000 (Holding Registers) and Table 3:00000 (Input Registers) | |
int | readHoldingRegistersI64 (int slaveAddr, int startRef, int64_t int64Arr[], int refCnt) |
Modbus function 3 for 64-bit integer data, Read Holding Registers as int64_t type. More... | |
int | readInputRegistersI64 (int slaveAddr, int startRef, int64_t int64Arr[], int refCnt) |
Modbus function 4 for 64-bit integer data, Read Holding Registers as int64_t type. More... | |
int | writeMultipleRegistersI64 (int slaveAddr, int startRef, const int64_t int64Arr[], int refCnt) |
Modbus function 16 (10 Hex) for 64-bit integer data, Write Multiple Registers as int64_t type. More... | |
int | readHoldingRegistersF64 (int slaveAddr, int startRef, double double64Arr[], int refCnt) |
Modbus function 3 for 64-bit floating point data, Read Input Registers as double type. More... | |
int | readInputRegistersF64 (int slaveAddr, int startRef, double double64Arr[], int refCnt) |
Modbus function 4 for 64-bit floating point data, Read Input Registers as double type. More... | |
int | writeMultipleRegistersF64 (int slaveAddr, int startRef, const double double64Arr[], int refCnt) |
Modbus function 16 (10 Hex) for 64-bit floating point data, Write Multiple Registers as double type. More... | |
File Record Access | |
int | readFileRecord (int slaveAddr, int refType, int fileNo, int recordNo, short recordArr[], int recordCnt) |
Modbus function 20, Read File Record. More... | |
int | readFileRecord (int slaveAddr, FileSubRequest subReqArr[], int subReqCnt) |
Modbus function 20, Read File Record. More... | |
int | writeFileRecord (int slaveAddr, int refType, int fileNo, int recordNo, const short recordArr[], int recordCnt) |
Modbus function 21, Write File Record. More... | |
int | writeFileRecord (int slaveAddr, const FileSubRequest subReqArr[], int subReqCnt) |
Modbus function 21, Write File Record. More... | |
Diagnostics | |
int | readExceptionStatus (int slaveAddr, unsigned char *statusBytePtr) |
Modbus function 7, Read Exception Status. More... | |
int | returnQueryData (int slaveAddr, const unsigned char queryArr[], unsigned char echoArr[], int len) |
Modbus function code 8, sub-function 00, Return Query Data. More... | |
int | restartCommunicationsOption (int slaveAddr, int clearEventLog) |
Modbus function code 8, sub-function 01, Restart Communications Option. More... | |
int | readDeviceIdentification (int slaveAddr, int accessType, int objId, DeviceIdObjectList *objListPtr) |
Modbus function 43 (hex 2B) subfunction 14 (hex 0E), Read Device Identification. More... | |
Custom Function Codes | |
int | customFunction (int slaveAddr, int functionCode, void *requestData, size_t requestLen, void *responseData, size_t *responseLenPtr) |
User Defined Function CodeThis method can be used to implement User Defined Function Codes. More... | |
Protocol Configuration | |
int | setTimeout (int timeOut) |
Configures time-out. More... | |
int | getTimeout () |
Returns the time-out value. More... | |
int | setPollDelay (int pollDelay) |
Configures poll delay. More... | |
int | getPollDelay () |
Returns the poll delay time. More... | |
int | setRetryCnt (int retryCnt) |
Configures the automatic retry setting. More... | |
int | getRetryCnt () |
Returns the automatic retry count. More... | |
Transmission Statistic Functions | |
long | getTotalCounter () |
Returns how often a message transfer has been executed. More... | |
void | resetTotalCounter () |
Resets total message transfer counter. | |
long | getSuccessCounter () |
Returns how often a message transfer was successful. More... | |
void | resetSuccessCounter () |
Resets successful message transfer counter. | |
Slave Configuration | |
void | configureBigEndianInts () |
Configures 32-bit int data type functions to do a word swap. More... | |
int | configureBigEndianInts (int slaveAddr) |
Enables int data type functions to do a word swap on a per slave basis. More... | |
void | configureLittleEndianInts () |
Configures 32-bit int data type functions not to do a word swap. More... | |
int | configureLittleEndianInts (int slaveAddr) |
Disables word swapping for int data type functions on a per slave basis. More... | |
void | configureIeeeFloats () |
Configures float data type functions not to do a word swap. More... | |
int | configureIeeeFloats (int slaveAddr) |
Disables float data type functions to do a word swap on a per slave basis. More... | |
void | configureSwappedFloats () |
Configures float data type functions to do a word swap. More... | |
int | configureSwappedFloats (int slaveAddr) |
Enables float data type functions to do a word swap on a per slave basis. More... | |
void | configureStandard32BitMode () |
Configures all slaves for Standard 32-bit Mode. More... | |
int | configureStandard32BitMode (int slaveAddr) |
Configures a slave for Standard 32-bit Register Mode. More... | |
void | configureEnron32BitMode () |
Configures all slaves for Daniel/ENRON 32-bit Mode. More... | |
int | configureEnron32BitMode (int slaveAddr) |
Configures all slaves for Daniel/ENRON 32-bit Mode. More... | |
void | configureCountFromOne () |
Configures the reference counting scheme to start with one for all slaves. More... | |
int | configureCountFromOne (int slaveAddr) |
Configures a slave's reference counting scheme to start with one. More... | |
void | configureCountFromZero () |
Configures the reference counting scheme to start with zero for all slaves. More... | |
int | configureCountFromZero (int slaveAddr) |
Configures a slave's reference counting scheme to start with zero. More... | |
Utility Functions | |
static const TCHAR * | getPackageVersion () |
Returns the library version number. More... | |
Modbus RTU Master Protocol class.
This class realizes the Modbus RTU master protocol. It provides functions to open and to close serial port as well as data and control functions which can be used at any time after the protocol has been opened. The data and control functions are organized into different conformance classes. For a more detailed description of the data and control functions see section Data and Control Functions for all Modbus Protocol Flavours.
It is possible to instantiate multiple instances of this class for establishing multiple connections on different serial ports (They should be executed in separate threads).
|
inherited |
|
virtual |
Opens a Modbus RTU protocol and the associated serial port with specific port parameters.
This function opens the serial port. After a port has been opened, data and control functions can be used.
portName | Serial port identifier (e.g. "COM1", "/dev/ser1" or "/dev/ttyS0") |
baudRate | The port baudRate in bps (typically 1200 - 115200, maximum value depends on UART hardware) |
dataBits | Must be SER_DATABITS_8 for RTU |
stopBits | SER_STOPBITS_1: 1 stop bit, SER_STOPBITS_2: 2 stop bits |
parity | SER_PARITY_NONE: no parity, SER_PARITY_ODD: odd parity, SER_PARITY_EVEN: even parity |
Reimplemented from MbusSerialClientBase.
References FTALK_ILLEGAL_ARGUMENT_ERROR, MbusSerialClientBase::openProtocol(), and MbusSerialClientBase::SER_DATABITS_8.
|
virtualinherited |
This simply returns the state of an internal flag whether openProtocol() has been called or not.
true | = open |
false | = closed |
Implements MbusMasterFunctions.
|
virtualinherited |
Enables RS485 mode.
In RS485 mode the RTS signal can be used to enable and disable the transmitter of a RS232/RS485 converter. The RTS signal is asserted before sending data. It is cleared after the transmit buffer has been emptied and in addition the specified delay time has elapsed. The delay time is necessary because even the transmit buffer is already empty, the UART's FIFO will still contain unsent characters.
rtsDelay | Delay time in ms (Range: 0 - 100000) which applies after the transmit buffer is empty. 0 disables this mode. |
FTALK_SUCCESS | Success |
FTALK_ILLEGAL_ARGUMENT_ERROR | Argument out of range |
FTALK_ILLEGAL_STATE_ERROR | Protocol is already open |
References FTALK_ILLEGAL_ARGUMENT_ERROR, FTALK_ILLEGAL_STATE_ERROR, FTALK_SUCCESS, and MbusSerialClientBase::isOpen().
|
inherited |
Modbus function 1, Read Coil Status/Read Coils.
Reads the contents of the discrete outputs (coils, 0:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
startRef | Start reference (Range: 1 - 65536) |
bitArr | Buffer which will contain the data read |
refCnt | Number of coils to be read (Range: 1-2000) |
|
inherited |
Modbus function 2, Read Inputs Status/Read Input Discretes.
Reads the contents of the discrete inputs (input status, 1:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
startRef | Start reference (Range: 1 - 65536) |
bitArr | Buffer which will contain the data read |
refCnt | Number of coils to be read (Range: 1-2000) |
|
inherited |
Modbus function 5, Force Single Coil/Write Coil.
Sets a single discrete output variable (coil, 0:00000 table) to either ON or OFF.
slaveAddr | Modbus address of slave device or unit identifier (Range: 0 - 255) |
bitAddr | Coil address (Range: 1 - 65536) |
bitVal | true sets, false clears discrete output variable |
References FTALK_ILLEGAL_ARGUMENT_ERROR, FTALK_INVALID_REPLY_ERROR, and FTALK_SUCCESS.
|
inherited |
Modbus function 15 (0F Hex), Force Multiple Coils.
Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 0 - 255) |
startRef | Start reference (Range: 1 - 65536) |
bitArr | Buffer which contains the data to be sent |
refCnt | Number of coils to be written (Range: 1-1968) |
References FTALK_ILLEGAL_ARGUMENT_ERROR, FTALK_INVALID_REPLY_ERROR, and FTALK_SUCCESS.
|
inherited |
Modbus function 3, Read Holding Registers/Read Multiple Registers.
Reads the contents of the output registers (holding registers, 4:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
startRef | Start register (Range: 1 - 65536) |
regArr | Buffer which will be filled with the data read |
refCnt | Number of registers to be read (Range: 1-125) |
|
inherited |
Modbus function 4, Read Input Registers.
Read the contents of the input registers (3:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
startRef | Start register (Range: 1 - 65536) |
regArr | Buffer which will be filled with the data read. |
refCnt | Number of registers to be read (Range: 1-125) |
|
inherited |
Modbus function 6, Preset Single Register/Write Single Register.
Writes a value into a single output register (holding register, 4:00000 reference).
slaveAddr | Modbus address of slave device or unit identifier (Range: 0 - 255) |
regAddr | Register address (Range: 1 - 65536) |
regVal | Data to be sent |
References FTALK_ILLEGAL_ARGUMENT_ERROR, FTALK_INVALID_REPLY_ERROR, and FTALK_SUCCESS.
|
inherited |
Modbus function 16 (10 Hex), Preset Multiple Registers/Write Multiple Registers.
Writes values into a sequence of output registers (holding registers, 4:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 0 - 255) |
startRef | Start register (Range: 1 - 65536) |
regArr | Buffer with the data to be sent. |
refCnt | Number of registers to be written (Range: 1-123) |
|
inherited |
Modbus function 22 (16 Hex), Mask Write Register.
Masks bits according to an AND & an OR mask into a single output register (holding register, 4:00000 reference). Masking is done as follows: result = (currentVal AND andMask) OR (orMask AND (NOT andMask))
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255 for serial, 0 - 255 for TCP) |
regAddr | Register address (Range: 1 - 65536) |
andMask | Mask to be applied as a logic AND to the register |
orMask | Mask to be applied as a logic OR to the register |
References FTALK_ILLEGAL_ARGUMENT_ERROR, FTALK_INVALID_REPLY_ERROR, and FTALK_SUCCESS.
|
inherited |
Modbus function 23 (17 Hex), Read/Write Registers.
Combines reading and writing of the output registers in one transaction (holding registers, 4:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255 for serial, 0 - 255 for TCP) |
readRef | Start register for reading (Range: 1 - 65536) |
readArr | Buffer which will contain the data read |
readCnt | Number of registers to be read (Range: 1-125) |
writeRef | Start register for writing (Range: 1 - 65536) |
writeArr | Buffer with data to be sent |
writeCnt | Number of registers to be written (Range: 1-121) |
References FTALK_ILLEGAL_ARGUMENT_ERROR, FTALK_INVALID_REPLY_ERROR, and FTALK_SUCCESS.
|
inherited |
Modbus function 3 for 32-bit long int data types, Read Holding Registers/Read Multiple Registers as long int data.
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000 table) into 32-bit long int values.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
startRef | Start reference (Range: 1 - 65536) |
int32Arr | Buffer which will be filled with the data read |
refCnt | Number of values to be read (Range: 1-62) |
|
inherited |
Modbus function 4 for 32-bit long int data types, Read Input Registers as long int data.
Reads the contents of pairs of consecutive input registers (3:00000 table) into 32-bit long int values.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
startRef | Start reference (Range: 1 - 65536) |
int32Arr | Buffer which will be filled with the data read |
refCnt | Number of values to be read (Range: 1-62) |
|
inherited |
Modbus function 16 (10 Hex) for 32-bit long int data types, Preset Multiple Registers/Write Multiple Registers with long int data.
Writes long int values into pairs of output registers (holding registers, 4:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 0 - 255) |
startRef | Start reference (Range: 1 - 65536) |
int32Arr | Buffer with the data to be sent |
refCnt | Number of values to be sent (Range: 1-61) |
References FTALK_ILLEGAL_ARGUMENT_ERROR.
|
inherited |
Modbus function 3 for 32-bit float data types, Read Holding Registers/Read Multiple Registers as float data.
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000 table) into float values.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
startRef | Start reference (Range: 1 - 65536) |
float32Arr | Buffer which will be filled with the data read |
refCnt | Number of values to be read (Range: 1-62) |
|
inherited |
Modbus function 4 for 32-bit float data types, Read Input Registers as float data.
Reads the contents of pairs of consecutive input registers (3:00000 table) into float values.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
startRef | Start reference (Range: 1 - 65536) |
float32Arr | Buffer which will be filled with the data read |
refCnt | Number of values to be read (Range: 1-62) |
|
inherited |
Modbus function 16 (10 Hex) for 32-bit float data types, Preset Multiple Registers/Write Multiple Registers with float data.
Writes float values into pairs of output registers (holding registers, 4:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 0 - 255) |
startRef | Start reference (Range: 1 - 65536) |
float32Arr | Buffer with the data to be sent |
refCnt | Number of values to be sent (Range: 1-61) |
References FTALK_ILLEGAL_ARGUMENT_ERROR.
|
inherited |
Modbus function 3 for 32-bit modulo-10000 long int data types, Read Holding Registers/Read Multiple Registers as modulo-10000 long int data.
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000 table) representing a modulo-10000 long int value into 32-bit int values and performs number format conversion.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
startRef | Start reference (Range: 1 - 65536) |
int32Arr | Buffer which will be filled with the data read |
refCnt | Number of M10K integers to be read (Range: 1-62) |
|
inherited |
Modbus function 4 for 32-bit modulo-10000 long int data types, Read Input Registers as modulo-10000 long int data.
Reads the contents of pairs of consecutive input registers (3:00000 table) representing a modulo-10000 long int value into 32-bit long int values and performs number format conversion.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
startRef | Start reference (Range: 1 - 65536) |
int32Arr | Buffer which will be filled with the data read |
refCnt | Number of M10K integers to be read (Range: 1-62) |
|
inherited |
Modbus function 16 (10 Hex) for 32-bit modulo-10000 long int data types, Preset Multiple Registers/Write Multiple Registers with modulo-10000 long int data.
Writes long int values into pairs of output registers (holding registers, 4:00000 table) representing a modulo-10000 long int value and performs number format conversion.
slaveAddr | Modbus address of slave device or unit identifier (Range: 0 - 255) |
startRef | Start reference (Range: 1 - 65536) |
int32Arr | Buffer with the data to be sent |
refCnt | Number of values values to be sent (Range: 1-61) |
References FTALK_ILLEGAL_ARGUMENT_ERROR.
|
inherited |
Modbus function 3 for 64-bit integer data, Read Holding Registers as int64_t type.
Reads the contents of quartets of consecutive holding registers (4:00000 table) into 64-bit integer values.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
startRef | Start reference (Range: 1 - 65536) |
int64Arr | Buffer which will be filled with the data read |
refCnt | Number of values to be read (Range: 1-31) |
|
inherited |
Modbus function 4 for 64-bit integer data, Read Holding Registers as int64_t type.
Reads the contents of quartets of consecutive input registers (3:00000 table) into 64-bit integer values.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
startRef | Start reference (Range: 1 - 65536) |
int64Arr | Buffer which will be filled with the data read |
refCnt | Number of values to be read (Range: 1-31) |
|
inherited |
Modbus function 16 (10 Hex) for 64-bit integer data, Write Multiple Registers as int64_t type.
Writes for 64-bit integer values into quartets of holding registers (4:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 0 - 255) |
startRef | Start reference (Range: 1 - 65536) |
int64Arr | Buffer with the data to be sent |
refCnt | Number of values to be sent (Range: 1-30) |
References FTALK_ILLEGAL_ARGUMENT_ERROR.
|
inherited |
Modbus function 3 for 64-bit floating point data, Read Input Registers as double type.
Reads the contents of quartets of consecutive input registers (4:00000 table) into 64-bit floating point values.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
startRef | Start reference (Range: 1 - 65536) |
double64Arr | Buffer which will be filled with the data read |
refCnt | Number of values to be read (Range: 1-31) |
|
inherited |
Modbus function 4 for 64-bit floating point data, Read Input Registers as double type.
Reads the contents of quartets of consecutive input registers (3:00000 table) into 64-bit floating point values.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
startRef | Start reference (Range: 1 - 65536) |
double64Arr | Buffer which will be filled with the data read |
refCnt | Number of values to be read (Range: 1-31) |
|
inherited |
Modbus function 16 (10 Hex) for 64-bit floating point data, Write Multiple Registers as double type.
Writes for 64-bit floating point values into quartets of holding registers (4:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 0 - 255) |
startRef | Start reference (Range: 1 - 65536) |
double64Arr | Buffer with the data to be sent |
refCnt | Number of values to be sent (Range: 1-30) |
References FTALK_ILLEGAL_ARGUMENT_ERROR.
|
inherited |
Modbus function 20, Read File Record.
Performs a file record read for a single subrequest.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
refType | Reference type (Must be specified as 6). |
fileNo | File number (Range 1-65535). 3 is the input registers file, 4 is the holding registers file. |
recordNo | Record Number (Range: 0 - 65535). The first record to read from, 0-based numbering. |
recordArr | Buffer which will be filled with the data read |
recordCnt | Number of records to read (Range 1-125) |
|
inherited |
Modbus function 20, Read File Record.
Performs a file record read for a list of subrequests.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
subReqArr | Array with list of subrequests |
subReqCnt | Number of subrequests to read (Range 1-35) |
References FTALK_ILLEGAL_ARGUMENT_ERROR, FTALK_INVALID_REPLY_ERROR, FTALK_SUCCESS, and MbusMasterFunctions::FileSubRequest::recordCnt.
|
inherited |
Modbus function 21, Write File Record.
Performs a file record write for a single subrequest.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
refType | Reference type (Must be specified as 6). |
fileNo | File number (Range 1-65535). 3 is the input registers file, 4 is the holding registers file. |
recordNo | Record Number (Range: 0 - 65535). The first record to write to, 0-based numbering. |
recordArr | Buffer with the data to be sent. |
recordCnt | Number of records to write (Range 1-122) |
|
inherited |
Modbus function 21, Write File Record.
Performs a file record write for a list of subrequests.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
subReqArr | Array with list of subrequests |
subReqCnt | Number of subrequests to write (Range 1-27) |
References FTALK_ILLEGAL_ARGUMENT_ERROR, FTALK_INVALID_REPLY_ERROR, FTALK_SUCCESS, and MbusMasterFunctions::FileSubRequest::recordCnt.
|
inherited |
Modbus function 7, Read Exception Status.
Reads the eight exception status coils within the slave device.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255 for serial, 0 - 255 for TCP) |
statusBytePtr | Slave status byte. The meaning of this status byte is slave specific and varies from device to device. |
References FTALK_ILLEGAL_ARGUMENT_ERROR, and FTALK_SUCCESS.
|
inherited |
Modbus function code 8, sub-function 00, Return Query Data.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255 for serial, 0 - 255 for TCP) |
queryArr | Buffer with data to be sent |
echoArr | Buffer which will contain the data read |
len | Number of bytes send sent and read back |
References FTALK_ILLEGAL_ARGUMENT_ERROR, FTALK_INVALID_REPLY_ERROR, and FTALK_SUCCESS.
|
inherited |
Modbus function code 8, sub-function 01, Restart Communications Option.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255 for serial, 0 - 255 for TCP) |
clearEventLog | Flag when set to one clears in addition the slave's communication even log. |
References FTALK_ILLEGAL_ARGUMENT_ERROR.
|
inherited |
Modbus function 43 (hex 2B) subfunction 14 (hex 0E), Read Device Identification.
This function allows a master to retrieve various objects with meta information about a slave device. The data type of the objects returned is a 0-terminated ASCII string.
Object Id | Object Name / Description |
0x00 | VendorName |
0x01 | ProductCode |
0x02 | MajorMinorRevision |
0x03 | VendorUrl |
0x04 | ProductName |
0x05 | ModelName |
0x06 | UserApplicationName |
0x07 - 0x7F | Reserved |
0x80 - 0xFF | Vendor specific private objects |
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255 for serial, 0 - 255 for TCP) |
accessType | Category type (1=only mandatory basic objects, 2=all regular objects, 3=include vendor specfic objects, 4=single object) |
objId | An object ID from above table |
objListPtr | A pointer to a object list container which will receive the retrieved objects. |
Example retrieving all Device ID strings of basic device identification level (level 1):
References FTALK_ILLEGAL_ARGUMENT_ERROR, FTALK_INVALID_FRAME_ERROR, FTALK_INVALID_REPLY_ERROR, and FTALK_SUCCESS.
|
inherited |
Configures time-out.
This function sets the operation or socket time-out to the specified value.
msTime | Timeout value in ms (Range: 1 - 100000) |
FTALK_SUCCESS | Success |
FTALK_ILLEGAL_ARGUMENT_ERROR | Argument out of range |
FTALK_ILLEGAL_STATE_ERROR | Protocol is already open |
References FTALK_ILLEGAL_ARGUMENT_ERROR, FTALK_ILLEGAL_STATE_ERROR, FTALK_SUCCESS, and MbusMasterFunctions::isOpen().
|
inlineinherited |
Returns the time-out value.
|
inherited |
Configures poll delay.
This function sets the delay time which applies between two consecutive Modbus read/write. A value of 0 disables the poll delay.
msTime | Delay time in ms (Range: 0 - 100000), 0 disables poll delay |
FTALK_SUCCESS | Success |
FTALK_ILLEGAL_ARGUMENT_ERROR | Argument out of range |
FTALK_ILLEGAL_STATE_ERROR | Protocol is already open |
References FTALK_ILLEGAL_ARGUMENT_ERROR, FTALK_ILLEGAL_STATE_ERROR, FTALK_SUCCESS, and MbusMasterFunctions::isOpen().
|
inlineinherited |
Returns the poll delay time.
|
inherited |
Configures the automatic retry setting.
A value of 0 disables any automatic retries.
retries | Retry count (Range: 0 - 10), 0 disables retries |
FTALK_SUCCESS | Success |
FTALK_ILLEGAL_ARGUMENT_ERROR | Argument out of range |
FTALK_ILLEGAL_STATE_ERROR | Protocol is already open |
References FTALK_ILLEGAL_ARGUMENT_ERROR, FTALK_ILLEGAL_STATE_ERROR, FTALK_SUCCESS, and MbusMasterFunctions::isOpen().
|
inlineinherited |
Returns the automatic retry count.
|
inlineinherited |
Returns how often a message transfer has been executed.
|
inlineinherited |
Returns how often a message transfer was successful.
|
inherited |
Configures 32-bit int data type functions to do a word swap.
Modbus is using little-endian word order for 32-bit values. The data transfer functions operating upon 32-bit int data types can be configured to do a word swap which enables them to read 32-bit data correctly from a big-endian slave.
|
inherited |
Enables int data type functions to do a word swap on a per slave basis.
Modbus is using little-endian word order for 32-bit values. The data transfer functions operating upon 32-bit int data types can be configured to do a word swap which enables them to read 32-bit data correctly from a big-endian machine.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
References FTALK_ILLEGAL_ARGUMENT_ERROR, and FTALK_SUCCESS.
|
inherited |
Configures 32-bit int data type functions not to do a word swap.
This is the default.
|
inherited |
Disables word swapping for int data type functions on a per slave basis.
Modbus is using little-endian word order for 32-bit values. This setting assumes that the slave also serves 32-bit data in little little-endian word order.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
References FTALK_ILLEGAL_ARGUMENT_ERROR, and FTALK_SUCCESS.
|
inherited |
Configures float data type functions not to do a word swap.
This is the default.
|
inherited |
Disables float data type functions to do a word swap on a per slave basis.
Modbus is using little-endian word order for 32-bit values. This setting assumes that the slave also serves 32-bit floats in little little-endian word order which is the most common case.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
References FTALK_ILLEGAL_ARGUMENT_ERROR, and FTALK_SUCCESS.
|
inherited |
Configures float data type functions to do a word swap.
The data functions operating upon 32-bit float data types can be configured to do a word swap.
|
inherited |
Enables float data type functions to do a word swap on a per slave basis.
The data functions operating upon 32-bit float data types can be configured to do a word swap.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
References FTALK_ILLEGAL_ARGUMENT_ERROR, and FTALK_SUCCESS.
|
inherited |
Configures all slaves for Standard 32-bit Mode.
In Standard 32-bit Register Mode a 32-bit value is transmitted as two consecutive 16-bit Modbus registers.
|
inherited |
Configures a slave for Standard 32-bit Register Mode.
In Standard 32-bit Register Mode a 32-bit value is transmitted as two consecutive 16-bit Modbus registers.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
FTALK_SUCCESS | Success |
FTALK_ILLEGAL_ARGUMENT_ERROR | Argument out of range |
References MbusMasterFunctions::configureIeeeFloats(), MbusMasterFunctions::configureLittleEndianInts(), FTALK_ILLEGAL_ARGUMENT_ERROR, and FTALK_SUCCESS.
|
inherited |
Configures all slaves for Daniel/ENRON 32-bit Mode.
Some Modbus flavours like the Daniel/Enron protocol represent a 32-bit value using one 32-bit Modbus register instead of two 16-bit registers.
|
inherited |
Configures all slaves for Daniel/ENRON 32-bit Mode.
Some Modbus flavours like the Daniel/Enron protocol represent a 32-bit value using one 32-bit Modbus register instead of two 16-bit registers.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
FTALK_SUCCESS | Success |
FTALK_ILLEGAL_ARGUMENT_ERROR | Argument out of range |
References MbusMasterFunctions::configureBigEndianInts(), MbusMasterFunctions::configureSwappedFloats(), FTALK_ILLEGAL_ARGUMENT_ERROR, and FTALK_SUCCESS.
|
inherited |
Configures the reference counting scheme to start with one for all slaves.
This renders the reference range to be 1 to 65536 (0x10000) and register #0 is an illegal register.
|
inherited |
Configures a slave's reference counting scheme to start with one.
This renders the reference range to be 1 to 65536 (0x10000) and register #0 is an illegal register.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
References FTALK_ILLEGAL_ARGUMENT_ERROR, and FTALK_SUCCESS.
|
inherited |
Configures the reference counting scheme to start with zero for all slaves.
This renders the valid reference range to be 0 to 65535 (0xFFFF).
This renders the first register to be #0 for all slaves.
|
inherited |
Configures a slave's reference counting scheme to start with zero.
This is also known as PDU addressing.
This renders the valid reference range to be 0 to 65535 (0xFFFF).
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
References FTALK_ILLEGAL_ARGUMENT_ERROR, and FTALK_SUCCESS.
|
staticinherited |
Returns the library version number.