Libraries
9.3 Modbus RTU library
S7-200 SMART
480 System Manual, V2.3, 07/2017, A5E03822230-AF
To use the Modbus RTU master instructions in your S7-200 SMART program, follow these
steps:
1. Insert the MBUS_CTRL / MB_CTRL2 instruction in your program and execute it on every
scan. You can use the MBUS_CTRL / MB_CTRL2 instruction either to initiate or to
change the Modbus communications parameters. When you insert the MBUS_CTRL /
MB_CTRL2 instruction, STEP 7-Micro/WIN SMART adds several protected subroutines
and interrupt routines to your program.
2. Click the Memory button
from the Libraries area of the File menu ribbon strip to
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.
3. Place one or more MBUS_MSG / MB_MSG2 instructions in your program. You can add
as many MBUS_MSG / MB_MSG2 instructions to your program as you require, but only
one of these instructions can be active at a time.
4. Connect a communications cable between the S7-200 SMART CPU port you assigned
with the MBUS_CTRL / MB_CTRL2 port parameter and the Modbus slave device.
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 you connect all equipment that with a communications cable that either
shares a common circuit reference or is isolated to prevent unwanted current flows.