Communication processor and Modbus TCP
13.5 Modbus communication
Parameter and type
ERROR
OUT
STATUS
OUT
Optional parameters for Modbus_Comm_Load (V 2.x or later). Click the arrow at the bottom of a LAD/FBD box to ex-
1
pand the box and include these parameters.
Modbus_Comm_Load is executed to configure a port for the Modbus RTU protocol. Once a
port is configured for the Modbus RTU protocol, it can only be used by either the
Modbus_Master or Modbus_Slave instructions.
One execution of Modbus_Comm_Load must be used to configure each communication port
that is used for Modbus communication. Assign a unique Modbus_Comm_Load instance DB
for each port that you use. You can install up to three communication modules (RS232 or
RS485) and one communication board (RS485) in the CPU. Call Modbus_Comm_Load from
a startup OB and execute it one time or use the first scan system flag (Page 110) to initiate
the call to execute it one time. Only execute Modbus_Comm_Load again if communication
parameters like baud rate or parity must change.
If you use the Modbus library with a module in a distributed rack, the Modbus_Comm_Load
instruction must be executed in a cyclical interrupt routine (for example, once per second or
once every 10 seconds). If power is lost to the distributed rack or the module is pulled, upon
restoration of module operation, only the HWConfig parameter set is sent to the PtP module.
All requests initiated by the Modbus_Master timeout, and the Modbus_Slave goes silent (no
response to any message). Cyclic execution of the Modbus_Comm_Load instruction
resolves these issues.
An instance data block is assigned for Modbus_Master or Modbus_Slave when you place
these instructions in your program. This instance data block is referenced when you specify
the MB_DB parameter for the Modbus_Comm_Load instruction.
1196
Data type
Description
Bool
The ERROR bit is TRUE for one scan, after the last request was termi-
nated with an error. The error code value at the STATUS parameter is
valid only during the single scan where ERROR = TRUE.
Word
Execution condition code
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK