Base class which implements Modbus data and control functions. More...
Public Member Functions | |
~TMbusMasterFunctions () | |
Destructor. | |
boolean | isOpen () |
Returns whether the protocol is open or not. | |
closeProtocol () | |
Closes an open protocol including any associated communication resources (COM ports or sockets). | |
string | getPackageVersion () |
Returns the package version number. | |
Protocol Configuration | |
| |
integer | timeout |
Time-out port property. | |
integer | pollDelay |
Poll delay property. | |
integer | retryCnt |
Retry count property. | |
setTimeout (const integer timeOut) | |
Configures time-out. | |
integer | getTimeout () |
Returns the time-out value. | |
setPollDelay (const integer pollDelay) | |
Configures poll delay. | |
integer | getPollDelay () |
Returns the poll delay time. | |
setRetryCnt (const integer retryCnt) | |
Configures the automatic retry setting. | |
integer | getRetryCnt () |
Returns the automatic retry count. | |
Bit Access | |
Table 0:00000 (Coils) and Table 1:00000 (Input Status) | |
readCoils (integer slaveAddr, integer startRef, boolean[]bitArr) | |
Modbus function 1 (01 hex), Read Coil Status/Read Coils. | |
readInputDiscretes (integer slaveAddr, integer startRef, boolean[]bitArr) | |
Modbus function 2 (02 hex), Read Inputs Status/Read Input Discretes. | |
writeCoil (integer slaveAddr, integer bitAddr, boolean bitVal) | |
Modbus function 5 (05 hex), Force Single Coil/Write Coil. | |
forceMultipleCoils (integer slaveAddr, integer startRef, boolean[]bitArr) | |
Modbus function 15 (0F hex), Force Multiple Coils. | |
16-bit Access | |
Table 4:00000 (Holding Registers) and Table 3:00000 (Input Registers) | |
readMultipleRegisters (integer slaveAddr, integer startRef, word[]regArr) | |
Modbus function 3 (03 hex), Read Holding Registers/Read Multiple Registers. | |
readInputRegisters (integer slaveAddr, integer startRef, word[]regArr) | |
Modbus function 4 (04 hex), Read Input Registers. | |
writeSingleRegister (integer slaveAddr, integer regAddr, word regVal) | |
Modbus function 6 (06 hex), Preset Single Register/Write Single Register. | |
writeMultipleRegisters (integer slaveAddr, integer startRef, word[]regArr) | |
Modbus function 16 (10 hex), Preset Multiple Registers/Write Multiple Registers. | |
maskWriteRegister (integer slaveAddr, integer regAddr, word andMask, word orMask) | |
Modbus function 22 (16 hex), Mask Write Register. | |
readWriteRegisters (integer slaveAddr, integer readRef, word[]readArr, integer writeRef, word[]writeArr) | |
Modbus function 23 (17 hex), Read/Write Registers. | |
32-bit Access | |
Table 4:00000 (Holding Registers) and Table 3:00000 (Input Registers) | |
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. | |
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. | |
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. | |
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. | |
readInputFloats (integer slaveAddr, integer startRef, single[]float32Arr) | |
Modbus function 4 (04 hex) for 32-bit float data types, Read Input Registers as float data. | |
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. | |
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. | |
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. | |
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. | |
Diagnostics | |
| |
readExceptionStatus (integer slaveAddr, byte &statusByte) | |
Modbus function 7 (07 hex), Read Exception Status. | |
returnQueryData (integer slaveAddr, byte[]queryArr, byte[]echoArr) | |
Modbus function code 8, sub-function 00, Return Query Data. | |
restartCommunicationsOption (integer slaveAddr, boolean clearEventLog) | |
Modbus function code 8, sub-function 01, Restart Communications Option. | |
Custom Function Codes | |
| |
customFunction (integer slaveAddr, integer functionCode, byte[]requestArr, byte[]responseArr, integer &responseLen) | |
User Defined Function CodeThis method can be used to implement User Defined Function Codes. | |
Transmission Statistic Functions | |
| |
cardinal | getTotalCounter () |
Returns how often a message transfer has been executed. | |
resetTotalCounter () | |
Resets total message transfer counter. | |
cardinal | getSuccessCounter () |
Returns how often a message transfer was successful. | |
resetSuccessCounter () | |
Resets successful message transfer counter. | |
Slave Configuration | |
| |
configureBigEndianInts () | |
Configures int data type functions to do a word swap. | |
configureSwappedFloats () | |
Configures float data type functions to do a word swap. | |
configureLittleEndianInts () | |
Configures int data type functions not to do a word swap. | |
configureIeeeFloats () | |
Configures float data type functions not to do a word swap. | |
configureStandard32BitMode () | |
Configures all slaves for Standard 32-bit Mode. | |
configureEnron32BitMode () | |
Configures all slaves for Daniel/ENRON 32-bit Mode. | |
configureCountFromOne () | |
Configures the reference counting scheme to start with one for all slaves. | |
configureCountFromZero () | |
Configures the reference counting scheme to start with zero for all slaves. | |
configureBigEndianInts (integer slaveAddr) | |
Enables int data type functions to do a word swap on a per slave basis. | |
configureLittleEndianInts (integer slaveAddr) | |
Disables word swapping for int data type functions on a per slave basis. | |
configureIeeeFloats (integer slaveAddr) | |
Disables float data type functions to do a word swap on a per slave basis. | |
configureSwappedFloats (integer slaveAddr) | |
Enables float data type functions to do a word swap on a per slave basis. | |
configureStandard32BitMode (integer slaveAddr) | |
Configures a slave for Standard 32-bit Register Mode. | |
configureEnron32BitMode (integer slaveAddr) | |
Configures all slaves for Daniel/ENRON 32-bit Mode. | |
configureCountFromOne (integer slaveAddr) | |
Configures a slave's reference counting scheme to start with one. | |
configureCountFromZero (integer slaveAddr) | |
Configures a slave's reference counting scheme to start with zero. |
Base class which implements Modbus data and control functions.
The functions provided by this base class apply to all protocol flavours via inheritance. For a more detailed description see section Data and Control Functions for all Modbus Protocol Flavours.
~TMbusMasterFunctions | ( | ) |
Destructor.
Does clean-up and closes an open protocol including any associated communication resources (serial ports or sockets).
readCoils | ( | integer | slaveAddr, | |
integer | startRef, | |||
boolean[] | bitArr | |||
) |
Modbus function 1 (01 hex), 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. The length of the array determines how many coils are read (Range: 1-2000). |
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. |
readInputDiscretes | ( | integer | slaveAddr, | |
integer | startRef, | |||
boolean[] | bitArr | |||
) |
Modbus function 2 (02 hex), 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. The length of the array determines how many inputs are read (Range: 1-2000). |
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. |
writeCoil | ( | integer | slaveAddr, | |
integer | bitAddr, | |||
boolean | bitVal | |||
) |
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.
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 |
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. |
forceMultipleCoils | ( | integer | slaveAddr, | |
integer | startRef, | |||
boolean[] | bitArr | |||
) |
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: 1 - 255) | |
startRef | Start reference (Range: 1 - 65536) | |
bitArr | Buffer which contains the data to be sent. The length of the array determines how many coils are written (Range: 1-1968). |
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. |
readMultipleRegisters | ( | integer | slaveAddr, | |
integer | startRef, | |||
word[] | regArr | |||
) |
Modbus function 3 (03 hex), 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. The length of the array determines how many registers are read (Range: 1-125). |
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. |
readInputRegisters | ( | integer | slaveAddr, | |
integer | startRef, | |||
word[] | regArr | |||
) |
Modbus function 4 (04 hex), 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. The length of the array determines how many registers are read (Range: 1-125). |
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. |
writeSingleRegister | ( | integer | slaveAddr, | |
integer | regAddr, | |||
word | regVal | |||
) |
Modbus function 6 (06 hex), 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 |
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. |
writeMultipleRegisters | ( | integer | slaveAddr, | |
integer | startRef, | |||
word[] | regArr | |||
) |
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.The length of the array determines how many registers are written (Range: 1-123). |
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. |
maskWriteRegister | ( | integer | slaveAddr, | |
integer | regAddr, | |||
word | andMask, | |||
word | orMask | |||
) |
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) | |
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 |
readWriteRegisters | ( | integer | slaveAddr, | |
integer | readRef, | |||
word[] | readArr, | |||
integer | writeRef, | |||
word[] | writeArr | |||
) |
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) | |
readRef | Start registers for reading (Range: 1 - 65536) | |
readArr | Buffer which will contain the data read. The length of the array determines how many registers are read (Range: 1-125). | |
writeRef | Start registers for writing (Range: 1 - 65536) | |
writeArr | Buffer with data to be sent. The length of the array determines how many registers are written (Range: 1-121). |
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. |
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.
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. The length of the array determines how many values are read (Range: 1-62). |
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. |
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.
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. The length of the array determines how many values are read (Range: 1-62). |
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. |
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.
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. The length of the array determines how many values are read (Range: 1-61). |
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. |
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.
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. The length of the array determines how many values are read (Range: 1-62). |
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. |
readInputFloats | ( | integer | slaveAddr, | |
integer | startRef, | |||
single[] | float32Arr | |||
) |
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.
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. The length of the array determines how many values are read (Range: 1-62). |
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. |
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.
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. The length of the array determines how many values are written (Range: 1-61). |
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. |
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.
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. The length of the array determines how many values are read (Range: 1-62). |
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. |
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.
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. The length of the array determines how many values are read (Range: 1-62). |
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. |
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.
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. The length of the array determines how many values are written (Range: 1-61). |
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. |
readExceptionStatus | ( | integer | slaveAddr, | |
byte & | statusByte | |||
) |
Modbus function 7 (07 hex), 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) | |
statusByte | Slave status byte. The meaning of this status byte is slave specific and varies from device to device. |
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. |
returnQueryData | ( | integer | slaveAddr, | |
byte[] | queryArr, | |||
byte[] | echoArr | |||
) |
Modbus function code 8, sub-function 00, Return Query Data.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) | |
queryArr | Data to be sent | |
echoArr | Buffer which will contain the data read. Array must be of the same size as queryArr. |
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. |
restartCommunicationsOption | ( | integer | slaveAddr, | |
boolean | clearEventLog | |||
) |
Modbus function code 8, sub-function 01, Restart Communications Option.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) | |
clearEventLog | Flag when set to one clears in addition the slave's communication even log. |
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. |
setTimeout | ( | const integer | timeOut | ) |
Configures time-out.
This function sets the operation or socket time-out to the specified value.
timeOut | Timeout value in ms (Range: 1 - 100000) |
EIllegalStateError | Protocol is already open | |
EIllegalArgumentError | A parameter is out of range |
integer getTimeout | ( | ) |
Returns the time-out value.
setPollDelay | ( | const integer | pollDelay | ) |
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.
pollDelay | Delay time in ms (Range: 0 - 100000), 0 disables poll delay |
EIllegalStateError | Protocol is already open | |
EIllegalArgumentError | A parameter is out of range |
integer getPollDelay | ( | ) |
Returns the poll delay time.
setRetryCnt | ( | const integer | retryCnt | ) |
Configures the automatic retry setting.
A value of 0 disables any automatic retries.
retryCnt | Retry count (Range: 0 - 10), 0 disables retries |
EIllegalStateError | Protocol is already open | |
EIllegalArgumentError | A parameter is out of range |
integer getRetryCnt | ( | ) |
Returns the automatic retry count.
cardinal getTotalCounter | ( | ) |
Returns how often a message transfer has been executed.
cardinal getSuccessCounter | ( | ) |
Returns how often a message transfer was successful.
configureBigEndianInts | ( | ) |
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.
configureSwappedFloats | ( | ) |
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.
configureLittleEndianInts | ( | ) |
Configures int data type functions not to do a word swap.
This is the default.
configureIeeeFloats | ( | ) |
Configures float data type functions not to do a word swap.
This is the default.
configureStandard32BitMode | ( | ) |
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.
configureEnron32BitMode | ( | ) |
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.
configureCountFromOne | ( | ) |
Configures the reference counting scheme to start with one for all slaves.
This renders the reference range to be 1 to 65536 and register #0 is an illegal register.
configureCountFromZero | ( | ) |
Configures the reference counting scheme to start with zero for all slaves.
This renders the valid reference range to be 0 to 65535.
This renders the first register to be #0 for all slaves.
configureBigEndianInts | ( | integer | slaveAddr | ) |
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. |
EIllegalArgumentError | A parameter is out of range |
configureLittleEndianInts | ( | integer | slaveAddr | ) |
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. |
EIllegalArgumentError | A parameter is out of range |
configureIeeeFloats | ( | integer | slaveAddr | ) |
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. |
EIllegalArgumentError | A parameter is out of range |
configureSwappedFloats | ( | integer | slaveAddr | ) |
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. |
EIllegalArgumentError | A parameter is out of range |
configureStandard32BitMode | ( | integer | slaveAddr | ) |
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. |
EIllegalArgumentError | A parameter is out of range |
configureEnron32BitMode | ( | integer | slaveAddr | ) |
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. |
EIllegalArgumentError | A parameter is out of range |
configureCountFromOne | ( | integer | slaveAddr | ) |
Configures a slave's reference counting scheme to start with one.
This renders the reference range to be 1 to 65536 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. |
EIllegalArgumentError | A parameter is out of range |
configureCountFromZero | ( | integer | slaveAddr | ) |
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.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
EIllegalArgumentError | A parameter is out of range |
boolean isOpen | ( | ) |
Returns whether the protocol is open or not.
true | = open | |
false | = closed |
class string getPackageVersion | ( | ) |
Returns the package version number.
integer timeout |
Time-out port property.
integer pollDelay |
Poll delay property.
Delay between two Modbus read/writes in ms
integer retryCnt |
Retry count property.