TCW242-S_R1.0 – July 2021
Page 44
9.3.
MODBUS TCP/IP
Modbus protocol is a serial communications protocol originally published by Modicon in 1979. It is
used to establish master-slave/client-server communication between intelligent devices. Modbus is
often used to connect a supervisory computer with a remote terminal unit (RTU) in supervisory
control and data acquisition (SCADA) systems.
9.3.1.
Codes and answers
9.3.1.1.
Read Coil Status (FC=01)
Request
This command is requesting the ON/OFF status of discrete coils on address 100.
01 0064 0001
01: The Function Code 1 (read Coil Status)
0064: The Data Address of the coil to read ( 0064 hex = 100)
0001: The total number of coils requested. (01 hex = 1)
Response
01 01 01
01: The Function Code 1 (read Coil Status)
01: The number of data bytes to follow
01: 7 space holders & Coils 1 (0000 0001)
Due to the number of coils requested, the last data field
01
contains the status of
only 1 coil. The 7 most significant bits in this data field are filled in with zeroes. The
activated relay is 1.
9.3.1.2.
Force Single Coil (FC=05)
Request
This command is writing the contents of discrete on address 100 to ON.
05 0064 FF00
05: The Function Code 5 (Force Single Coil)
0064: The Data Address of the coil. ( 0064 hex = 100)
FF00: The status to write ( FF00 = ON, 0000 = OFF )
Response
The normal response is an echo of the query, returned after the coil has been written.
05 0064 FF00
05: The Function Code 5 (Force Single Coil)
0064: The Data Address of the coil. (0064 hex = 100)
FF00: The status written ( FF00 = ON, 0000 = OFF )
9.3.1.3.
Read Holding Registers (FC=03)
Request
This command is requesting the content of holding registers 400 – Channel 1 value.
03 0190 0002
03: The Function Code 3 (read Holding Registers)
0064: The Data Address of the first register requested (0190 hex = 400)
0002: The total number of registers requested. (read 2 registers each 2 bytes = 4
bytes)
Response
03 04 41 C3 B0 21
Содержание TCW242-S
Страница 1: ......
Страница 52: ...TCW242 S_R1 0 July 2021 Page 52 Appendix A Fig 1 Fig 2...