FOCUS Software Engineering is now part of proconX   

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

 TMbusMasterFunctions::writeMultipleRegisters (integer slaveAddr, integer startRef, word &*regArr)
 Modbus function 16 (10 hex), Preset Multiple Registers/Write Multiple Registers.

 TMbusMasterFunctions::writeMultipleLongInts (integer slaveAddr, integer startRef, integer &*int32Arr)
 Modbus function 16 (10 hex) for 32-bit long int data types, Preset Multiple Registers/Write Multiple Registers with long int data.

 TMbusMasterFunctions::writeMultipleMod10000 (integer slaveAddr, integer startRef, integer &*int32Arr)
 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.

 TMbusMasterFunctions::writeMultipleFloats (integer slaveAddr, integer startRef, single &*float32Arr)
 Modbus function 16 (10 hex) for 32-bit float data types, Preset Multiple Registers/Write Multiple Registers with float data.

 TMbusMasterFunctions::readMultipleRegisters (integer slaveAddr, integer startRef, word &*regArr)
 Modbus function 3 (03 hex), Read Holding Registers/Read Multiple Registers.

 TMbusMasterFunctions::readMultipleLongInts (integer slaveAddr, integer startRef, integer &*int32Arr)
 Modbus function 3 (03 hex) for 32-bit long int data types, Read Holding Registers/Read Multiple Registers as long int data.

 TMbusMasterFunctions::readMultipleMod10000 (integer slaveAddr, integer startRef, integer &*int32Arr)
 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.

 TMbusMasterFunctions::readMultipleFloats (integer slaveAddr, integer startRef, single &*float32Arr)
 Modbus function 3 (03 hex) for 32-bit float data types, Read Holding Registers/Read Multiple Registers as float data.


Class 1 Modbus Procedures

 TMbusMasterFunctions::readCoils (integer slaveAddr, integer startRef, boolean &*bitArr)
 Modbus function 1 (01 hex), Read Coil Status/Read Coils.

 TMbusMasterFunctions::readInputDiscretes (integer slaveAddr, integer startRef, boolean &*bitArr)
 Modbus function 2 (02 hex), Read Inputs Status/Read Input Discretes.

 TMbusMasterFunctions::readInputRegisters (integer slaveAddr, integer startRef, word &*regArr)
 Modbus function 4 (04 hex), Read Input Registers.

 TMbusMasterFunctions::readInputLongInts (integer slaveAddr, integer startRef, integer &*int32Arr)
 Modbus function 4 (04 hex) for 32-bit long int data types, Read Input Registers as long int data.

 TMbusMasterFunctions::readInputMod10000 (integer slaveAddr, integer startRef, integer &*int32Arr)
 Modbus function 4 (04 hex) for 32-bit modulo-10000 long int data types, Read Input Registers as modulo-10000 long int data.

 TMbusMasterFunctions::readInputFloats (integer slaveAddr, integer startRef, single &*float32Arr)
 Modbus function 4 (04 hex) for 32-bit float data types, Read Input Registers as float data.

 TMbusMasterFunctions::writeCoil (integer slaveAddr, integer bitAddr, boolean bitVal)
 Modbus function 5 (05 hex), Force Single Coil/Write Coil.

 TMbusMasterFunctions::writeSingleRegister (integer slaveAddr, integer regAddr, word regVal)
 Modbus function 6 (06 hex), Preset Single Register/Write Single Register.

 TMbusMasterFunctions::readExceptionStatus (integer slaveAddr, byte &statusByte)
 Modbus function 7 (07 hex), Read Exception Status.


Class 2 Modbus Procedures

 TMbusMasterFunctions::forceMultipleCoils (integer slaveAddr, integer startRef, boolean &*bitArr)
 Modbus function 15 (0F hex), Force Multiple Coils.

 TMbusMasterFunctions::maskWriteRegister (integer slaveAddr, integer regAddr, word andMask, word orMask)
 Modbus function 22 (16 hex), Mask Write Register.

 TMbusMasterFunctions::readWriteRegisters (integer slaveAddr, integer readRef, word &*readArr, integer writeRef, word &*writeArr)
 Modbus function 23 (17 hex), Read/Write Registers.


Protocol Configuration

 TMbusMasterFunctions::setTimeout (const integer timeOut)
 Configures time-out.

integer TMbusMasterFunctions::getTimeout ()
 Returns the time-out value.

 TMbusMasterFunctions::setPollDelay (const integer pollDelay)
 Configures poll delay.

integer TMbusMasterFunctions::getPollDelay ()
 Returns the poll delay time.

 TMbusMasterFunctions::setRetryCnt (const integer retryCnt)
 Configures the automatic retry setting.

integer TMbusMasterFunctions::getRetryCnt ()
 Returns the automatic retry count.

integer TMbusMasterFunctions::timeout
integer TMbusMasterFunctions::pollDelay
integer TMbusMasterFunctions::retryCnt
boolean TMbusMasterFunctions::bigEndianInts
boolean TMbusMasterFunctions::swappedFloats

Transmission Statistic Functions

cardinal TMbusMasterFunctions::getTotalCounter ()
 Returns how often a message transfer has been executed.

 TMbusMasterFunctions::resetTotalCounter ()
 Resets total message transfer counter.

cardinal TMbusMasterFunctions::getSuccessCounter ()
 Returns how often a message transfer was successful.

 TMbusMasterFunctions::resetSuccessCounter ()
 Resets successful message transfer counter.


Word Order Configuration

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

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

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

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


Functions

string TMbusMasterFunctions::getPackageVersion ()
 Returns the package version number.


Function Documentation

writeMultipleRegisters integer  slaveAddr,
integer  startRef,
word &*  regArr
[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 - $10000)
regArr Buffer with the data to be sent.The length of the array determines how many registers are written (Range: 1-100).
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See descendants of EBusProtocolException for a more detailed failure list.
Note:
Broadcast supported for serial protocols

readCoils integer  slaveAddr,
integer  startRef,
boolean &*  bitArr
[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 - $10000)
bitArr Buffer which will contain the data read. The length of the array determines how many coils are read (Range: 1-2000).
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
No broadcast supported

forceMultipleCoils integer  slaveAddr,
integer  startRef,
boolean &*  bitArr
[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 - $10000)
bitArr Buffer which contains the data to be sent. The length of the array determines how many coils are written (Range: 1-800).
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
Broadcast supported for serial protocols

setTimeout const integer  timeOut  )  [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:
timeOut Timeout value in ms (Range: 1 - 100000)
Exceptions:
EIllegalStateError Protocol is already open
EIllegalArgumentError A parameter is out of range

cardinal getTotalCounter  )  [inherited]
 

Returns how often a message transfer has been executed.

Returns:
Counter value

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

class string getPackageVersion  )  [inherited]
 

Returns the package version number.

Returns:
Package version string

writeMultipleLongInts integer  slaveAddr,
integer  startRef,
integer &*  int32Arr
[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 - $10000)
int32Arr Buffer with the data to be sent. The length of the array determines how many references are read (Range: 1-50).
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
Broadcast supported for serial protocols

writeMultipleMod10000 integer  slaveAddr,
integer  startRef,
integer &*  int32Arr
[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 - $10000)
int32Arr Buffer with the data to be sent. The length of the array determines how many references are written (Range: 1-50).
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
Broadcast supported for serial protocols

writeMultipleFloats integer  slaveAddr,
integer  startRef,
single &*  float32Arr
[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 - $10000)
float32Arr Buffer with the data to be sent. The length of the array determines how many references are written (Range: 1-50).
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
Broadcast supported for serial protocols

readMultipleRegisters integer  slaveAddr,
integer  startRef,
word &*  regArr
[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 - $10000)
regArr Buffer which will be filled with the data read. The length of the array determines how many registers are read (Range: 1-125).
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
No broadcast supported

readMultipleLongInts integer  slaveAddr,
integer  startRef,
integer &*  int32Arr
[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 - $10000)
int32Arr Buffer which will be filled with the data read. The length of the array determines how many references are read (Range: 1-62).
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
No broadcast supported

readMultipleMod10000 integer  slaveAddr,
integer  startRef,
integer &*  int32Arr
[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 - $10000)
int32Arr Buffer which will be filled with the data read. The length of the array determines how many references are read (Range: 1-62).
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
No broadcast supported

readMultipleFloats integer  slaveAddr,
integer  startRef,
single &*  float32Arr
[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 - $10000)
float32Arr Buffer which will be filled with the data read. The length of the array determines how many references are read (Range: 1-62).
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
No broadcast supported

readInputDiscretes integer  slaveAddr,
integer  startRef,
boolean &*  bitArr
[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 - $10000)
bitArr Buffer which will contain the data read. The length of the array determines how many inputs are read (Range: 1-2000).
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
No broadcast supported

readInputRegisters integer  slaveAddr,
integer  startRef,
word &*  regArr
[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 - $10000)
regArr Buffer which will be filled with the data read. The length of the array determines how many registers are read (Range: 1-125).
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
No broadcast supported

readInputLongInts integer  slaveAddr,
integer  startRef,
integer &*  int32Arr
[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 - $10000)
int32Arr Buffer which will be filled with the data read. The length of the array determines how many references are read (Range: 1-62).
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
No broadcast supported

readInputMod10000 integer  slaveAddr,
integer  startRef,
integer &*  int32Arr
[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 - $10000)
int32Arr Buffer which will be filled with the data read. The length of the array determines how many references are read (Range: 1-62).
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
No broadcast supported

readInputFloats integer  slaveAddr,
integer  startRef,
single &*  float32Arr
[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 - $10000)
float32Arr Buffer which will be filled with the data read. The length of the array determines how many references are read (Range: 1-62).
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
No broadcast supported

writeCoil integer  slaveAddr,
integer  bitAddr,
boolean  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 - $10000)
bitVal true sets, false clears discrete output variable
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
Broadcast supported for serial protocols

writeSingleRegister integer  slaveAddr,
integer  regAddr,
word  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 - $10000)
regVal Data to be sent
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
Broadcast supported for serial protocols

readExceptionStatus integer  slaveAddr,
byte &  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)
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
No broadcast supported

maskWriteRegister integer  slaveAddr,
integer  regAddr,
word  andMask,
word  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: retVal = (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 - $10000)
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

readWriteRegisters integer  slaveAddr,
integer  readRef,
word &*  readArr,
integer  writeRef,
word &*  writeArr
[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 - $10000)
readArr Buffer which will contain the data read. The length of the array determines how many references are read (Range: 1-125).
writeRef Start reference for writing (Range: 1 - $10000)
writeArr Buffer with data to be sent. The length of the array determines how many references are written (Range: 1-100).
Exceptions:
EIllegalStateError Port or connection is closed
EInOutError An I/O error occurred
EIllegalArgumentError A parameter is out of range
EBusProtocolException A protocol failure occurred. See
Note:
No broadcast supported

integer 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

setPollDelay const integer  pollDelay  )  [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:
pollDelay Delay time in ms (Range: 0 - 100000), 0 disables poll delay
Exceptions:
EIllegalStateError Protocol is already open
EIllegalArgumentError A parameter is out of range

integer getPollDelay  )  [inherited]
 

Returns the poll delay time.

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

setRetryCnt const integer  retryCnt  )  [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:
retryCnt Retry count (Range: 0 - 10), 0 disables retries
Exceptions:
EIllegalStateError Protocol is already open
EIllegalArgumentError A parameter is out of range

integer getRetryCnt  )  [inherited]
 

Returns the automatic retry count.

Returns:
Retry count

cardinal getSuccessCounter  )  [inherited]
 

Returns how often a message transfer was successful.

Returns:
Counter value

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.

configureLittleEndianInts  )  [inherited]
 

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

This is the default.

configureIeeeFloats  )  [inherited]
 

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

This is the default.


Variable Documentation

integer timeout [inherited]
 

Note:
A protocol must be closed in order to configure it.
See also:
getTimeout For reading

setTimeout For writing

integer pollDelay [inherited]
 

Delay between two Modbus read/writes in ms

Note:
A protocol must be closed in order to configure it.
See also:
getPollDelay For reading

setPollDelay For writing

integer retryCnt [inherited]
 

Note:
A protocol must be closed in order to configure it.
See also:
getRetryCnt For reading

setRetryCnt For writing

boolean bigEndianInts [inherited]
 

Note:
A protocol must be closed in order to configure it.
See also:
fSwapInts For reading

setBigEndianInts For writing

boolean swappedFloats [inherited]
 

Note:
A protocol must be closed in order to configure it.
See also:
fSwapFloats For reading

setSwappedFloats For writing

   Back | Top of page Info | Support | Contact | About   
Information in this document is subject to change without notice. Copyright © 2000-2013 proconX Pty Ltd. All rights reserved.
All product and brand names mentioned on this page may be trademarks or registered trademarks of their respective owners.