MODBUS/TCP Master Protocol class.
This class realises the MODBUS/TCP master protocol. It provides functions to establish and to close a TCP/IP connection to the slave as well as data and control functions which can be used after a connection to a slave device has been established successfully. The data and control functions are organized different conformance classes. For a more detailed description of the data and control functions see section Data and Control Functions for all Protocol Flavours.
It is also possible to instantiate multiple instances of this class for establishing multiple connections to either the same or different hosts.
|
TCP/IP Connection Management Functions |
| | openProtocol () |
| | Connects to a MODBUS/TCP slave.
|
| | setPort (word portNo) |
| | Sets the TCP port number to be used by the protocol.
|
| word | getPort () |
| | Returns the TCP port number used by the protocol.
|
| string | hostName |
| word | port |
Class 0 Modbus Functions |
| | writeMultipleRegisters (integer slaveAddr, integer startRef, word &*regArr) |
| | Modbus function 16 (10 hex), Preset Multiple Registers/Write Multiple Registers.
|
| | 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.
|
| | 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.
|
| | 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.
|
| | readMultipleRegisters (integer slaveAddr, integer startRef, word &*regArr) |
| | Modbus function 3 (03 hex), Read Holding Registers/Read Multiple 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.
|
| | 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.
|
| | 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 Functions |
| | 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.
|
| | readInputRegisters (integer slaveAddr, integer startRef, word &*regArr) |
| | Modbus function 4 (04 hex), Read Input Registers.
|
| | 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.
|
| | 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.
|
| | readInputFloats (integer slaveAddr, integer startRef, single &*float32Arr) |
| | Modbus function 4 (04 hex) for 32-bit float data types, Read Input Registers as float data.
|
| | writeCoil (integer slaveAddr, integer bitAddr, boolean bitVal) |
| | Modbus function 5 (05 hex), Force Single Coil/Write Coil.
|
| | writeSingleRegister (integer slaveAddr, integer regAddr, word regVal) |
| | Modbus function 6 (06 hex), Preset Single Register/Write Single Register.
|
| | readExceptionStatus (integer slaveAddr, byte &statusByte) |
| | Modbus function 7 (07 hex), Read Exception Status.
|
Class 2 Modbus Functions |
| | forceMultipleCoils (integer slaveAddr, integer startRef, boolean &*bitArr) |
| | Modbus function 15 (0F hex), Force Multiple Coils.
|
| | 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.
|
Protocol Configuration |
| | 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.
|
| integer | timeout |
| integer | pollDelay |
| integer | retryCnt |
| boolean | bigEndianInts |
| boolean | swappedFloats |
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.
|
Word Order 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.
|
Public Member Functions |
| | TMbusTcpMasterProtocol (TComponent aOwner) |
| | Constructs a TMbusTcpMasterProtocol object and initialises its data.
|
| 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.
|