CPU 31x-2 as DP Master/DP Slave and Direct Communication
2-17
PLC S7-300, CPU Specifications CPU 312 IFM to CPU 318-2 DP
A5E00111190-01
Sample Program
Below you will see a small sample program for the exchange of data between DP
master and DP slave. The addresses used in the example are those from Table
2-5.
In the DP Slave CPU In the DP Master CPU
L2
TMB6
LEB0
TMB7
Data
pre-processing
in DP slave
LMW6
T PAW 310
Forward data to
DP master
L PEB 222
TMB50
L PEB 223
L B#16#3
+ I
TMB51
Further
processing of
received data in
the DP master
L10
+3
TMB60
Data Processing
in DP master
CALL SFC 15
LADDR:= W#16#0
RECORD:= P#M60.0 Byte
20
RET_VAL:= 22 MW
Send data to DP
slave
CALL SFC 14
LADDR:=W#16#D
RET_VAL:=MW 20
RECORD:=P#M30.0 Byte 20
Receive data
from DP master
LMB30
LMB7
+ I
T MW 100
Further
processing of
received data
Data Transfer in STOP Mode
The DP-Slave CPU goes into STOP: Data in the CPU’s transfer memory are
overwritten with “0”, that is, the DP Master reads “0”.
The DP Master goes into STOP: Current data in the CPU’s transfer memory are
retained and can still be fetched by the CPU.
PROFIBUS address
You cannot set the 126 as the PROFIBUS address for the CPU 31x-2.