en_BA_OXH7_PosCon_TCP_IP.docx
53/98
Baumer Electric AG
Friday, June 15, 2018 12:44:11 PM/tof V1.0 ANW_81184815
Frauenfeld, Switzerland
4.2 Modbus TCP
Modbus TCP is a protocol with a long history which is supported by a large number of programmable logic
controllers as standard or which can easily be retrofitted using a software module. Libraries for various
programming languages are available for PC-based systems. The standard is freely available on the website
of the Modbus Organization (
http://www.modbus.org
).
4.2.1
Protocol parameters
The Modbus TCP server integrated in the sensor (Modbus TCP slave) can be addressed using the following
parameters:
•
TCP port no.: 502
•
Modbus TCP unit identifier: 1
4.2.2
Mapping the sensor functionality to the Modbus data model
The sensor functionality can be accessed by reading or writing entries in the "Discrete inputs", "Input
registers", and "Holding registers" tables. The following Modbus function codes (FC) are supported here:
•
Read Discrete Inputs (FC 02)
•
Read Input Registers (FC 04)
•
Read Holding Registers (FC 03)
•
Write Single Holding Register (FC 06)
•
Write Multiple Holding Registers (FC 16)
The three tables are independent of one another, meaning that the same address can represent a different
functionality in the different tables. The number of the register to be read or written with a Modbus command
must match the length specified for the respective sensor functionality. It is not possible to read or write just
some of the parameters.
If the data type of a sensor parameter is wider than a 16-bit Modbus register, the parameter is split across
several Modbus registers. In such cases, the lower-value bits are placed on the lower address and the higher-
value bits on the higher address.