3 | Description Baumer
18 Operating Manual OX100 | V2
3.3.1 Modbus RTU
Modbus RTU is a standardized protocol, here based on a serial client/server communication via
RS485. Many PLCs support this protocol already in the state of delivery or allow for retrofit by
software module. For PC-based systems, libraries for different programming languages are
available. The standard is freely available on the website of the Modbus organisation. Visit
http://www.modbus.org
For information on Modbus TCP commissioning refer to Set up RS485 interface with Modbus
RTU [}31].
Mapping the sensor functionality on the Modbus data model
The functionality of the sensor can be accessed by reading or writing entries in the tables Dis-
crete Inputs, Input Registers, and holding registers. The following Modbus function codes
(FC) are supported:
n
Read Discrete Inputs (FC 02)
n
Read Input Registers (FC 04)
n
Read Holding Registers (FC 03)
n
Write Single Holding Register (FC 06)
n
Write Multiple Holding Registers (FC 16)
The following FC tables are independent of each other, so the same address may represent dif-
ferent functions in each table. Basically, Modbus registers are limited to 16bits. Therefore,
when reading or writing larger values, several registers must be taken into account for the re-
spective operation. Reading or writing only part of the specified address is not supported. Less
significant words are saved under the inferior address. Example:
n
Value (UInt32): 0x12345678
n
Register Address n: 0x5678
n
Register Address n+1: 0x1234
INFO
1 Modbus register corresponds to 2 bytes. If the data type of a sensor parameter is wider than a
2 byte Modbus register, the parameter is divided among several Modbus registers. The less sig-
nificant bits are located at the smaller address and the more significant bits at the larger ad-
dress (Little Endian).
In general, all registers enable write and read. Reading a register with write access only will re-
ply 0xFFFF.