Using The Modbus Master Instructions - Siemens SIMATIC S7-200 System Manual

Programmable controller
Hide thumbs Also See for SIMATIC S7-200:
Table of Contents

Advertisement

Configuring the Symbol Table
After you enter an address for the first symbol, the table automatically calculates and assigns the
remainder of the symbols in the table.
You should assign a starting V location for the table which occupies 779 bytes. Be sure that the
assignment of the Modbus Slave symbols do not overlap with the V memory assigned to the
Modbus holding registers with the HoldStart and MaxHold parameters on the MBUS_INIT
instruction. If there is any overlap of the memory areas, the MBUS_INIT instruction returns an
error.

Using the Modbus Master Instructions

To use the Modbus Master instructions in your S7-200 program, follow these steps:
1.
Insert the MBUS_CTRL instruction in your program and execute the MBUS_CTRL on every
scan. You can use the MBUS_CTRL instruction either to initiate or to change the Modbus
communications parameters.
When you insert the MBUS_CTRL instruction, several hidden subroutines and interrupt
routines are automatically added to your program.
2.
Use the Library Memory command to assign a starting address for the V memory required
for Modbus Master Protocol instructions.
3.
Place one or more MBUS_MSG instructions in your program. You can add as many
MBUS_MSG instructions to your program as you require, but only one of these instructions
can be active at a time.
4.
Connect the communications cable between Port 0 on the S7-200 CPU (or Port 1 for the
Port 1 library), and the Modbus slave devices.
Caution
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.
The Modbus Master instructions use the Modbus functions shown below to read or write a specific
Modbus address. The Modbus slave device must support the Modbus function(s) required to read
or write a particular Modbus address.
Table 12-2
Required Modbus Slave Function Support
Modbus Address
00001 to 09999 discrete outputs
10001 to 19999 discrete inputs
30001 to 39999 input registers
40001 to 49999 holding registers
Using the Modbus Protocol Library
Read or Write
Modbus Slave Function Required
Read
Function 1
Write
Function 5 for a single output point
Function 15 for multiple output points
Read
Function 2
Write
Not possible
Read
Function 4
Write
Not possible
Read
Function 3
Write
Function 6 for a single register
Function 16 for multiple registers
Chapter 12
351

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents