...
The protocol implements a server (slave) communication with arbitrary devices that support the MODBUS RTU standard, either in a serial communication version or a MODBUS over TCP/IP variant.
...
- Line category: Serial (serial communication), SerialOverUDP Device Redundant (serial communication).
- Line category TCP/IP-TCP (MODBUS over TCP/IP). Use a symbolic address ALL or *, in order for the KOM process to listen on a selected TCP port on all existing network interfaces. TCP port 502 is commonly used, but any of the ports can be used.
Line number - set the value, for example, 1.
Note: The KOM process works as a multitasking TCP server, and that is why it is able to handle multiple clients at the same time.
...
Configuration dialog box - table Parameters.
They influence some optional parameters of the protocol. Following The following line protocol parameters can be set:
Table 1
| Parameter | Meaning | Unit | Default value | ||||||
|---|---|---|---|---|---|---|---|---|---|
| A delay before the start of transmission of each data packet. | ms | 50 | ||||||
| If the timeout passes and no valid request comes, all stations on the line will go to a communication error. However, the values of output I/O tags will not be invalidated (as this is a server protocol). | mi:ss | 1:00 | ||||||
| If the value of the parameter is set to YES, the KOM process replies |
| with a SLAVE_DEVICE_FAILURE error to each request |
| that is sent to a non-existent station (a station with an unknown address). If the value is NO, the KOM process ignores this request and does not send a reply to it. | YES/NO | YES | ||||
|
| The switching time of Moxa redundant devices in case of a communication error or some problems. As this is a server protocol that waits for requests from external devices, a failure to receive a communication request for a longer time than the value of this parameter is considered to be an error. It is effective only for the SerialOverUDP Device Redundant line. | sec | 10 sec | |||||||
| Setting the TCP No Delay parameter to YES causes the low-level socket option TCP_NODELAY to be set, thus turning off the default packet coalesce feature. The parameter is implemented only for TCP/IP-TCP line. | YES/NO | NO | ||||||
| The parameter specifies the protocol behavior in redundancy for the TCP/IP-TCP line category if the KOM process is not active:
| Passive NoBind Passive Disconnect Passive Read | Passive NoBind |
| Kotva | ||||
|---|---|---|---|---|
|
...
- Communication protocol "Modbus Server".
- The station address is a decimal figure in the range of 1 up to 247. Address 0 is reserved for broadcast.
It is possible to configure more stations with different addresses on one line, ; the KOM process will reply on behalf of every configured station. See also the line protocol parameters parameters Single Server.
Station protocol parameters
...
| Parameter | Meaning | Unit | Default value | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Sets an address model of the MODBUS protocol: MODBUS PDU data are addressed from 0 up to 65535. MODBUS data Model data are addressed from 1 up to 65536. Note: MODBUS PDU is a default value. If the MODBUS data Model is set, the object with the address X is addressed as X-1 in the MODBUS PDU. After a change of this parameter, the KOM process must be restarted. | MODBUS PDU MODBUS data Model | MODBUS PDU |
...
Every address space is independent, providing 2-byte addressing, i.e., addresses from 0 up to 65535.
...
- The first optional character defines the type of I/O tag:
- I - Integer 16-bit
- U - Unsigned 16-bit (default)
- L - Unsigned long (4 bytes = 2 registers) - two registers with Address and Address+1 are read, unsigned, and transmitted as big-endian (see Note)
- Ll - Unsigned long (4 bytes = 2 registers) - two registers with Address and Address+1 are read and transmitted as little-endian, unsigned (see Note)
- S - Signed long (4 bytes = 2 registers) - two registers with Address and Address+1 are read, signed, and transmitted as big-endian (see Note)
- Sl - Signed long (4 bytes = 2 registers) - two registers with Address and Address+1 are read and transmitted as little-endian, signed (see Note)
- f - Float 32-bit (two registers) in big-endian format (bytes B4, B3, B2, B1 will be sent, B4 is the highest byte and B1 is the lowest byte of the float)
- F - Float 32-bit (two registers) in little-endian format (bytes B2, B1, B4, B3 will be sent, B4 is the highest byte and B1 is the lowest byte of the float)
- C - Request counter up (16-bit unsigned, which is incremented by every read request). Works only for Fn=3 or Fn=4
- D - Request counter down (16-bit unsigned, which is decremented by every read request). Works only for Fn=3 or Fn=4
Note: Request counter up/down can be used to configure a "watchdog" I/O tag to monitor the status and speed of Modbus communication.
- Parameter Fn is a function of the Modbus protocol for data reading, which inserts the I/O tag into the proper address space:
- 1 - Coils: binary statuses (for Modbus Server, these are digital output I/O tags)
- 2 - Discrete Inputs: binary inputs (for Modbus Server, these are digital output I/O tags)
- 3 - Holding Registers: status registers (for Modbus Server, these are integer/analog output I/O tags)
- 4 - Input Registers: input registers (for Modbus Server, these are integer/analog output I/O tags)
- Parameter Address is a 2-bytes byte address of a register in the range of 0 up to 65535.
- Parameter BitNr optionally specifies a bit of a register in the range of 0 up to 15.
Note: coexistence of an I/O tag without the BitNr parameter and multiple I/O tags with the BitNr parameter having the same Address is possible.
Implementation of the protocol supports the following functions (commands of the MODBUS Client for a D2000 KOM process):
- 1 - Read Coils: reading of binary status - KOM process sends values of I/O tags of Do type as a response to the Read Coils request.
- 2 - Read Discrete Inputs: reading of binary inputs - KOM process sends values of I/O tags of Do type as a response to the Read Discrete Inputs request.
- 3 - Read Holding Registers: reading of status registers - KOM process sends values of I/O tags of Co, Ao type (signed/unsigned) as a response to the Read Holding Registers request.
- 4 - Read Input Registers: reading of input registers - KOM process sends values of I/O tags of Co, Ao type (signed/unsigned) as a response to the Read Input Registers request.
- 5 - Write Single Coil: writing of binary statuses - KOM process writes a received binary value in the I/O tag of Di, Do type into the system as a response to the Write Single Coil request.
- 15 - Write Multiple Coils - KOM process writes all received binary values of the I/O tag of Di, Do type into the system as a response to the Write Multiple Coils request.
- 6 - Write Single Register: writing of status registers - KOM process writes the received value in the I/O tag of Ai, Ao, Ci, Co type into the system as a response to the Write Single Register request.
- 16 - Write Multiple registersRegisters: writing of multiple registers - KOM process writes all received values in the I/O tags of Ai, Ao, Ci, Co type into the system as a response to the Write Multiple Registers request.
- 22 - Mask Write Register: writing the register with the AND/OR mask - KOM process writes the received value in the I/O tag of Ai, Ao, Ci, Co type into the system as a response to the Mask Write Register request.
Note: This is a server-type of protocol that is primarily intended for sending the values out of the D2000 system. Therefore, the I/O tags should be configured as an output outputs (Ao, Co, Do) because of the manipulation of their values directly or by control objects. If the I/O tag is configured as input (Ai, Ci, Di), the KOM process is unable to send a valid value in a reply to reading by functions 1 - 4 until the value is written by functions 5, 15, 6, 16. or 22 from outside.
If the KOM process does not have the valid value of an I/O tag or a request to read a nonexistent I/O tag is received, an implicit value False or 0 is sent as a response to a read request (MODBUS protocol does not support the transfer of value quality). Protocol exceptions are not generated.
| Kotva | ||||
|---|---|---|---|---|
|
...