Entry type: FAQ, Entry ID: 747743, Entry date: 10/21/2009
(0)
Rate

How does data communication work between S7-300/S7- 400 and S7-200 via MPI using S7 basic communication?

  • Entry
  • Associated product(s)

Description:
You can access various S7-200 CPUs from the S7-300 / 400 using X_PUT / X_GET via MPI. Here, the S7-300 / S7-400 is the master and the S7-200 the slave.


Fig. 01

With S7-200 CPUs of the CPU 22x series, you can work with the baud rates 19.2kBd and 187.5kBd.

Refer to the technical data of the CPUs concerned for the transfer rates supported by your S7-300 / S7-400 CPU at the MPI interface.

The manual with the technical data of the S7-300 CPUs is available in Entry ID: 12996906

The manuals with the technical data of the S7-400 CPUs is available in the following Entry IDs:

The table below gives you information about the maximum number of connections available for S7 basic communication in the S7-300 CPUs.
 

CPU

Max. number of connections for
S7 basic communication

CPU 312, CPU 312C 2
CPU 313 4
CPU 313C, CPU 313C-2DP, CPU 313C-2PtP 4
CPU 314 8
CPU 314C-2DP, CPU 314C-2PtP 8
CPU 315 8
CPU 315-2DP, CPU 315F-2DP 12
CPU 315-2PN/DP, CPU 315F-2PN/DP 14
CPU 316 8
CPU 316-2DP 8
CPU 317-2DP, CPU 317F-2DP 30
CPU 317-2PN/DP, CPU 317F-2PN/DP 30
CPU 318-2DP 30
CPU 319-3PN/DP, CPU 319F-3PN/DP 30
CPU 614 8

The table below gives you information about the maximum number of connections available for S7 basic communication in the S7-400 CPUs.
 

CPU

Max. number of connections for
S7 basic communication

CPU 412-1 < FW V5.0

14

CPU 412-1 from FW V5.0

30

CPU 412-2DP < FW V5.0

14

CPU 412-2DP from FW V5.0

30

CPU 413-1

14

CPU 413-2DP

14

CPU 414-1

30

CPU 414-2DP

30

CPU 414-3DP

30

CPU 414-3PN/DP

30

CPU 416-1

42

CPU 416-2DP, CPU 416F-2DP

42

CPU 416-3DP

42

CPU 416-3PN/DP, CPU 416F-3PN/DP

42

CPU 417-4

42

Requirements for the S7-200 CPU:

  • Set the address of the S7-200 CPU.

  • Put the data to be sent into the relevant Send buffer or get the received data from the Receive buffer.

  • You define the Send and Receive buffers in STEP 7 when parameterizing the system functions SFC67 "X_PUT" and SFC68 "X_GET".

  • Refer to the notes on networking CPUs in the S7-200 system manual in Entry ID: 1109582.

Reading data from the S7-200 CPU with the system function SFC67 "X_GET"
You use the system function SFC67 "X_GET" for reading data from the S7-200 CPU. You call this in the OB1 of the S7-300 / S7-400, for example.

In this example, 10 bytes are read as from address 10 from the variable area of the S7-200 CPU. The 10 bytes of data received are stored in data block DB10 as from address 10 in the S7-300/S7-400.

The following table gives an overview of the input parameters of the system function SFC67 "X_GET".
 

Input parameter Variable Description
REQ M0.1 The input parameter REQ (request to activate) is a level-triggered control parameter.
A positive level at M0.1 of the S7-300 / S7-400 starts reading of the data from the S7-200.
CONT FALSE The input parameter CONT (continue) is a control parameter that determines whether or not the connection to the communication partner remains established upon completion of the job.

CONT=0: connection is cleared down after completion of data transfer.
CONT=1: connection remains established after completion of data transfer.

DEST_ID W#16#4 MPI address of the S7-200 CPU
VAR_ADDR P#DB1.DBX 10.0 BYTE 10 Reference to the area to be read in the partner CPU.
10 bytes of data are read as from address 10 from the variable area (VB) of the S7-200.

The following table gives an overview of the output parameters of the system function SFC67 "X_GET".
 

Output parameter Variable Description
RET_VAL MW 2 If an error occurs during processing of the function, the return value includes the relevant error code.

If no error occurs, the RET_VAL contains the length of data block copied into the receive area RD as a positive number in bytes.

BUSY M12.1 BUSY=1: The receive procedure has not yet finished.
BUSY=0: The receive procedure has been completed or no receive procedure is active.
RD P#DB10.DBX 10.0 BYTE 10 Reference to the receive data area.
The following data types are permitted:
BOOL, BYTE, WORD, DWORD, and arrays of these data types except BOOL.
The receive area RD must be at least as long as the read area VAR_ADDR of the communication partner.
In addition, the data types of RD and VAR_ADDR must match.

Writing data to the S7-200 CPU with the system function SFC68 "X_PUT"
You use the system function SFC68 "X_PUT" for writing data to the S7-200 CPU. You call this in the OB1 of the S7-300 / S7-400, for example.

In this example, 10 bytes are written as from address 10 to the variable area of the S7-200 CPU. The 10 bytes of data sent are stored in data block DB10 as from address 20 in the S7-300/S7-400.

The following table gives an overview of the input parameters of the system function SFC68 "X_PUT".
 

Input
parameter

Variable

Description

REQ

M100.1

The input parameter REQ (request to activate) is a level-triggered control parameter.
A positive level at M100.1 of the S7-300 / S7-400 starts writing of the data to the S7-200.

CONT

FALSE

The input parameter CONT (continue) is a control parameter that determines whether or not the connection to the communication partner remains established upon completion of the job.

CONT=0: connection is cleared down after completion of data transfer.
CONT=1: connection remains established after completion of data transfer.

DEST_ID

W#16#4

MPI address of the S7-200 CPU

VAR_ADDR

P#DB1.DBX 20.0 BYTE 10

Reference to the area to be written to in the partner CPU.
10 bytes of data are written as from address 20 to the variable area (VB) of the S7-200.

The following table gives an overview of the output parameters of the system function SFC68 "X_PUT".
 

Output
parameter
Variable Description
SD P#DB10.DBX 20.0 BYTE 10 Reference to the area in your own CPU that contains the data to be sent.
The following data types are permitted:
BOOL, BYTE, WORD, DWORD, and arrays of these data types except BOOL.
SD must have the same length as the VAR_ADDR parameter of the communication partner. In addition, the data types of SD and VAR_ADDR must match.
RET_VAL MW102 If an error occurs during processing of the function, the return value includes the relevant error code.
BUSY M112.1 BUSY=1: The send procedure has not yet finished.
BUSY=0: The send procedure has been completed or no send procedure is active.

More information on the system functions SFC67 "X_GET" and SFC68 "X_PUT" is available in Entry ID: 1214574.

A sample program for parameterizing the system functions SFC67 "X_GET" and SFC68 "X_PUT" is attached for downloading.

The sample program is a STEP 7 project that contains the complete hardware configuration including the user program of an S7-300 station. The STEP 7 project is available for downloading as a ZIP file.
Extract the "S7_basic_communication.zip" file into a separate directory. The STEP 7 project is unpacked automatically with all its subdirectories. You can then use the SIMATIC Manager to open and process the extracted STEP 7 project.

S7_basic_communication.zip ( 412 KB )

Note:
Set the S7-300/S7-400 control to STOP mode before loading the block that calls the system functions SFC67 "X_GET" and SFC68 "X_PUT" into the controller. This ensures that the system functions SFC67 "X_GET" and SFC68 "X_PUT" are initialized in any case and the data is transferred.

If you need faster data transmission, use PROFIBUS DP instead of S7 basic communication via MPI. PROFIBUS DP is not connection-oriented communication.
If you use PROFIBUS DP, then you need a PROFIBUS expansion module EM 277 in the S7-200. Detailed information on the expansion module EM 277 is available in the S7-200 system manual in Entry ID 1109582.

Error details
Detailed error description
Help us to improve Online Support.
The page requested cannot be displayed. Please contact the webmaster.
Contact to webmaster