Siemens SIMATIC S7 System Manual page 201

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

Parameter
ERROR
STATUS
Modbus slave communication rules
● MB_COMM_LOAD must be executed to configure a port, before a MB_SLAVE instruction
● If a port is to respond as a slave to a Modbus master, then that port cannot be used by
● The Modbus instructions do not use communication interrupt events to control the
● The MB_SLAVE must execute periodically at a rate that allows it to make a timely
● You should call MB_SLAVE every scan from a program cycle OB.
Operation
MB_SLAVE must be executed periodically to receive each request from the Modbus master
and then respond as required. The frequency of execution for MB_SLAVE is dependent
upon the response timeout period of the Modbus master. This is illustrated in the following
diagram.
The response timeout period is the amount of time a Modbus master waits for the start of a
response from a Modbus slave. This time period is not defined by the Modbus protocol, but
is a parameter of each Modbus master. The frequency of execution (time between one
execution and the next execution) of MB_SLAVE must be based on the particular
parameters of your Modbus master. At a minimum, you should execute MB_SLAVE twice
within the response timeout period of the Modbus master.
MB_HOLD_REG parameter examples
MB_HOLD_REG is a pointer to the Modbus holding register Data block. This DB is used to
hold data values that a Modbus master is allowed to access (read or write). You must create
S7-1200 Programmable controller
System Manual, 11/2009, A5E02486680-02
Parameter
type
OUT
OUT
can communicate with that port.
MB_MASTER. Only one instance of MB_SLAVE execution can be used with a given port.
communication process. Your program must control the communication process by
polling the MB_SLAVE instruction for transmit and receive complete conditions.
response to incoming requests from a Modbus master.
Data type
Description
BOOL
Error:
0 – No error detected
1 – Indicates that an error was detected and the
error code supplied at parameter STATUS is
valid.
WORD
Error code
Programming instructions
6.3 Global library instructions
201

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-1200

Table of Contents