Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
SITRAIN
IK-PBSYS / Intelligent Slaves Page 1 03/2007
Siemens AG 2007 - Subject to change without prior notice
Contents Page
Example of application for intelligent slaves (I slave) ......................................................................... 2
Transfer memory in the CPU of the I slave ....................................................................................... 3
Transfer area configuration (example) .............................................................................................. 4
Configuring a bus connection for an I slave ...................................................................................... 5
Setting the "DP slave" operating mode ............................................................................................. 6
Configuring I/O data areas of the slave ............................................................................................. 7
Example of an output area ................................................................................................................ 8
Example of an input area .................................................................................................................. 9
Coupling an I slave to the DP master system .................................................................................... 10
Configuring I/O data areas of the master .......................................................................................... 11
Result of coupling the I slave ............................................................................................................ 12
S7 program (DP master and I slave) ................................................................................................. 13
Consistent data exchange (> 4 bytes) .............................................................................................. 14
Application of system function SFC 15 ............................................................................................. 15
Application of system function SFC 14 ............................................................................................. 16
Task description for exercises with I slave ....................................................................................... 17
Exercise 1 : Configure the I slave .................................................................................................... 18
Exercise 2 : Connect the I slave ....................................................................................................... 19
Exercise 3 : Download S7 programs ................................................................................................. 20
If you want to know more .................................................................................................................. 21
Direct data exchange (slave-to-slave communication) ..................................................................... 22
Address assignments ....................................................................................................................... 23
Exercise 4 : Configure a direct data exchange .................................................................................. 24
Exercise 5 : S7 program in the I-slave .............................................................................................. 25
Autonomous PLC
with DP interface
SITRAIN
IK-PBSYS / Intelligent Slaves Page 2 03/2007
Siemens AG 2007 - Subject to change without prior notice
Area of application Automation tasks can be broken down into subtasks which are controlled by a
higher-level automation system.
These control jobs, which can be executed independently and efficiently, are
preprocessed by an independent CPU. Since the entire control program is broken
down into smaller units, this task can generally be handled by a smaller PLC. The
concept of "local logic" is therefore an core principle of systems with "intelligent
slaves" (I slaves).
Preconditions The only requirement is that the PLC designated as the DP slave must have a
PROFIBUS connection which can function as the DP slave.
With the current product versions, this means all internal DP interfaces on the 300
and 400 CPU models, plus the communications processors for PROFIBUS DP in
the S7-300 and S7-400 ranges, i.e. the same interfaces which are used as DP
masters. Whether any of the specified modules can function as a DP master or a
DP slave is determined solely by how it is configured. Please note, however, that
a module can only ever work as either a master or a slave.
IO data areas The I slave uses its IO area to exchange data with the DP master. The only
important point to note when configuring these areas is that you must not use any
addresses that have already been assigned for use by the central IOs.
As these areas can be very large for I slaves (as compared to compact slaves), it
is also important to observe the specified limit of 244 bytes. This is the maximum
possible quantity of data which can be transferred in a PROFIBUS message
frame.
Whether the addresses are inside or outside the process images is subject to the
same rules/principles which apply to the central IOs.
Transfer memory in
IO address space of
the I slave
SITRAIN
IK-PBSYS / Intelligent Slaves Page 3 03/2007
Siemens AG 2007 - Subject to change without prior notice
Master view A key feature of an intelligent DP slave is that its input/output data are not
supplied directly via a real input/output to the DP master, but that the master
accesses them on a preprocessing CPU.
From the viewpoint of the DP master, an I slave behaves in exactly the same way
as a simple slave, i.e. as a "terminal" with a prespecified number of IOs. In
contrast to the simple slave this number does not however depend on the
hardware of the slave but on the configuration (restrictions due to the message
frame structure (244 bytes)).
Standard slave With a "normal" DP slave such as a compact (ET 200B) or modular (ET 200M)
DP slave, the DP master accesses the distributed inputs/outputs directly.
I slave With an intelligent DP slave, the DP master does not access the connected
inputs/outputs of the intelligent DP slave, but it accesses instead a transfer area
in the input/output address area of the "preprocessing CPU.
The user program of the preprocessing CPU must handle the data exchange
between the operand area and the inputs/outputs.
SITRAIN
IK-PBSYS / Intelligent Slaves Page 4 03/2007
Siemens AG 2007 - Subject to change without prior notice
Rules Please note the following rules when configuring the transfer memory:
Assignment of address areas:
Input data of the DP slave are always output data of the DP master.
Output data of the DP slave are always input data of the DP master.
You can freely assign addresses.
You use load/transfer commands or SFCs 14 and 15 to access the data in the
user program. As regards data consistency, the same rules apply as to the DP
master interface.
Diagnostic address
applies only to
DP master
SITRAIN
IK-PBSYS / Intelligent Slaves Page 5 03/2007
Siemens AG 2007 - Subject to change without prior notice
Configuring sequence
An I slave is always configured on a DP master system in two predefined steps
which must be performed in a specific order.
Step 1 As an I slave is essentially a complete PLC, it is not available for selection like
other slaves in the module catalog of HW Config. It would be impossible to create
a GSD file that would fully describe this slave.
Instead, this S7 station must be configured first in step 1. It is then "attached" to
the master system in step 2.
The most important DP slave configuring settings are listed below:
Note Even though you can still alter these areas in configuring step 2, you must specify
at least one area (I or O) in step 1.
DP slave mode
with test functions, etc.
Diagnostic address
for DP slave
SITRAIN
IK-PBSYS / Intelligent Slaves Page 6 03/2007
Siemens AG 2007 - Subject to change without prior notice
Operating mode The operating mode of the DP slave is activated on this tab, i.e. this module is no
longer a DP master (default), but a DP slave.
The "Test, Commissioning, Routing" box must be checked whenever this DP
interface is used to handle S7 online functions to the CPU, i.e. the CPU of this
station is not accessed online via the MPI, but via PROFIBUS instead. The same
applies if this station is to function as a router to another subnet.
If the box is not checked, the interface remains passive on the PROFIBUS which
means that data are exchanged only with the configured DP master. The interface
cannot then handle online functions or act as a router.
Diagnostic address The diagnostic address must be outside the space designated for IO addresses.
The diagnostic address is used internally to transfer diagnostic information from
the DP master to the DP slave.
Additional information (e.g. operating state transitions by the master or process
alarms from the master) is passed from the master to the slave in DPV1 mode via
the address set in "Address for slot 2".
The default settings can be accepted in most cases.
Configuring
IO areas
SITRAIN
IK-PBSYS / Intelligent Slaves Page 7 03/2007
Siemens AG 2007 - Subject to change without prior notice
Configuration The address areas for the data exchange with the DP master are configured on
this tab. Up to 32 so-called areas can be defined. These are input and output
areas and each can have a maximum length of 32 bytes.
Click on the New ... button to create a new area or on the Edit button to modify
an existing area.
Mode This value cannot be changed on this tab. The default setting MS stands for
master/slave data exchange. DX is an alternative setting for direct data exchange
between two slaves. This setting can be selected on the master system.
DP partner: Master If the I slave has not yet been connected to a master system (step 2 has still not
been completed), the fields on the left-hand side of the window are not
accessible. These are entered directly in step 2.
Local: Slave The IO areas from the viewpoint of the slave CPU are configured here.
Address Start address of the I or O area. You cannot enter address which have already
been assigned for use by the central IOs.
Length/unit These two fields combine to determine the length of the data block. A maximum
length of 32 bytes can be specified for each data block. Since the permissible
length for several data blocks is 244 bytes in total, the maximum length of the last
block can be less than 32 bytes.
Configuring
IO areas
Configuration
result
SITRAIN
IK-PBSYS / Intelligent Slaves Page 8 03/2007
Siemens AG 2007 - Subject to change without prior notice
Configuring The figure above shows an example of how to configure an output area.
1.A new area is opened with a click on the "New" button.
2.In the Properties screen, "output" is entered as the address type and
byte 20 set as the start address.
3.The total length of this area must be 8 bytes, the data need only be consistent
byte by byte.
The input is finished with a click on OK. With line 1 in the properties window
configured in this way, this particular DP slave will transfer the data area from
OB20 to OB27 to the DP master.
S7 program It is now possible to access this address area quite "normally" in the user
program of the slave CPU, e.g. with
L MB10
T QB 20
The content of MB10 is copied into the first byte (QB20) of the output area. The
DP master accesses this information by reading the first byte of the input area
assigned to this particular DP slave. This assignment is programmed in step 2
when the I slave is "attached" to the DP master.
Configuring
IO areas
Configuration
result (complete)
SITRAIN
IK-PBSYS / Intelligent Slaves Page 9 03/2007
Siemens AG 2007 - Subject to change without prior notice
Configuring The figure above shows an example of how to configure an input area.
1.A new area is opened with a click on the "New" button.
2.In the Properties screen, "input" is entered as the address type and
byte 20 set as the start address.
3.8 bytes is specified as the total permissible length of this area, the data
needonly be consistent byte by byte.
The input is finished with a click on OK. With line 2 in the properties window
configured in this way, the data received by this slave from its master are stored
in the area from IB20 to IB27.
This configuration must be compiled again (Save and compile) and can then be
downloaded to the target system, i.e. the CPU of the DP slave.
S7 program It is now possible to access this address area quite "normally" in the user
program of the slave CPU.
L IB23
T MB 200
The content of the fourth byte sent by the DP master (IB23) is copied into MB200.
In its S7 program, the DP master has copied this value into the fourth byte of the
output area assigned to this particular slave. This assignment is programmed in
step 2 when the I slave is "attached" to the DP master.
Configured
stations
Couple configured
stations to the
bus system
SITRAIN
IK-PBSYS / Intelligent Slaves Page 10 03/2007
Siemens AG 2007 - Subject to change without prior notice
Note The process now continues with the configuration of the master.
"Attach" the I slave You will find the I slave you have configured in folder Configured stations.
Object CPU31x is merely a dummy which can be dragged and dropped onto the
bus cable.
The DP slave properties window is displayed.
If the I slave has been configured in step 1 on the same subnet on which it will
now be "attached" to the master, the appropriate information will be displayed on
a line in the properties window. Select this line and click on the Couple button to
assign the slave to the subnet.
Mode: Master/slave
Input areas of
DP master
SITRAIN
IK-PBSYS / Intelligent Slaves Page 11 03/2007
Siemens AG 2007 - Subject to change without prior notice
Configuration By clicking on the "Configuration" tab, you will open the screen for entering the
areas viewed as address areas by the DP master. The areas configured in step 1
as address areas from the viewpoint of this DP slave are already displayed.
Select the line with the area to be configured and click on Edit ...
Properties In this screen, assign the data area which must be assigned to the previously
configured area (as viewed by slave) from the viewpoint of the master. You need
only configure the start address as the length is already defined by the area on
the slave. A new setting in this field would automatically alter the value for the
slave.
The same also applies to the fields for unit and consistency.
It is of course possible to change the previously configured area for the DP slave
again at this point, but if any of the DP slave settings are changed, the altered
configuration will need to be downloaded to the DP slave again.
Data exchange Assignment of these data areas is subject to the following rules:
The definition "input / output" always refers to the local view, i.e.
the input area configured for the slave must be declared as the output area
for the master and vice versa.
If the master wants to send data to the slave, it uses the S7 program to write them
to the output area defined here. The slave receives these data within its S7
program in the input area configured here.
If the slave wishes to transfer data to the master, the slave CPU writes them to
the output area of the slave and the S7 program of the master reads them out of
the master input area again.
The address values of an area are not connected in terms of master and slave,
i.e. it is only important to ensure that none of the address used is yet assigned
from the local viewpoint.
SITRAIN
IK-PBSYS / Intelligent Slaves Page 12 03/2007
Siemens AG 2007 - Subject to change without prior notice
Notes
L MB 120 L IB 20
T QB 40 T QB 5
Error OBs for L IW 42 L MW 30 Error OBs for
commissioning T MW 50 T QW 22 commissioning
SITRAIN
IK-PBSYS / Intelligent Slaves Page 13 03/2007
Siemens AG 2007 - Subject to change without prior notice
Assignments As regards the assignments of area addresses, it now only remains to assign
them in the correct sequence. The example above is designed to illustrate this:
Master slave The content of MB120 is copied to QB40 in the DP master program. QB40 is the
1st byte in the output area which is transferred to this I slave. In consequence,
this value also appears in the first byte on the slave, but in the input area, or to be
specific, in IB20. The content of this IB20 is copied to QB5 in the S7 program of
the slave. In fact, the outputs QB5 on the slave are switched by the master's
program (QB40). However, this type of direct switching does not actually require
an I slave.
Slave master In the slave's S7 program, MW30 is written to QW22, i.e. to the second word of
the configured output area.
Accordingly, the master's S7 program accesses these data by reading the second
word of input area IW42. Copying this value into MW50 stores it for further
processing at another point in the program.
Data consistency Since the data areas in this example have only been configured for "byte"
consistency, they can be accessed simply with the load or transfer command.
Note As the "other" station is always "missing" when the master system initially boots,
the following problem is encountered when I slaves are used:
The absence of a station is handled internally in the CPU like a subrack failure
(OB82) or station failure (OB86), i.e. if the relevant OB is missing in each case,
the CPU switches to STOP on errors which causes the other station to react with
the same error.
Since an S7 CPU can be prevented from stopping on errors merely by the
presence of the assigned error OB, the simplest solution is to download the
"empty" error OBs.
SITRAIN
IK-PBSYS / Intelligent Slaves Page 14 03/2007
Siemens AG 2007 - Subject to change without prior notice
Task description A data block with a total length of 32 bytes must be transferred consistently from
the I slave to the master.
Configuring Configure this block in exactly the same way as before, i.e. specify the send and
receive areas from the view of the relevant station in each case.
In the example shown above, the send mailbox on the I slave starts at QB 200.
The receive area for the data block on the master starts at IB 200.
The 32 byte block length is configured for both stations together in the field at the
bottom. The Total setting in the Consistency field specifies that this data block
must be transferred consistently and applies equally to the master and slave.
Data source
SITRAIN
IK-PBSYS / Intelligent Slaves Page 15 03/2007
Siemens AG 2007 - Subject to change without prior notice
SFC15 The system function SFC15 "DPWR_DAT" writes the data block specified by
parameter RECORD consistently to the destination area with a start address
defined by parameter LADDR.
The destination area is thus the I/O address area provided by the DP interface.
(The PROFIBUS itself always transfers data consistently between the master and
slave).
Addressed memory
area 200(dec) =
C8(hex)
Received data
SITRAIN
IK-PBSYS / Intelligent Slaves Page 16 03/2007
Siemens AG 2007 - Subject to change without prior notice
SFC14 The system function SFC14 "DPWR_DAT" reads the data block with a start
address specified in parameter LADDR consistently to the destination area
specified by parameter RECORD.
The source area is thus the I/O address area provided by the DP interface. (The
PROFIBUS itself always transfers data consistently between the master and
slave).
2 8
SITRAIN
IK-PBSYS / Intelligent Slaves Page 17 03/2007
Siemens AG 2007 - Subject to change without prior notice
Hardware To carry out the exercises described in this section, you will need a second S7-
300 trainer PLC which can function as the DP slave (I slave).
If no separate PLC is available for this purpose, you can use the PLC of a
neighboring group instead.
Functions In the following exercises, you will configure the I slave and connect it to the
master system.
The following areas must be used for exchanging data:
1.Master-slave data exchange (MS)
- 8 bytes of inputs to the DP master
- 8 bytes of outputs from the DP master
2. Direct data exchange (DX)
- 1 word of inputs from the ET200M (analog value)
DP slave mode
with test functions, etc.
SITRAIN
IK-PBSYS / Intelligent Slaves Page 18 03/2007
Siemens AG 2007 - Subject to change without prior notice
Task description In the following exercises, you will configure the I slave and connect it to the
master system.
Procedure 1.Create a complete hardware configuration for your "I slave" station.
2.Double click on the DP interface of the CPU to open it, click on
Properties in the General tab, set address 6
and select the PROFIBUS network in your project as the subnet.
Confirm the settings with OK.
3.Select DP slave on the Operating mode tab and check the box for
Test, Commissioning, Routing .
4.Finally, select the Configuration tab and enter two areas for data transmission
with the DP master. To do this, click on the New button for each area and fill in
the fields for the local station in the next screen (8 bytes of send and receive
data (consistent)).
5.Generate the new system data blocks by clicking on button Save and compile.
6.Download the entire configuration to the CPU of the I slave.
Note Even though the IO areas are not yet fully configured, the configuration can
still be downloaded to the CPU of the I slave. This is because the missing
configuration data only include information for the DP master.
Configured
stations
Couple configured
stations to the
bus system
SITRAIN
IK-PBSYS / Intelligent Slaves Page 19 03/2007
Siemens AG 2007 - Subject to change without prior notice
Procedure 1.Connect up the station of the I slave using the PROFIBUS cable of the
existing master system (change the terminating resistors!).
2.From the hardware catalog under PROFIBUS DP Configured stations,
drag the object CPU 31x to the bus cable of the master system. You will see
the I slave configured in the previous exercise.
3. Select this and click on the Couple button.
4.Open tab Configuration. You will see the two data areas configured in the
previous exercise. Select one of these at a time, click on button Edit and
complete the data area configuration by adding the values for the master
(see figure above).
5.Generate the new system data blocks by clicking on button Save and
compile.
6. Download the entire configuration to the CPU of the DP master.
Result The DP master synchronizes all slaves which are configured and connected to
the bus.
The CPUs of the master and slave have stopped on errors because the error
OBs still need to be downloaded to both stations. This download operation will
be practiced in the next exercise.
SITRAIN
IK-PBSYS / Intelligent Slaves Page 20 03/2007
Siemens AG 2007 - Subject to change without prior notice
Task description IB1 is copied to QB40 in FC7 of the master. QB40 is transferred to the I slave and
copied there into IB20.
The FC7 in the I slave copies IB20 to the local QB8 and QB20. QB20 is
transferred from the I slave to the master where it is copied into IB40. The FC7 in
the master copies QB40 into the local QB88.
Procedure 1.Write an FC7 function using the program shown in the diagram for both the DP
master and the I slave.
2.Also call block FC7 in OB1 (DP master and I slave) and download the blocks
and the modified OB1 to the relevant CPUs.
3. Switch the inputs of IB1 on the master simulator.
Monitor the following outputs:
- On the I slave: QB8
- On the master: QB88
SITRAIN
IK-PBSYS / Intelligent Slaves Page 21 03/2007
Siemens AG 2007 - Subject to change without prior notice
SITRAIN
IK-PBSYS / Intelligent Slaves Page 22 03/2007
Siemens AG 2007 - Subject to change without prior notice
Principle You can configure a direct data exchange (slave-to-slave communication) when
data which are transferred from one DP slave to the master also need to be read
simultaneously by another slave, but without being transferred again from the
master to the second slave.
This principle is based on the fact that every bus node can always "hear" any data
exchange on the bus, but only reads those data which are directly addressed to
itself (bus address).
However, PROFIBUS also uses the BROADCAST message, i.e. a message with
address 127. This is addressed to all nodes, i.e. it can basically be read by any
station.
Slave-to-slave communication is based on the principle that the slave-to-slave
receiver only reads the content of a broadcast message if it originates from a
particular sender.
From the configuring aspect, this is the slave-to-slave sender. When the message
is configured, it is also possible to specify whether the entire data block or simply
a connected area must be read by the receiver, as the read data in this case are
also input data.
Sender Any simple and any I slave which can identify this extended function can be
designated as a sender.
Receiver I slaves or DP masters which can "identify" this function (product version) can be
designated as slave-to-slave communication receivers. If a DP master is
configured as a slave-to-slave communication receiver, then it is the master of
another DP master system.
Address assignments
Mode: Direct data exchange
(slave-to-slave communication)
ET 200M
SITRAIN
IK-PBSYS / Intelligent Slaves Page 23 03/2007
Siemens AG 2007 - Subject to change without prior notice
Configure a "direct
data exchange"
SITRAIN
IK-PBSYS / Intelligent Slaves Page 24 03/2007
Siemens AG 2007 - Subject to change without prior notice
Task description The measured value (e.g. temperature) sent to the analog module of the ET200M
(PB=4) must also be read by the I slave (PB=6) using the
direct data exchange functionality and made available for processing in the I
slave's S7 program.
Configuring The data block for the direct data exchange is configured on the slave-to-slave
receiver (I slave with PB=6). The screen for configuring the data block is opened
with the New button.
QW 6
IW 60
SITRAIN
IK-PBSYS / Intelligent Slaves Page 25 03/2007
Siemens AG 2007 - Subject to change without prior notice
S7 program The program of the slave-to-slave receiver now has "quite normal" access to the
data read from the ET200M by direct data exchange.
In this instance as well, the DP interface simulates the receive area to the CPU
configured as a local address as an I/O area so that this address area can be
used for accessing from the viewpoint of the S7 program.
Procedure The use of slave-to-slave communication data should be added in the FC7 block
which has already been downloaded to the CPU as part of previous exercises
described above.
Monitor the value on the digital display of the simulator in the training case of the
I slave by varying the potentiometer for the analog value on the simulator in the
master's training case.