EtherCAT to Modbus RTU Gateway
Copyright © 2017 ICP DAS CO., Ltd. All Rights Reserved.
-
37 -
Net ID (Station Number)
The first byte in the message structure of Modbus is the receiver’s address. The valid addresses are
in the range of 0 to 247. Addresses 0 is used for broadcast, while addresses 1 to 247 are given to
individual Modbus devices.
Function Code
The second byte in the frame structure of the Modbus RTU is the function code. The function code
describes what the slave is required to do. Valid function codes are between 1 and 255. The slave
uses the same function code as the request to answer it. Only when an error occurs in the system
will the highest bit of the function code is set to ‘1’. Hence the master will know whether the
message has been transmitted correctly or not.
Code
Function
Reference (Address)
01 (0x01)
Read the Status of the Coils (Readback DOs)
0xxxx
02 (0x02)
Read the Status of the Input(Reads DIs)
1xxxx
03 (0x03)
Read the Holding Registers (Readback AOs)
4xxxx
04 (0x04)
Read the Input Registers (Reads AIs)
3xxxx
05 (0x05)
Force a Single Coil (Writes DO)
0xxxx
06 (0x06)
Preset a Single Register (Writes AO)
4xxxx
15 (0x0F)
Force Multiple Coils (Writes DOs)
0xxxx
16 (0x10)
Preset Multiple Registers (Writes AOs)
4xxxx