Overview Modbus TCP Slave



With this function block a Modbus TCP slave function is implemented. Variables must always be connected to the inputs/outputs; internal connections are not possible. Inputs can be read by the Modbus master, outputs can be written.

The following function codes are supported:
  • FC 3: Read Holding Register (inputs)
  • FC 4: Read Input Register (inputs)
  • FC 6: Write single Register (outputs)
  • FC 16: Write multiple Register (outputs)
No Modbus ID needs to be specified; every ID is accepted because the addressing is already given by the IP address. Port is the standard port for Modbus TCP, 502.

For each variable / register one input/output is defined. As register address that of the first input/output / register is specified. The others result from the start address and register count.

Example 1: register address 100, register count 1. First input/output has address 100, second 101, third 102 etc.
Example 2: register address 100, register count 2. First input/output has address 100, second 102
, third 104 etc.

Only one data type can be defined per function block; all inputs/outputs have the same data type. The connected variables are then converted automatically and therefore do not have to match that of the register. If you want to define different data types, you can create several function blocks with different start addresses. 




Inputs

R1-x
Read
Inputs can be read with Function Code 3/4.

Outputs

R1-x
Write
Outputs can be written with Function Code 6/16.

Parameters

Number of IO
Number of inputs/outputs
Register data type
Data type register. Connected variables are converted accordingly.
Registers per variable
Number of registers per variable.
Register address
Start address for input/output 1.


See also common parameters of all function blocks.