Modbus Communication
Exchanges data with industrial equipment such as PLCs and sensors using the Modbus protocol. Modbus is an industrial protocol developed in 1979 for communication between automation devices; it is simple and reliable and is widely used across industries. Modbus items (RTU Master, RTU Slave, TCP Master, TCP Slave) are registered in Settings > Modbus (Part 6).
Modbus
Select the Modbus item to use. The fields below are displayed when the selected item is an RTU Master or TCP Master. A Slave has no settings of its own; it serves the Master's requests each time the action runs.
Master fields
Unit ID
Enter the Unit ID of the Slave to communicate with, from 1 to 247. The default is 1.
Response Timeout
Enter how long (duration) to wait for the Slave's response to a request. The default is 3 seconds; when the time is exceeded, the connection to the Slave is considered lost.
Function Code
Select the function code of the request. The default is FC1.
| Function Code | Description | Fields displayed |
|---|---|---|
| Read Coils (FC1) | Reads multiple digital output (coil) states | Read Offset, Read Length, Read Mapping (bit) |
| Read Discrete Inputs (FC2) | Reads multiple digital input states | Read Offset, Read Length, Read Mapping (bit) |
| Read Holding Registers (FC3) | Reads multiple holding registers | Read Offset, Read Length, Read Mapping (register) |
| Read Input Registers (FC4) | Reads multiple input registers | Read Offset, Read Length, Read Mapping (register) |
| Write Single Coil (FC5) | Writes one digital output (coil) state | Write Offset, Write Length, Write Mapping (bit) |
| Write Single Register (FC6) | Writes one register | Write Offset, Write Length, Write Mapping (register) |
| Write Multiple Coils (FC15) | Writes multiple digital output states | Write Offset, Write Length, Write Mapping (bit) |
| Write Multiple Registers (FC16) | Writes multiple registers | Write Offset, Write Length, Write Mapping (register) |
| Read/Write Multiple Registers (FC23) | Reads and writes multiple registers in one request | Both the Read and the Write Offset, Length, and Mapping (register) |
Read Offset, Read Length
Enter the start address of the Slave memory area to read (0 to 65535, default 0) and the number of items to read (1 to 256, default 8). Displayed only when Function Code is FC1, FC2, FC3, FC4, or FC23.
Read Mapping
Assign in the table the variables that receive the values read. The number of rows follows Read Length; FC1 and FC2 show a bit (digital) table, and FC3, FC4, and FC23 show a register table.
Write Offset, Write Length
Enter the start address of the Slave memory area to write (0 to 65535, default 0) and the number of items to write (1 to 256, default 8). Displayed only when Function Code is FC5, FC6, FC15, FC16, or FC23.
Write Mapping
Assign in the table the variables that hold the values to write. The number of rows follows Write Length; FC5 and FC15 show a bit (digital) table, and FC6, FC16, and FC23 show a register table.