Modbus Rtu Slave; Using The Modbus Rtu Slave Instructions - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

9.3.3

Modbus RTU slave

9.3.3.1

Using the Modbus RTU slave instructions

Procedure
To use the Modbus slave instructions in your S7-200 SMART program, follow these steps:
1. Insert the MBUS_INIT instruction in your program and execute the MBUS_INIT instruction
for one scan only. You can use the MBUS_INIT instruction either to initiate or to change
the communications parameters. When you insert the MBUS_INIT instruction, several
hidden subroutines and interrupt routines are automatically added to your program.
2. Click the Memory button
assign a starting address for the V memory that the Modbus library requires. Alternatively,
you can right-click the Program Block node in the project tree and select "Library
Memory" from the context menu. In addition to this V memory block, you define another V
memory block with the HoldStart and MaxHold parameters of MBUS_INIT. Be careful that
your program assignments in V memory do not overlap. If there is any overlap of the
memory areas, the MBUS_INIT instruction returns an error.
3. Place only one MBUS_SLAVE instruction in your program. This instruction should be
called every scan to service any requests that have been received.
4. Connect a communications cable between the S7-200 SMART CPU port you assigned
with the MBUS_INIT port parameter and the Modbus master device.
The accumulators (AC0, AC1, AC2, AC3) are used by the Modbus slave instructions and
appear in the Cross Reference listing. Prior to execution, the values in the accumulators of a
Modbus slave instruction are saved and restored to the accumulators before the Modbus
slave instruction is complete, ensuring that all user data in the accumulators is preserved
while executing a Modbus slave instruction.
S7-200 SMART
System Manual, V2.3, 07/2017, A5E03822230-AF
NOTICE
Avoiding unwanted current flow
Interconnecting equipment with different reference potentials can cause unwanted
currents to flow through the interconnecting cable. These unwanted currents can cause
communications errors or damage equipment.
Ensure that all equipment that is connected with a communications cable either shares
a common circuit reference or is isolated to prevent unwanted current flows.
from the Libraries area of the File menu ribbon strip to
Libraries
9.3 Modbus RTU library
489

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-200 smart

Table of Contents