Communication processor and Modbus TCP
13.5 Modbus communication
● It is recommended that you call all Modbus_Master execution for a given port from a
program cycle OB. Modbus_Master instructions may execute in only one of the program
cycle or cyclic/time delay execution levels. They must not execute in both execution
priority levels. Pre-emption of a Modbus_Master instruction by another Modbus_Master
instruction in a higher priority execution priority level will result in improper operation.
Modbus_Master instructions must not execute in the startup, diagnostic or time error
execution priority levels.
● Once a Modbus_Master instruction initiates a transmission, this instance must be
continually executed with the EN input enabled until a DONE=1 state or ERROR=1 state
is returned. A particular Modbus_Master instance is considered active until one of these
two events occurs. While the original instance is active, any call to any other instance
with the REQ input enabled will result in an error. If the continuous execution of the
original instance stops, the request state remains active for a period of time specified by
the static variable "Blocked_Proc_Timeout". Once this period of time expires, the next
Modbus_Master instruction called with an enabled REQ input will become the active
instance. This prevents a single Modbus_Master instance from monopolizing or locking
access to a port. If the original active instance is not enabled within the period of time
specified by the static variable "Blocked_Proc_Timeout", then the next execution by this
instance (with REQ not set) will clear the active state. If (REQ is set), then this execution
initiates a new Modbus_Master request as if no other instance was active.
REQ parameter
0 = No request; 1 = Request to transmit data to Modbus Slave
You may control this input either through the use of a level or edge triggered contact.
Whenever this input is enabled, a state machine is started to ensure that no other
Modbus_Master using the same instance DB is allowed to issue a request, until the current
request is completed. All other input states are captured and held internally for the current
request, until the response is received or an error detected.
If the same instance of Modbus_Master is executed again with REQ input = 1 before the
completion of the current request, then no subsequent transmissions are made. However,
when the request is completed, a new request is issued whenever a Modbus_Master is
executed again with REQ input = 1.
1200
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK