6.4 Modbus service mapping

The Modbus devices can accept either read or write requests from the Master. The operation to be executed is identified from the function code of a Modbus message. Therefore, the IPE needs to be able to map the oneM2M messages to Modbus messages with the appropriate function code. The function code is identified from register type of the register to be read for the read requests and from a tuple of register type and number of registers to be written (length) for the write requests.

For the read requests, the IPE shall map the register type of the register to be read to the function code according to Table 6.4-1. For the write requests, the IPE shall map the tuple of register type and the number of registers to be written (length) to the function code according to Table 6.4-2. Both the register type and the length along with other Modbus data needed to construct the Modbus message can be retrieved from the nodnProperties customAttribute of a <flexContainer> specialization derived from a ModuleClass.

Table 6.4-1: Register type to function code mapping for Modbus read request

Register type Function code
Coil 01
Discrete input 02
Holding register 03
Input register 04

Table 6.4-2: Register type and length to function code mapping for Modbus write request

Register type Length > 1 Function code
Coil false 05
Coil true 0F
Holding register false 06
Holding register true 10