User Manual

EMpro - multi-functional energy measuring devices for front panel installation
140 / 192
PHOENIX CONTACT 108904_en_00
11.2.3 Modbus/TCP
In the case of Modbus/TCP, a special header (Modbus Application Header [MBAP]) is pre-
fixed to the Modbus message. This Modbus/TCP message is then transmitted via an IP-
based network in a TCP frame.
The EMpro acts as Modbus/TCP server and opens port 502 for communication with any
Modbus/TCP clients. This port cannot be configured by the user.
Since TCP is a connection-oriented protocol, a client first has to establish a TCP connection
with the EMpro to exchange data via Modbus/TCP.
The number of Modbus/TCP connections that can be open in parallel on each version of the
EMpro product family is limited to four.
If there are already four open Modbus/TCP connections on the EMpro, additional connec-
tion queries on port 502 are rejected.
Additionally, to enable Modbus/TCP communication, the user has to make sure that this
port is enabled in the network.
The MBAP contains a field that is declared as unit identifier in the specification. This unit
identifier is comparable with the device address of Modbus/RTU. However, it is not relevant
for the EMpro in the case of Modbus/TCP and is ignored by the device since through its IP
address the device already has a unique address in a network . An exception applies if the
device is operated in gateway mode (see Section “Modbus gateway” on page 140).
The Modbus TCP specification recommends using 255 as unit identifier for queries.
All EMpro versions support the Modbus TCP protocol.
11.2.4 Modbus gateway
EMpro versions with an RS-485 interface can optionally be operated in gateway mode.
By default upon delivery, the gateway mode is not active. In this case, the device acts as
Modbus TCP server on the Ethernet interface and as Modbus/RTU slave on the RS-485 in-
terface.
When the gateway function is activated, the device behaves as Modbus gateway on the
Ethernet interface and, in parallel, continues to operate as Modbus TCP server (can be
reached via unit identifier == 255).
On the RS-485 interface, the device now acts as Modbus/RTU master. As master, the
EMpro can now independently send queries in the network (note: there must be no other
master in the system).
As Modbus gateway, the device converts an incoming Modbus TCP message (that does
not have the unit identifier 255 in the MBAP header) into a Modbus RTU message and for-
wards it to the appropriate receiver in the Modbus RTU network. On the TCP side, the unit
identifier is used for addressing the Modbus RTU receiver. In turn, the response is con-
verted from Modbus/RTU format back to Modbus/TCP format and is sent to the querying cli-
ent as Modbus/TCP response.
Broadcast messages in gateway mode
The Modbus specification does not describe the behavior of a gateway device when the unit
identifier in the MBAP header has a value of 0. In the Modbus/RTU network, this value rep-
resents a broadcast message.
There are different interpretations of the behavior of a gateway in this case.