P30
Overview
Modbus TCP Programmers Guide V1.02
8
© KEBA
2
Overview
Modbus TCP is a standardized communication protocol that enables data
exchange between a master (usually a computer) and several slaves (charg-
ing stations). It is part of the IEC 61158 standard. The Modbus protocol en-
ables control of the connected slaves and transmission of measurement
data from the slave to the master. The data are sent via TCP/IP.
When communicating via Modbus TCP with a KeContact Product, the follow-
ing applies:
●
Each participant must have a unique address, address 0 is reserved for
the broadcast. Each participant can send messages via the bus. Com-
munication is usually initiated by the master and the addressed slave
replies. Modbus TCP is intended for transmission via Ethernet, for which
TCP port 502 is reserved. The Unit ID must be set to 255.
●
Supported function codes are FC3 (Read) and FC6 (Write).
●
Starting register address count is 0. Depending on the used implementa-
tion, +1 might have to be added to adress the right register.
●
It is not possible to read several registers at once. The maximum read-
ing length is 2 words, as the return values for a single register are
UINT32.
●
The recommended timing invervals for reading registers is >0.5 sec. For
data, which does not change on a frequent basis, higher intervalls are
recommended. The recommended timing intervall for writing registers is
>5 sec, to avoid stressing of the charging station.
Frame
When sending a Modbus TCP frame, the frame is split into 6 different sec-
tions:
The TCP message starts with a transaction identifier. This is followed by the
protocol identifier (0000) and the number of the following bytes. The address
and the function field are followed by the data, which varies in size depend-
ing on the length of the message. The registers must be sent in decimal for-
mat (e.g. charging state - register 1000).
The following attributes are available:
●
ro ... read only
●
wo ... write only
Name
Length
Description
Transaction ID
2 bytes
For synch between messages of server and client
Protocol ID
2 bytes
0 for Modbus TCP
Length field
2 bytes
Number of remaining bytes in this frame
Unit ID
1 byte
Slave address (must be 255)
Function code
1 byte
FC3 (Read), FC6 (Write)
Data
[n] bytes
Data as response or commands