Modbus Master| This
function block configures the Modbus master function.
The configuration is divided into slaves and
registers. A slave here means a Modbus ID;
several slaves can also use the same interface. If
several interfaces are configured, they are read out one after the
other. The function block is limited to 128 register rows; if more registers are needed, they can be split across several function blocks. Each register row occupies as many outputs as are set under "Block read count". Important: Variables must always be connected to the function blocks. When the variables are created, this happens automatically. Integrated device templates and troubleshooting tips are located at the end of this page; see Templates, Troubleshooting RTU (RS485) and Troubleshooting Modbus TCP. |
Parameters
|
|
| Disable | With this parameter the block is disabled and the registers are no longer queried. This can be used for diagnostics to temporarily hide certain registers. |
| Modbus ID |
Modbus ID (slave address) of the device, range 0 to 255. |
| Telegram interval | Minimal telegram interval. According to the Modbus specification the minimal telegram interval is 3.5 characters and at least 1.75 ms; this is too short for some devices. This parameter is added to the standard interval. |
| Timeout |
Time to wait for a response from the slave
before an error is detected. |
| Protocol |
Selection of the protocol
|
| Interface |
When the protocol Modbus RTU is selected,
the interface parameters are set here. Important: Via
USB converters only non-critical components may be used. Important: If several Modbus slaves are operated on one interface, all function blocks must have the same interface parameters. |
| IP
address, port |
When the protocol Modbus TCP is selected,
the IP address and the port are set here; the standard port
for Modbus is 502. |
| Register addresses | Here it can be set whether the register addresses start at 0 or 1. With "start at 1", 1 is subtracted from every register address entered before the telegram is sent. This allows the addresses to be entered exactly as they are listed in the description of the device. |
| Registers | Opens the list of registers. The same list is also opened with a right click on the block. The parameters of the list are described below. |
| Combine connections | Only with TCP. With this option devices with the same IP address and port number are read out via a shared connection. By default all function blocks are read out via separate connections. Combining connections can be necessary with devices that only allow a limited number of simultaneous connections. |
Register parameters
|
|
| The
list of registers is opened with the parameter "Registers" or with a
right click on the block. In the toolbar of the list, rows can be
added, deleted, moved and duplicated, "Template" loads the
configuration of an already integrated device and "Ex-Import"
exports the list to a file or imports it (see below). If "Register
hex" is selected, the register addresses are displayed and entered
in hexadecimal. |
|
| Active |
If this option is not selected, the register is neither queried nor written. |
| Name |
Designation of the register. The name is used when the variables
are created automatically. |
| Register address |
Register address according to the description of the slave.
Whether the count starts at 0 or at 1 is set with the parameter
"Register addresses". |
| Length |
Length of the variable in bits. A Modbus register is always
16 bits (2 bytes). The length therefore defines how many consecutive
registers are combined into one value:
For bit commands (coils, discrete inputs) this value is ignored. When writing registers, only 16 and 32 bits are transmitted. |
| Block read count |
Number of variables to be read with one
query (1 to 32). The variables must follow one another without gaps in
the slave and all have the same length; each variable occupies its own
output of the block. In this way "block read count" times "length"
registers are read with one telegram. When writing registers the number must be 1. For bit commands (coils, discrete inputs) this is the number of coils; with function code 15 the whole block is written with one telegram. |
| Register data type |
Selection between integer and float
according to the description of the slave. |
| Sign |
Only with data type integer: selection
between unsigned and signed. With 64 bits the value is always read as
signed. |
| Variable data type |
EIS type of the connected variable.
By default EIS 9 (floating point 4 bytes). See
common parameters for a
description of the EIS types. |
| Byte order |
|
| Function code |
Modbus function code according to the description of the slave:
01 read coils, 02 read discrete input, 03 read holding register,
04 read input register, 05 write single coil, 06 write single
register, 15 write multiple coils, 16 write multiple register. |
| Update variable on |
|
| Write on |
For write commands only:
|
| Factor |
Scaling factor between register and
connected variable. When reading the register value is
multiplied by the factor, when writing the
variable value is divided by the factor. This allows
the same factor to be used in both directions;
for example 0.001 converts W to kW when reading
and kW back to W when writing. Default value: 1. |
| Offset |
When reading, the offset is added after the multiplication with the
factor, for example to correct a temperature or meter value.
Note: Unlike the factor, the offset does not act symmetrically
in both directions, it is added when writing as well. For write
registers the offset should therefore remain 0. |
| Interval |
Interval at which the register is read out. For write commands only if "write on" is set to cyclic. With the value 0 the register is queried as fast as the interface allows. |
CSV Import / ExportVia the Ex-Import button in the toolbar of the register list all
configuration data can be exported and imported again. The format is
tab-separated (TSV), UTF-8 encoded. Lines beginning with
File structure:
# Protocol<TAB>IP-Address<TAB>Port<TAB>Node-ID<TAB>Register-Offset<TAB>Serial-Interface<TAB>Timeout(ms)<TAB>Telegram-Wait-Time(ms)<TAB>TCP-combine
{9 connection values}
# Active<TAB>Name<TAB>Register-Address<TAB>Length<TAB>Block-Count<TAB>Register-Data-Type<TAB>Sign<TAB>Variable-Data-Type<TAB>Byte-Order<TAB>Function-Code<TAB>Variable-Update<TAB>Write-On<TAB>Factor<TAB>Offset<TAB>Interval
{15 fields per register line}
...
|
|
Connection parameters (line 2, 9 fields) |
|
| Protocol | 0 = Modbus RTU (RS485) 1 = Modbus TCP |
| IP-Address | IP address of the slave (TCP only), e. g. 192.168.1.100. Leave empty for RTU. |
| Port | TCP port (TCP only), default 502. Leave empty for RTU. |
| Node-ID | Modbus slave ID, value range 0–255. |
| Register-Offset | 0 = register address starts at 0 1 = register address starts at 1 |
| Serial-Interface | Interface parameter string (RTU only), e. g. COM1,9600,8,N,1. Leave empty for TCP. |
| Timeout(ms) | Wait time for response in milliseconds, e. g. 1000. |
| Telegram-Wait-Time(ms) | Additional pause between telegrams in milliseconds, default 0. |
| TCP-combine | 0 = separate connections 1 = combine connections with the same IP |
Register parameters (from line 4, 15 fields per line) |
|
| Active | 0 = register disabled 1 = register active |
| Name | Designation of the register. No tab character allowed. |
| Register-Address | Modbus register address, value range 0–65535. |
| Length | Length of the variable: 1 = 16 bit (1 register)
2 = 32 bit (2 registers) 3 = 64 bit (4 registers) |
| Block-Count | Number of variables read with one query (1–32). For write commands the value must be 1. |
| Register-Data-Type | 0 = Integer 1 = Float |
| Sign | 0 = Unsigned 1 = Signed (only with data type integer) |
| Variable-Data-Type |
Index of the variable type:0 EIS 0: Constant1 EIS 1: Switch bit (bit)2 EIS 2: Dimming (4 bit)3 EIS 3: Time (3 bytes)4 EIS 4: Date (3 bytes)5 EIS 5: Floating point (2 bytes)6 EIS 6: Relative value 0–100% (1 byte)7 EIS 7: Drive control (bit)8 EIS 8: Forced control/priority (2 bit)9 EIS 9: Floating point (4 bytes) – most common use10 EIS 10: Counter value 16 bit (2 bytes)11 EIS 11: Counter value 32 bit (4 bytes)12 EIS 12: Access control (4 bytes)13 EIS 13: ASCII character (1 byte)14 EIS 14: Counter value (1 byte)15 EIS 15: Character string (14/255 bytes)16 EIS 16: Counter value (8 bytes)17 EIS 17: Floating point (8 bytes)
|
| Byte-Order |
0 = Big Endian (ABCD) – default1 = Mid-Little Endian (CDAB)2 = Little Endian (DCBA)
|
| Function-Code |
Real Modbus function code (not the index):1 = Read Coils2 = Read Discrete Input3 = Read Holding Register4 = Read Input Register5 = Write Single Coil6 = Write Single Register15 = Write Multiple Coils16 = Write Multiple Registers
|
| Variable-Update | 0 = only on change 1 = always (even without value change) |
| Write-On | 0 = change 1 = start + change 2 = cyclic |
| Factor | Scaling factor (decimal number), default 1. When reading, the register value is multiplied by the factor, when writing it is divided — the same value can therefore be used in both directions. Example: 0.001 to convert Wh to kWh when reading (and vice versa when writing). |
| Offset | Value added to the register value (decimal number), default 0. |
| Interval | Query interval in milliseconds. For write commands only relevant when Write-On = cyclic. |
Example CSV (Fronius inverter, Modbus TCP)# Protocol IP-Address Port Node-ID Register-Offset Serial-Interface Timeout(ms) Telegram-Wait-Time(ms) TCP-combine 1 192.168.1.100 502 1 0 1000 0 0 # Active Name Register-Address Length Block-Count Register-Data-Type Sign Variable-Data-Type Byte-Order Function-Code Variable-Update Write-On Factor Offset Interval 1 AC active power [W] 40092 2 1 1 0 9 0 3 0 0 1 0 5000 1 AC Lifetime Energy [kWh] 40102 2 1 1 0 9 0 3 0 0 0.001 0 60000 1 DC voltage [V] 40282 2 1 1 0 9 0 3 0 0 1 0 5000 |
|
Tip: Troubleshooting RTU (RS485)
|
|
| Error messages in the log | The runtime log (Diagnostics → Log) mainly
shows two messages for communication problems: RTU READ ERROR – no response, or no complete response, arrived within the configured timeout. This indicates a problem with the bus line (wiring, interface settings or missing termination) or that no device responds under this Modbus ID. RTU CRC ERROR – a response arrived, but its checksum is invalid. The telegram was corrupted, usually due to interference, a baud rate that is too high for the cable length or multiple devices transmitting at the same time. RTU ERROR messages mean that the device responded correctly but rejected the request. Common messages and causes are:
|
| A and B swapped | This is the most common cause of an RTU READ ERROR on newly wired devices. Since manufacturers do not label A and B consistently (A/B, +/-, D+/D-), swap the two wires on one device as a quick test. |
| Interface settings | Baud rate, data bits, parity and stop bits must exactly match the device. Otherwise no response or only an invalid response arrives, resulting in CRC or timeout errors. All slaves on the same interface must use the same interface settings. |
| Termination resistor | Longer RS485 cables need a termination resistor (typically 120 ohms) at both physical ends. Missing termination causes reflections and often appears as sporadic CRC or timeout errors that are not visible with a short test cable. |
| Duplicate Modbus ID | If two devices on the same bus have the same Modbus ID, both transmit simultaneously when queried. Their telegrams overlap and cause a CRC error or unusable response. Check every Modbus ID on the bus for uniqueness. |
| Troubleshooting procedure |
|
Tip: Troubleshooting Modbus TCP
|
|
| Error messages in the log | The runtime log (Diagnostics → Log) provides
an initial indication of the cause:
|
| Check address and port | Compare the IP address and port with the device configuration; the default port is 502. Check the subnet mask and gateway as required. A successful ping only confirms IP connectivity; Modbus TCP can still be disabled or blocked by a firewall. |
| Modbus TCP on the device | Many devices require Modbus TCP to be enabled explicitly. Some devices also restrict permitted clients or require a specific Modbus ID (Unit ID). With TCP-to-RTU gateways, this ID selects the RTU slave. |
| Connections and load | Some devices permit only one or a few simultaneous TCP connections. When several Modbus Master blocks use the same IP address, enable Combine connections. For sporadic errors, increase the query interval or timeout and reduce the number of registers queried at once. |
| Troubleshooting procedure |
|
Templates
|
|
| The following devices
are already integrated as templates. Others can be configured
manually. The template menu is grouped by device type; the topmost
entry Search opens a menu with a search field that finds all
templates regardless of their group. Inverters / batteries: Fronius Symo Gen 24 Float (TCP) Fronius Symo Gen 24 Float Battery (TCP) Fronius Symo Gen 24 Float Smart Meter (TCP) Fronius Verto Float (TCP) Fronius Verto Float Battery (TCP) Huawei (TCP) Huawei Battery (TCP) Huawei EMMA (TCP) Kostal PIKO IQ / PLENTICORE (TCP) Solaredge (TCP) Solaredge (TCP) + Smartmeter Solax (TCP) + Smartmeter Solax EMS1000 (TCP) Solax EMS1000 Inverter/Battery (TCP) Solax EMS1000 Control TRENE (TCP) SOFAR BTS-5K 10-10 (RTU) SOFAR BTS-5K 10-10 Battery (RTU) Sungrow SH15/20/25T (TCP) Wattsonic Gen3 (RTU) Wattsonic Gen3 Battery (RTU) Wenergy battery Star289 (TCP) Wallboxes: Wallbox KEBA KeContact P30 (TCP) Wallbox KEBA KeContact P40 / P40 Pro (TCP) Wallbox ABB Terra AC (TCP) Wallbox ABB Terra AC (RTU) Wallbox Siemens VersiCharge (TCP) Wallbox HAGER Witty Plus (TCP) Wallbox Alpitronic 150 (TCP) Heat pumps / boilers: Ochsner (RTU) Fröhling Lamdatronic 3200 (RTU) OEKOBOILER (RTU) KNV (TCP) NIBE S series (TCP) Templari Air conditioning: Samsung MIM-B19N (RTU) Energy meters: Energy meter SDM 630 (RTU) Energy meter DS100 (RTU) EMU Professional II (RTU) SINEAX AMx000 (TCP) Janitza UMG 604 (TCP) Weather stations: Weather station Thies (RTU) General: Victron Cerbo (TCP) SMARTFOX Pro (TCP) |
KEBA charging stations
|
|
| Supported devices |
|
| Connection | Protocol TCP, port 502, Modbus ID 255 and register address starting with 0. The charging station only knows function codes 3 (read) and 6 (write, single register). Only one register is transferred per request, so the number of registers per block stays at 1. Every read value is 4 bytes, hence a length of 32 bits; writing uses 16 bits. KEBA recommends more than 0.5 s between two read requests and more than 5 s between two write operations. |
| Do not read write registers | The registers from 5000 upwards are write only. If such a register is polled with function code 3, the charging station does not answer and the log continuously shows TCP ERROR READ 1 ... TIMEOUT. In the template these registers therefore use function code 6 and write on change; the polling interval has no meaning there. |
| Read registers (function code 3) |
|
| Write registers (function code 6) |
|
| Failsafe | So that the charging station does not keep charging with the last current given when the connection fails, a failsafe mode can be set. It only becomes active with a failsafe timeout greater than 0 in register 5018; the current in register 5016 alone is not enough. Every Modbus telegram received resets the timer – a read access as well. If it stays away, the charging station falls back to the failsafe current. To switch it off, 5018 is set to 0. In the templates these registers are present but not active. |
| Known deviation | On the P40 with a software version below 1.2.1 the registers 1036 and 1502 report the value in Wh instead of 0.1 Wh. In that case the factor of both registers has to be multiplied by ten. |