FieldTalk Modbus® Master Protocol Library
C++ Editions
FOCUS Software Engineering

Main Page | Modules | Class Hierarchy | Compound List | Compound Members | Related Pages

Data and Control Functions for all Protocol Flavours


Detailed Description

This protocol stack implements the most commonly used Modbus data functions as well as some control functions. The functions to perform PLC program download and other device specific functions are outside the scope of this library.

All functions of conformance Class 0 and Class 1 have been implemented. In addition the most frequent used functions of conformance Class 2 have been implemented. This rich function set enables a user to solve nearly every Modbus data transfer problem.

The following table lists the available FieldTalk Master Protocol Pack functions:

Function CodeCurrent Terminology Classic Terminology
Conformance Class 0
3 (03 hex)Read Multiple Registers Read Holding Registers
16 (10 hex)Write Multiple Registers Preset Multiple Registers
Conformance Class 1
1 (01 hex)Read CoilsRead Coil Status
2 (02 hex)Read Inputs Discretes Read Input Status
4 (04 hex)Read Input Registers Read Input Registers
5 (05 hex)Write CoilForce Single Coil
6 (06 hex)Write Single Register Preset Single Register
7 (07 hex)Read Exception Status Read Exception Status
Conformance Class 2
15 (0F hex)Force Multiple Coils Force Multiple Coils
22 (16 hex)Mask Write Register Mask Write Register
23 (17 hex)Read/Write Registers Read/Write Registers

Remarks:
When passing register numbers and discrete numbers to FieldTalk functions you have to use the the Modbus register and discrete numbering scheme. See Register and Discrete Numbering Scheme. (Internally the functions will deduct 1 from the start register value before transmitting the value to the slave device.)

Most slave devices are limiting the amount of registers to be exchanged with the ASCII protocol to be 62 registers or 496 discretes. The limitation is based on the fact that the buffer must not exceed 256 bytes.


Class 0 Modbus Functions

int MbusMasterFunctions::writeMultipleRegisters (int slaveAddr, int startRef, const short regArr[], int refCnt)
 Modbus function 16 (10 hex), Preset Multiple Registers/Write Multiple Registers.

int MbusMasterFunctions::writeMultipleLongInts (int slaveAddr, int startRef, const long 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.

int MbusMasterFunctions::writeMultipleMod10000 (int slaveAddr, int startRef, const long 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.

int MbusMasterFunctions::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.

int MbusMasterFunctions::readMultipleRegisters (int slaveAddr, int startRef, short regArr[], int refCnt)
 Modbus function 3 (03 hex), Read Holding Registers/Read Multiple Registers.

int MbusMasterFunctions::readMultipleLongInts (int slaveAddr, int startRef, long int32Arr[], int refCnt)
 Modbus function 3 (03 hex) for 32-bit long int data types, Read Holding Registers/Read Multiple Registers as long int data.

int MbusMasterFunctions::readMultipleMod10000 (int slaveAddr, int startRef, long int32Arr[], int refCnt)
 Modbus function 3 (03 hex) for 32-bit modulo-10000 long int data types, Read Holding Registers/Read Multiple Registers as modulo-10000 long int data.

int MbusMasterFunctions::readMultipleFloats (int slaveAddr, int startRef, float float32Arr[], int refCnt)
 Modbus function 3 (03 hex) for 32-bit float data types, Read Holding Registers/Read Multiple Registers as float data.


Class 1 Modbus Functions

int MbusMasterFunctions::readCoils (int slaveAddr, int startRef, int bitArr[], int refCnt)
 Modbus function 1 (01 hex), Read Coil Status/Read Coils.

int MbusMasterFunctions::readInputDiscretes (int slaveAddr, int startRef, int bitArr[], int refCnt)
 Modbus function 2 (02 hex), Read Inputs Status/Read Input Discretes.

int MbusMasterFunctions::readInputRegisters (int slaveAddr, int startRef, short regArr[], int refCnt)
 Modbus function 4 (04 hex), Read Input Registers.

int MbusMasterFunctions::readInputLongInts (int slaveAddr, int startRef, long int32Arr[], int refCnt)
 Modbus function 4 (04 hex) for 32-bit long int data types, Read Input Registers as long int data.

int MbusMasterFunctions::readInputMod10000 (int slaveAddr, int startRef, long int32Arr[], int refCnt)
 Modbus function 4 (04 hex) for 32-bit modulo-10000 long int data types, Read Input Registers as modulo-10000 long int data.

int MbusMasterFunctions::readInputFloats (int slaveAddr, int startRef, float float32Arr[], int refCnt)
 Modbus function 4 (04 hex) for 32-bit float data types, Read Input Registers as float data.

int MbusMasterFunctions::writeCoil (int slaveAddr, int bitAddr, int bitVal)
 Modbus function 5 (05 hex), Force Single Coil/Write Coil.

int MbusMasterFunctions::writeSingleRegister (int slaveAddr, int regAddr, short regVal)
 Modbus function 6 (06 hex), Preset Single Register/Write Single Register.

int MbusMasterFunctions::readExceptionStatus (int slaveAddr, unsigned char *statusByte)
 Modbus function 7 (07 hex), Read Exception Status.


Class 2 Modbus Functions

int MbusMasterFunctions::forceMultipleCoils (int slaveAddr, int startRef, const int bitArr[], int refCnt)
 Modbus function 15 (0F hex), Force Multiple Coils.

int MbusMasterFunctions::maskWriteRegister (int slaveAddr, int regAddr, unsigned short andMask, unsigned short orMask)
 Modbus function 22 (16 hex), Mask Write Register.

int MbusMasterFunctions::readWriteRegisters (int slaveAddr, int readRef, short readArr[], int readCnt, int writeRef, const short writeArr[], int writeCnt)
 Modbus function 23 (17 hex), Read/Write Registers.


Protocol Configuration

int MbusMasterFunctions::setTimeout (int timeOut)
 Configures time-out.

int MbusMasterFunctions::getTimeout ()
 Returns the time-out value.

int MbusMasterFunctions::setPollDelay (int pollDelay)
 Configures poll delay.

int MbusMasterFunctions::getPollDelay ()
 Returns the poll delay time.

int MbusMasterFunctions::setRetryCnt (int retryCnt)
 Configures the automatic retry setting.

int MbusMasterFunctions::getRetryCnt ()
 Returns the automatic retry count.


Transmission Statistic Functions

unsigned long MbusMasterFunctions::getTotalCounter ()
 Returns how often a message transfer has been executed.

void MbusMasterFunctions::resetTotalCounter ()
 Resets total message transfer counter.

unsigned long MbusMasterFunctions::getSuccessCounter ()
 Returns how often a message transfer was successful.

void MbusMasterFunctions::resetSuccessCounter ()
 Resets successful message transfer counter.


Word Order Configuration

void MbusMasterFunctions::configureBigEndianInts ()
 Configures int data type functions to do a word swap.

void MbusMasterFunctions::configureSwappedFloats ()
 Configures float data type functions to do a word swap.

void MbusMasterFunctions::configureLittleEndianInts ()
 Configures int data type functions not to do a word swap.

void MbusMasterFunctions::configureIeeeFloats ()
 Configures float data type functions not to do a word swap.


Functions

char * MbusMasterFunctions::getPackageVersion ()
 Returns the package version number.


Function Documentation

int writeMultipleRegisters int  slaveAddr,
int  startRef,
const short  regArr[],
int  refCnt
[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).

Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 0x10000)
regArr Buffer with the data to be sent.
refCnt Number of references to be written (Range: 1-100)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
Broadcast supported for serial protocols

int readCoils int  slaveAddr,
int  startRef,
int  bitArr[],
int  refCnt
[inherited]
 

Modbus function 1 (01 hex), Read Coil Status/Read Coils.

Reads the contents of the discrete outputs (coils, 0:00000 table).

Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 0x10000)
bitArr Buffer which will contain the data read
refCnt Number of references to be read (Range: 1-2000)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
No broadcast supported

int forceMultipleCoils int  slaveAddr,
int  startRef,
const int  bitArr[],
int  refCnt
[inherited]
 

Modbus function 15 (0F hex), Force Multiple Coils.

Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).

Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 0x10000)
bitArr Buffer which contains the data to be sent
refCnt Number of references to be written (Range: 1-800)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
Broadcast supported for serial protocols

int setTimeout int  msTime  )  [inherited]
 

Configures time-out.

This function sets the operation or socket time-out to the specified value.

Remarks:
The time-out value is indicative only and not guaranteed to be maintained. How precise it is followed depends on the operating system used, it's scheduling priority and it's system timer resolution.
Note:
A protocol must be closed in order to configure it.
Parameters:
msTime Timeout value in ms (Range: 1 - 100000)
Return values:
FTALK_SUCCESS Success
FTALK_ILLEGAL_ARGUMENT_ERROR Argument out of range
FTALK_ILLEGAL_STATE_ERROR Protocol is already open

unsigned long getTotalCounter  )  [inherited]
 

Returns how often a message transfer has been executed.

Returns:
Counter value

void configureBigEndianInts  )  [inherited]
 

Configures 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.

char * getPackageVersion  )  [static, inherited]
 

Returns the package version number.

Returns:
Package version string

int writeMultipleLongInts int  slaveAddr,
int  startRef,
const long  int32Arr[],
int  refCnt
[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).

Remarks:
Modbus does not know about any other data type than discretes and 16-bit registers. Because a long int value is of 32-bit length, it will be transferred as two consecutive 16-bit registers. This means that the amount of registers transferred with this function is twice the amount of int values passed to this function.
Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 0x10000)
int32Arr Buffer with the data to be sent
refCnt Number of long integers to be sent (Range: 1-50)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
Broadcast supported for serial protocols

int writeMultipleMod10000 int  slaveAddr,
int  startRef,
const long  int32Arr[],
int  refCnt
[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.

Remarks:
Modbus does not know about any other data type than discretes and 16-bit registers. Because a modulo-10000 value is of 32-bit length, it will be transferred as two consecutive 16-bit registers. This means that the amount of registers transferred with this function is twice the amount of int values passed to this function.
Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 0x10000)
int32Arr Buffer with the data to be sent
refCnt Number of long integer values to be sent (Range: 1-50)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
Broadcast supported for serial protocols

int writeMultipleFloats int  slaveAddr,
int  startRef,
const float  float32Arr[],
int  refCnt
[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).

Remarks:
Modbus does not know about any other data type than discretes and 16-bit registers. Because a float value is of 32-bit length, it will be transferred as two consecutive 16-bit registers. This means that the amount of registers transferred with this function is twice the amount of float values passed to this function.
Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 0x10000)
float32Arr Buffer with the data to be sent
refCnt Number of float values to be sent (Range: 1-50)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
Broadcast supported for serial protocols

int readMultipleRegisters int  slaveAddr,
int  startRef,
short  regArr[],
int  refCnt
[inherited]
 

Modbus function 3 (03 hex), Read Holding Registers/Read Multiple Registers.

Reads the contents of the output registers (holding registers, 4:00000 table).

Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 0x10000)
regArr Buffer which will be filled with the data read
refCnt Number of registers to be read (Range: 1-125)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
No broadcast supported

int readMultipleLongInts int  slaveAddr,
int  startRef,
long  int32Arr[],
int  refCnt
[inherited]
 

Modbus function 3 (03 hex) 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.

Remarks:
Modbus does not know about any other data type than discretes and 16-bit registers. Because a long int value is of 32-bit length, it will be transferred as two consecutive 16-bit registers. This means that the amount of registers transferred with this function is twice the amount of int values passed to this function.
Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 0x10000)
int32Arr Buffer which will be filled with the data read
refCnt Number of long integers to be read (Range: 1-62)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
No broadcast supported

int readMultipleMod10000 int  slaveAddr,
int  startRef,
long  int32Arr[],
int  refCnt
[inherited]
 

Modbus function 3 (03 hex) 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.

Remarks:
Modbus does not know about any other data type than discretes and 16-bit registers. Because a modulo-10000 value is of 32-bit length, it will be transferred as two consecutive 16-bit registers. This means that the amount of registers transferred with this function is twice the amount of int values passed to this function.
Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 0x10000)
int32Arr Buffer which will be filled with the data read
refCnt Number of M10K integers to be read (Range: 1-62)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
No broadcast supported

int readMultipleFloats int  slaveAddr,
int  startRef,
float  float32Arr[],
int  refCnt
[inherited]
 

Modbus function 3 (03 hex) 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.

Remarks:
Modbus does not know about any other data type than discretes and 16-bit registers. Because a float value is of 32-bit length, it will be transferred as two consecutive 16-bit registers. This means that the amount of registers transferred with this function is twice the amount of float values passed to this function.
Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 0x10000)
float32Arr Buffer which will be filled with the data read
refCnt Number of float values to be read (Range: 1-62)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
No broadcast supported

int readInputDiscretes int  slaveAddr,
int  startRef,
int  bitArr[],
int  refCnt
[inherited]
 

Modbus function 2 (02 hex), Read Inputs Status/Read Input Discretes.

Reads the contents of the discrete inputs (input status, 1:00000 table).

Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 0x10000)
bitArr Buffer which will contain the data read
refCnt Number of references to be read (Range: 1-2000)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
No broadcast supported

int readInputRegisters int  slaveAddr,
int  startRef,
short  regArr[],
int  refCnt
[inherited]
 

Modbus function 4 (04 hex), Read Input Registers.

Read the contents of the input registers (3:00000 table).

Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 0x10000)
regArr Buffer which will be filled with the data read.
refCnt Number of references to be read (Range: 1-125)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
No broadcast supported

int readInputLongInts int  slaveAddr,
int  startRef,
long  int32Arr[],
int  refCnt
[inherited]
 

Modbus function 4 (04 hex) 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.

Remarks:
Modbus does not know about any other data type than discretes and 16-bit registers. Because a long int value is of 32-bit length, it will be transferred as two consecutive 16-bit registers. This means that the amount of registers transferred with this function is twice the amount of int values passed to this function.
Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 0x10000)
int32Arr Buffer which will be filled with the data read
refCnt Number of long integers to be read (Range: 1-62)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
No broadcast supported

int readInputMod10000 int  slaveAddr,
int  startRef,
long  int32Arr[],
int  refCnt
[inherited]
 

Modbus function 4 (04 hex) 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.

Remarks:
Modbus does not know about any other data type than discretes and 16-bit registers. Because an modulo-10000 value is of 32-bit length, it will be transferred as two consecutive 16-bit registers. This means that the amount of registers transferred with this function is twice the amount of int values passed to this function.
Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 0x10000)
int32Arr Buffer which will be filled with the data read
refCnt Number of M10K integers to be read (Range: 1-62)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
No broadcast supported

int readInputFloats int  slaveAddr,
int  startRef,
float  float32Arr[],
int  refCnt
[inherited]
 

Modbus function 4 (04 hex) 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.

Remarks:
Modbus does not know about any other data type than discretes and 16-bit registers. Because a float value is of 32-bit length, it will be transferred as two consecutive 16-bit registers. This means that the amount of registers transferred with this function is twice the amount of float values passed to this function.
Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 0x10000)
float32Arr Buffer which will be filled with the data read
refCnt Number of floats to be read (Range: 1-62)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
No broadcast supported

int writeCoil int  slaveAddr,
int  bitAddr,
int  bitVal
[inherited]
 

Modbus function 5 (05 hex), Force Single Coil/Write Coil.

Sets a single discrete output variable (coil, 0:00000 table) to either ON or OFF.

Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
bitAddr Coil address (Range: 1 - 0x10000)
bitVal true sets, false clears discrete output variable
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
Broadcast supported for serial protocols

int writeSingleRegister int  slaveAddr,
int  regAddr,
short  regVal
[inherited]
 

Modbus function 6 (06 hex), Preset Single Register/Write Single Register.

Writes a value into a single output register (holding register, 4:00000 reference).

Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
regAddr Register address (Range: 1 - 0x10000)
regVal Data to be sent
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
Broadcast supported for serial protocols

int readExceptionStatus int  slaveAddr,
unsigned char *  statusByte
[inherited]
 

Modbus function 7 (07 hex), Read Exception Status.

Reads the eight exception status coils within the slave device.

Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
statusByte Slave status byte. The meaning of this status byte is slave specific and varies from device to device. identifier (Range: 1 - 255)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
No broadcast supported

int maskWriteRegister int  slaveAddr,
int  regAddr,
unsigned short  andMask,
unsigned short  orMask
[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 andMask)

Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
regAddr Register address (Range: 1 - 0x10000)
andMask Mask to be applied as a logic AND to the register
orMask Mask to be applied as a logic OR to the register
Note:
No broadcast supported

int readWriteRegisters int  slaveAddr,
int  readRef,
short  readArr[],
int  readCnt,
int  writeRef,
const short  writeArr[],
int  writeCnt
[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).

Parameters:
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
readRef Start reference for reading (Range: 1 - 0x10000)
readArr Buffer which will contain the data read
readCnt Number of registers to be read (Range: 1-125)
writeRef Start reference for writing (Range: 1 - 0x10000)
writeArr Buffer with data to be sent
writeCnt Number of registers to be sent (Range: 1-100)
Returns:
FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
Note:
No broadcast supported

int getTimeout  )  [inherited]
 

Returns the time-out value.

Remarks:
The time-out value is indicative only and not guaranteed to be maintained. How precise it is followed depends on the operating system used, it's scheduling priority and it's system timer resolution.
Returns:
Timeout value in ms

int setPollDelay int  msTime  )  [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.

Remarks:
The delay value is indicative only and not guaranteed to be maintained. How precise it is followed depends on the operating system used, it's scheduling priority and it's system timer resolution.
Note:
A protocol must be closed in order to configure it.
Parameters:
msTime Delay time in ms (Range: 0 - 100000), 0 disables poll delay
Return values:
FTALK_SUCCESS Success
FTALK_ILLEGAL_ARGUMENT_ERROR Argument out of range
FTALK_ILLEGAL_STATE_ERROR Protocol is already open

int getPollDelay  )  [inherited]
 

Returns the poll delay time.

Returns:
Delay time in ms, 0 if poll delay is switched off

int setRetryCnt int  retries  )  [inherited]
 

Configures the automatic retry setting.

A value of 0 disables any automatic retries.

Note:
A protocol must be closed in order to configure it.
Parameters:
retries Retry count (Range: 0 - 10), 0 disables retries
Return values:
FTALK_SUCCESS Success
FTALK_ILLEGAL_ARGUMENT_ERROR Argument out of range
FTALK_ILLEGAL_STATE_ERROR Protocol is already open

int getRetryCnt  )  [inherited]
 

Returns the automatic retry count.

Returns:
Retry count

unsigned long getSuccessCounter  )  [inherited]
 

Returns how often a message transfer was successful.

Returns:
Counter value

void configureSwappedFloats  )  [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.

Note:
Most platforms store floats in IEEE 754 little-endian order which does not need a word swap.

void configureLittleEndianInts  )  [inherited]
 

Configures int data type functions not to do a word swap.

This is the default.

void configureIeeeFloats  )  [inherited]
 

Configures float data type functions not to do a word swap.

This is the default.