Commissioning
8.5 Commissioning PROFIBUS DP
S7-300, CPU 31xC and CPU 31x: Installation
Operating Instructions, Edition 08/2004, A5E00105492-05
8-31
Sample program
Below you will see a small sample program for data exchange between DP master and DP
slave. The addresses used in the example are found in the table above.
In the DP slave CPU In the DP master CPU
L 2
T MB 6
L IB 0
//Data preparation in DP slave
T MB 7
L MW 6
T PQW 310
// Forward data to DP master
L PIB 222
T MB 50
L PIB 223
//continued processing
of//received data in DP
master
L B#16#3
+ I
T MB 51
L 10 //Data preparation in DP
master
+ 3
T MB 60
CALL SFC 15 //Send data to
//DP slave
LADDR:= W#16#0
RECORD:= P#M60.0 Byte 20
RET_VAL:=MW 22
CALL SFC 14
LADDR:=W#16#D
//Receive data from
//DP master
RET_VAL:=MW 20
RECORD:=P#M30.0 byte 20
L MB 30
L MB 7
+ I
//Received
data//continue
processing
T MW 100