Escolar Documentos
Profissional Documentos
Cultura Documentos
PROFIBUS DP diagnostics
PROFIBUS DP
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 1 03/2007
Siemens AG 2007 - Subject to change without prior notice
Contents Page
PROFIBUS DP diagnostics ................................................................................................................ 2
Fault analysis options with STEP7 .................................................................................................... 3
Reactions of bus fault LEDs (DP master) ......................................................................................... 4
Reactions of bus fault LEDs (DP slave) ............................................................................................. 5
Fault analysis with OB86 .................................................................................................................... 6
OB86 : Evaluating the cause of the call and responding ................................................................... 7
Exercise 1: Visualize a slave failure (OB 86) ................................................................................... 8
Exercise 2: Determine the slave downtime ...................................................................................... 9
Exercise 3: "Diagnose hardware online" ........................................................................................... 10
Customer support (download area) ................................................................................................... 11
Exercise 4: Integrate WinCC flexible "PC RT" .................................................................................. 12
Exercise 5: Assign the Runtime interface parameters ..................................................................... 13
Exercise 6: Assign the connection parameters .............................................................................. 14
Exercise 7: Integrate FB125 into the S7 program ............................................................................ 15
Exercise 8: Diagnostic test WinCC flexible RT ................................................................................. 16
Exercise 9: Failure history of DP slaves .......................................................................................... 17
"Report system error" function ...................................................................................................... 18
Operating principle: Alarm_S/SQ ..................................................................................................... 19
Configure the "Report system error" function (1) ............................................................................. 20
Configure the "Report system error" function (2) ............................................................................. 21
OB configuration + CPU response in STOP state ........................................................................... 22
Messages + User block tab .............................................................................................................. 23
Diagnostic support + User block ......................................................................................................... 24
Result check using "CPU messages" ................................................................................................ 25
PROFIBUS DP diagnostics
PROFIBUS DP
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 2 03/2007
Siemens AG 2007 - Subject to change without prior notice
Contents Page
Exercise 10: Configure "Report system error" .................................................................................. 26
Enable Alarm_S messaging (WinCC flexible) ............................................................................... 27
Exercise 11: Display Alarm_S messages ....................................................................................... 28
Deactivate and activate slaves with SFC12 ....................................................................................... 29
Sample program for slave deactivation ............................................................................................ 30
Exercise 12: Activate and deactivate slaves ...................................................................................... 31
If you want to know more .................................................................................................................. 32
Diagnosis of a specific DP slave with SFC13 .................................................................................. 33
S7 program with an SFC13 call in OB1 ............................................................................................ 34
Parameters of the SFC13 (standard diagnostics) ............................................................................. 35
Diagnostics data format ................................................................................................................... 36
Exercise 13: Slave analysis with SFC13 .......................................................................................... 37
SFC11: "Freezing" of DP input signals ....................................................................................... 38
Group assignment for SYNC and FREEZE ....................................................................................... 39
S7 program for freezing DP input signals ......................................................................................... 40
Evaluation with active FREEZE mode ............................................................................................. 41
Synchronization, i.e. output and freezing of digital outputs on DP slaves ....................................... 42
S7 program for synchronizing DP output signals ............................................................................. 43
Copying the original outputs to the ET200S (SYNC group) .............................................................. 44
Diagnostic features
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 3 03/2007
Siemens AG 2007 - Subject to change without prior notice
LEDs There are LEDs on the slaves for troubleshooting which either light up or flash in
the event of a fault. The meaning of the individual LEDs is explained in the
manual for the corresponding slave.
On the CPU with an integral DP interface, only bus faults are signaled with LED
"BUSF".
STEP 7 software In the event of a fault, read out the diagnostic buffer or call up the tool "Diagnose
hardware".
Program If a slave fails and restarts, the error OB 86 is output. The start information then
contains the diagnostic address of the faulty slave.
By calling the system function SFC 13 you can view additional diagnostic data for
the slave as defined by standard EN 50 170.
Detailed information down to the individual channel is supplied by the standard
block FB 125. This is offered on the Internet as a diagnostic package together
with standard HMI screens.
Possible faults
Scenario 1: Bus fault (hardware fault)
Scenario 2: DP interface fault
Scenario 3: Different transmission rates in multiple DP master mode
Scenario 4: If the DP slave / master interface is active:
Short-circuit on the bus.
Scenario 5: With passive DP slave interface: Transmission rate search,
i.e. there are currently no other active nodes on the bus
(a master, for example) Bus fault LEDs
Possible remedies
Check the bus cable for short circuit or breaks.
Evaluate the diagnostics. Create a new configuration
or edit the existing one.
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 4 03/2007
Siemens AG 2007 - Subject to change without prior notice
Response Call OB 86 (when CPU is in RUN state). CPU switches to STOP if OB 86 is not
loaded.
Remedy
- Verify that the bus cable is connected to the CPU and that the bus is not
interrupted.
- Wait until the CPU has booted. If the LED does not stop flashing, check the DP
slaves or evaluate the diagnostic data for the DP slaves.
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 5 03/2007
Siemens AG 2007 - Subject to change without prior notice
Event class
Incoming fault
Outgoing fault
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 6 03/2007
Siemens AG 2007 - Subject to change without prior notice
General The operating system of the CPU calls OB86 if a PROFIBUS DP error is
identified by the system. OB86 is called by the system when the DP error
appears (incoming event) and disappears (outgoing event).
If the OB86 has not been programmed and such a fault occurs, the CPU
switches to STOP mode.
B#16#C3 :
Distributed I/O:
Failure of a DP master system
B#16#C4 :
Failure of a DP station
B#16#C5:
Fault in a DP station
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 7 03/2007
Siemens AG 2007 - Subject to change without prior notice
Slave failure
Alarm view
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 8 03/2007
Siemens AG 2007 - Subject to change without prior notice
Task description In the event of a slave failure, the CPU must not switch to STOP. The slave
failure must be displayed with the DP address of the failed slave in the previously
configured "Message" screen on the touch panel.
Slave failure
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 9 03/2007
Siemens AG 2007 - Subject to change without prior notice
Task description The purpose of this exercise is to determine the DP slave downtime and store it in
flag double word "MD_Slave_Downtime" (MD 88).
Procedure Extend the OB 86 program in such a way that the above functions are
implemented.
Solution tip:
To calculate the slave downtime, use block FC8 "DT_TOD" from the standard
library IEC Funktion Blocks.
Using a time stamp of data type "DT" (Date and Time), this block extracts time
information of data type "TOD" (Time of Day).
The time of day is stored as a time period (0:00 hours to the specified time) in
milliseconds (whole numbers) in a variable of data type "TOD" which means that
it can be used for other calculations like a "DINT" variable.
Module status
(diagnostic buffer)
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 10 03/2007
Siemens AG 2007 - Subject to change without prior notice
Task description Your task is to analyze DP slave failures using the "Diagnose hardware" online
function.
Procedure 1.Remove the module from slot 5 on the ET 200S.
2.In the menu Options Customize View, select the quick view.
3.Now select menu commands PLC Diagnosis/Settings
Diagnose hardware.
4.Select the line of the failed DP slave and then click on the module status button.
5.Analyze the messages in the Module status DP slave window:
Messages ..........................................................................................................................
..........................................................................................................................
..........................................................................................................................
..........................................................................................................................
Download ID
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 11 03/2007
Siemens AG 2007 - Subject to change without prior notice
Notes FB125 is provided for the diagnostic evaluation of a distributed configuration with
PROFIBUS DP and SIMATIC S7 in cases where detailed information about faults
or bus node failures is required in addition to the general diagnosis.
Download S7 diagnostic block FB125 V4.9 and WinCC flexible diagnostic displays as an
archived STEP 7 project for WinCC flexible 2005 and description of the DP
diagnostic blocks for SIMATIC S7:
- Dp_op_21 zip (51.772 KB)
Description of DP diagnostic blocks for SIMATIC S7 and diagnostic displays for
ProTool and WinCC flexible:
- Onlinehilfe_FB125.EXE (2.258KB)
Copy S7 blocks
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 12 03/2007
Siemens AG 2007 - Subject to change without prior notice
Task description Your task is to copy the WinCC flexible station "PC RT" and the relevant S7
blocks from the PROFIBUS diagnostic package supplied by Siemens customer
support into your project.
3.Copy the station "PC RT" from project "DP_OP_21_WinCC_flexible" into your
own project.
4.Copy all the blocks (except the OBs and the system data) from the S7 block
container in project "DP_OP_21_WinCC_flexible" to your own project
PROFIBUS address
Runtime interface
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 13 03/2007
Siemens AG 2007 - Subject to change without prior notice
Task description In order to ensure that the S7 program symbols are available in the WinCC
flexible project, the Runtime interface must be configured and parameterized with
the "HW Config" tool.
Procedure 1.Open the hardware configuration for the WinCC flexible station "RT PC"
2.Configure and parameterize the CP5611 module as shown above
(set PROFIBUS address to 0 so that the PC configuration does not alter the
default settings for the PC interface)
3.Save and compile the HW configuration of the PC station
4.Download the configuration to your local PC system (PC Runtime)
Connection parameters
Connections
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 14 03/2007
Siemens AG 2007 - Subject to change without prior notice
Task description Set up a connection so that the panel Runtime application can communicate with
your trainer PLC.
Procedure 1.Launch WinCC flexible by opening the WinCC flexible station in the SIMATIC
Manager (see figure on left) and double click on "Connections" in this screen
2.Check whether your S7 station has been set up as a connection partner
and whether the copy operation might delete or deactivate (Exercise 4)
existing connections.
3.Connect the WinCC flexible variables to the PLC variables by
selecting Options Re-connect select dialog options as illustrated
below ok (select all variables in the variable editor)
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 15 03/2007
Siemens AG 2007 - Subject to change without prior notice
Task description To ensure that the diagnostic data for a failed slave are stored in the instance
data block DB 125, FB 125 must be called in organization blocks
OB 1, OB 82 and OB 86 with instance data block DB 125 in each case.
In this case, it is not necessary to parameterize or transfer actual operands to the
formal operands of FB 125.
Notes The sequence and the contents of the 20-byte long temporary local data of the
organization blocks OB1, OB82 and OB86 must not be changed, but can be
extended at any time.
The following SFCs are used internally in the FB125: SFC13 and SFC51 with
SZL 0C91 (with an internal DP interface to the master CPU) or SZL 4C91 (with
an external DP interface to the CP/IM). It is not permissible to call SFC13 and/or
SFC51 with SZL OC91/4C91 in the OB1 in addition to the FB125 call for a
faulty slave.
Evaluation of the information in the block output parameters is meaningful only in
the cyclic program section (OB1).
If the FB125 block is processed correctly, the BIE bit is set to "1".
The BIE bit is reset if FB125 has been incorrectly processed.
When the CPU is booting (first OB1 cycle) and during a RESET, the whole DP
system is detected in the FB125 by an initialization routine. The diagnosis
process is interrupt-driven, i.e. if a diagnostic event or station failure occurs,
the evaluations are performed in the corresponding error OBs.
No call condition must therefore be generated in the block (see above).
Next fault
"Manual"
single diagnosis
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 16 03/2007
Siemens AG 2007 - Subject to change without prior notice
Task description Your task is to perform a function test on the PROFIBUS diagnostic package.
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 17 03/2007
Siemens AG 2007 - Subject to change without prior notice
General You want to record the individual slave failures statistically. You can use the
supplied source for this purpose from which theFB126 block is generated. It is
called in OB 86 and generates a history of slave failures in a ring buffer. The
structure of the instance DB for FB126 is as follows:
Bytes 0..3 Reserved
Bytes 4..129 Statistics for each slave (each slave has a reserved
byte which is incremented by 1 if the slave fails.)
Bytes 130..3201 Ring buffer with:ID / slave number incoming /
outgoing result / time stamp
FB126 does not need any transfer parameters. The number of failures can be
read directly in the instance DB for each slave.
Procedure 1.Copy file OB86Diag.exe to a separate directory and launch the application with
a double click.
2.Open the SIMATIC Manager and select the source container in your project.
3.Import the source file with the menu item "Insert External Source".
4.Open the inserted source with a double click and then compile. You will now
find the generated blocks in the block container of your project.
Automatic
S7 data message
Result is automatically trans- display
ferred to the HMI as a message
PLC
PROFIBUS DP
Slave
Slave diagnostics
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 18 03/2007
Siemens AG 2007 - Subject to change without prior notice
Definition The STEP 7 "Report system error" function provides a convenient way to display
diagnostic information provided by the component in the form of messages.
STEP 7 automatically generates the necessary blocks and message texts. The
user must simply download the generated blocks into the CPU and transfer the
texts to the connected HMI devices.
Settings In the hardware configuration, select the CPU for which you wish to configure
system error reporting. Then select menu commands Options Report system
error and assign parameters on the following tab sheets.
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 19 03/2007
Siemens AG 2007 - Subject to change without prior notice
Alarm_S/SQ The Alarm_S process is organized according to message numbers which are
automatically assigned when the function is configured in STEP 7. These
numbers are used to uniquely assign alarm messages. When a fault occurs, the
HMI system is notified via the message number with assigned message text.
When a fault occurs, the CPU stores the time of day plus any relevant process
parameters in addition to the message status (incoming, outgoing,
acknowledged). This information makes it easier to diagnose the fault cause.
The message information is stored in the PLC and not discarded immediately the
messages are sent. This means that individual network components (e.g. HMI
systems) can log on later and receive updated information.
Advantages ALARM_S offers the following advantages over the message bit procedure:
ALARM_S is an active messaging procedure. If a message is generated, the
CPU actively notifies all logged-on network nodes (polling is not used).
The process values are always identical to the values stored at the instant
the message is generated. This advantage is not guaranteed with the message
bit procedure.
The time stamp exactly specifies the time at which an event occurred, even if
the HMI system was not connected until later.
Message types Two types of ALARM_S message can be configured in STEP 7. They differ in
terms of their acknowledgement requirements:
Messages which require an acknowledgement. These messages are always
treated like fault messages.
Messages which do not require an acknowledgement. These messages can
be either fault or operational messages.
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 20 03/2007
Siemens AG 2007 - Subject to change without prior notice
General Use the "General" tab (Report system error) to specify which function block is to
be used as a diagnostic block. In addition, you can specify the response of
"Report system error" during generation.
OB configuration Use the "OB configuration" tab (Report system error) to specify which OBs are to
be supported, which OBs are to be created and in which OBs the "Report system
error" function is to be called.
CPU in STOP mode Use the "CPU in STOP mode" tab (Report system error) to specify which error
classes cause the CPU to switch to STOP mode.
Messages Use the "Messages" tab (Report system error) to specify which information is to
be output in which sequence as message texts.
User block Use the "User block" tab (Report system error) to specify whether a separate user
block is to be called from the diagnostic block and configure its interface.
Generate Click on this button to generate the selected blocks, messages and error text
libraries.
Delete Click this button to delete the diagnostic block including its reference data as well
as all messages and error texts.
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 21 03/2007
Siemens AG 2007 - Subject to change without prior notice
Report a system S7 components and "standard DP slaves" (slaves with properties defined
error by their GSD file) can trigger organization block calls when a system error occurs
(e.g. OB 82 is called when a diagnostic alarm is triggered on an analog input
module).
S7 components capable of diagnosis supply information about the active system
error. The start information or the local data of the assigned OBs provide general
information about the error location (e.g. logical address of module) and type (e.g.
channel error or buffering failure).
In addition, supplementary diagnostic information can be read out (with SFC 13)
to specify the error more precisely (e.g. channel 0, wire break).
Alarm_S The STEP 7 "Report system error" function provides a convenient way to display
diagnostic information provided by the component in the form of messages.
The blocks required for this function (FB 49 in the figure above) work internally
with the Alarm_S or Alarm_SQ procedure and are automatically generated or
edited by STEP7. The user need only download the generated or edited blocks to
the CPU and transfer the standard texts to the connected HMI devices.
OB configuration
CPU at stop
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 22 03/2007
Siemens AG 2007 - Subject to change without prior notice
General Use the "General" tab (Report system error) to specify which function block is to
be used as a diagnostic block (FB 49 in the figure). In addition, you can specify
the response of "Report system error" during generation.
OB configuration Use the "OB configuration" tab (Report system error) to specify which OBs are to
be supported, which OBs are to be created or which OBs need to be added to call
the "Report system error" function (FB 49).
CPU at STOP On the "CPU in Stop mode" tab, specify the errors which will allow the CPU to
remain in the RUN state and which will cause it to switch to STOP.
Messages Use the "Messages" tab (Report system error) to specify which information is to
be output in which sequence as message texts.
User block Use the "User block" tab to specify whether a separate user block must be called
from the diagnostic block (FB 49) and configure its interface.
Reporting component
Message preview
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 23 03/2007
Siemens AG 2007 - Subject to change without prior notice
Messages You can select the information to be displayed in the message window on this
tab. You can select from the information displayed on the left in the "Available
message information" field. The selected information is displayed on the right in
blue in the Message Text field.
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 24 03/2007
Siemens AG 2007 - Subject to change without prior notice
Diagnosis With version V5.4 of STEP 7, the instance DB "Detail_Diag_DB" can be specified
to directly supply data to the HMI diagnostic displays.
You can enter diagnostic support settings in this tab. The diagnostic support
system enables a PROFINET IO or PROFIBUS DP system to supply diagnostic
data from the "Report system error" FB 49 for graphic display on an HMI device.
Diagnostic displays Check the "PROFIBUS DP DB" box if you want diagnostic events to be displayed
graphically on an HMI device.
Check the "PROFINET IO DB" box if you want diagnostic events to be displayed
graphically on an HMI device.
Specify the block to be called. In the default setting, DB 125 is generated for
PROFIBUS DP and DB 126 for PROFINET IO. Both data blocks are supplied with
the required data. You can enter the block names absolutely or in symbolic form.
If you want to change the symbols, click on the "Edit symbols" button.
HMI export data The storage path for the HMI export data is displayed here. If you want to select
another storage path, click on the button on the right to select another directory.
CPU messages
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 25 03/2007
Siemens AG 2007 - Subject to change without prior notice
Generate To generate the required blocks (FB and DB; and depending on the settings also
OBs which do not yet exist), proceed as follows:
In the dialog box "Report system error" click
"Generate: The following blocks will be generated:
The error OBs for which the box "Generate OB" was checked in the "Report
system error" dialog box on the "OB Configuration" tab sheet.
Diagnostic FB (default: FB 49).
Instance DB for the diagnostic FB (default: DB 49).
Optional user block which is called from the diagnostic FB.
Evaluate 1.With an active PG on the CPU, you can monitor system errors by selecting
menu options
"PLC CPU messages".
2.In the window which then appears, select option "A" for user messages. Now,
as soon as a configured system message is activated, it will now appear in
plain text in this window as illustrated above.
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 26 03/2007
Siemens AG 2007 - Subject to change without prior notice
Task description: Errors occurring on the DP master CPU must be displayed as error messages by
the "Report system error" function.
Procedure 1.If any blocks are open in your S7 program, close them now.
3.Select the line containing the CPU module in the module subrack and
select menu commands Options Report system error ....
4.Change the entries on the "General" tab if the entered block numbers have
already been assigned in your program.
7.Download blocks OB1, OB82, OB86, FB49 and DB49 to the master CPU.
8.Select your S7 program in the SIMATIC Manager and select menu commands
PLC CPU Messages ... .
9.Check box "A" for the master CPU and minimize the message window (do not
close it!). Create a slave failure and look at the message displayed in the
message window which opens automatically.
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 27 03/2007
Siemens AG 2007 - Subject to change without prior notice
Notes
Alarm view
(Enhanced Objects)
Activate S7 Alarm
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 28 03/2007
Siemens AG 2007 - Subject to change without prior notice
Task description Message block FB 49 and its calls have been generated in different OBs with the
"Report system error" function. To ensure that the Alarm_S messages output by
this message block actually appear on the touch panel, the display of "S7
messages" must be activated in the message view of the displays "Template" and
"Messages".
Procedure 1.Open the WinCC flexible station "RT PC" (PC Runtime)
2.Create a new "Messages" display and insert a message view (additional
objects in the toolbox). Organize the screen jumps to suit your own
requirements (into or out of the start screen)
3.Open the "Messages" screen and activate the display of S7 messages (for
message view properties, see figure)
4.Check whether ALARM_S messaging is enabled in WinCC flexible (message
settings)
5.Open the "Template" screen and activate the display of S7 messages
6.Display the PROFIBUS address of the failed station in an output field
(information (MB87) is supplied by OB86)
7.Save the edited station and start the PC Runtime
8.Check the new function by provoking
a DP slave failure
or a measuring-range violation by setting an excessively
high voltage (> 12V) on the simulator potentiometer on systems with an analog
card.
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 29 03/2007
Siemens AG 2007 - Subject to change without prior notice
Description You can use the SFC 12 "D_ACT_DP" to selectively activate and deactivate
configured DP slaves. Furthermore, you can determine for each DP slave used
whether it is currently activated or deactivated.
The SFC 12 cannot be used for PROFIBUS PA field devices which are connected
to a DP master system through a DP/PA link.
Purpose If you configure DP slaves in a CPU which do not exist or which are currently not
required, the CPU will still regularly address them. If they are deactivated they are
no longer addressed by the CPU. In this way, the fastest possible DP bus cycle
can be achieved and the corresponding error events do not occur.
Deactivate When you deactivate a DP slave with SFC 12, its process outputs are set to the
configured substitute values or to 0 (safe state).
The corresponding DP master will then no longer access this DP slave.
Deactivated DP slaves are not indicated to be faulty or missing on the fault LEDs
of the DP master or the CPU.
The process image of the inputs of deactivated DP slaves is refreshed with 0, i.e.
it is treated in the same way as DP slaves which have failed.
Please consult the online help files for the function block for more information.
Note Don't forget the error OBs that still have to be programmed in relation to any
signals in the S7 program that are no longer supplied (DI, DO).
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 30 03/2007
Siemens AG 2007 - Subject to change without prior notice
Activate When you reactivate a DP slave using SFC 12, the DP master configures it and
assigns the parameters (as is the case when a failed DP station recovers).
Activation is complete when the slave can transfer useful data.
Activation of a DP slave does not initiate the program execution error OB (OB 85)
even if its inputs or outputs are part of the process image which is updated by the
system. Nor is an entry made in the diagnostic buffer.
Activation of the DP slave does not initiate the rack failure OB (OB 86) and the
operating system does not enter anything in the diagnostic buffer.
Note If you try to activate a deactivated slave which is physically separated from the
DP bus using SFC 12, the "DP-BUSF" LED on the CPU will flash for one minute.
When this monitoring time has elapsed, the SFC will output the error code
W#16#80A2, the LED stops flashing and the slave remains deactivated. If it is
reconnected to the DP bus at a later stage, you must reactivate the slave using
SFC 12.
Diagnostic address:
3FC(hex) = 1020(dec)
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 31 03/2007
Siemens AG 2007 - Subject to change without prior notice
Task description It is your task to create an option for temporarily separating the ET 200S from the
master system which will not cause an error response by the DP master. The
purpose of the option is to facilitate commissioning.
You will use system function SFC12 to deactivate and activate a DP slave for this
purpose. The system signal is at input I1.7. As long as a 1 signal is applied, the
ET 200S must remain deactivated.
Procedure 1. Program an FC12 as shown in the figure (add your own functions, e.g.
interrogation of the current slave status) if necessary)
2.Also call block FC12 in OB1.
3.Open the HW configuration of the master station and select menu commands
View Address overview.
4.Load all the blocks.
5.Enable input I1.7 on the simulator and monitor the reaction of the slave.
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 32 03/2007
Siemens AG 2007 - Subject to change without prior notice
Slave fault
OB86
Incoming/outgoing event
Master address
.
Slave diagnostic address/ master system
.
. Diagnostic address:
7FD(hex) = 2044(dec)
sfc13
EN ENO
REQ RET_VAL ??.?
W#16#7FC
??.? LADDR RECORD ??.?
BUSY ??.?
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 33 03/2007
Siemens AG 2007 - Subject to change without prior notice
Slave diagnostics Use the SFC 13 "DPNRM_DG" to read the diagnostic data of a DP slave as
defined by EN 50 170.
After the data have been transmitted correctly they are entered in the destination
area specified by RECORD (OUT 2).
The read action is started by assigning a logical "1" to the input parameter REQ
(INO) when calling SFC 13.
The basic structure of the diagnostic data for the slave are shown in the following
table. More detailed information on the DP slaves can be found in the manuals
(error numbers, for example, in the NCM S7 manual).
Basic structure of the slave diagnostic data
Byte: Meaning:
0 Station status 1
1 Station status 2
2 Station status 3
3 Master station number
5 Manufacturer's ID (low byte)
6... Other slave-specific diagnostics
Note For standard slaves which have more standard diagnostic data than 240 bytes
but less than 244 bytes, the first 240 bytes are entered in the destination area and
the corresponding overflow bit is set in the data.
Pointer to the
addressed data area
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 34 03/2007
Siemens AG 2007 - Subject to change without prior notice
Example The figure above shows an example of how to use SFC 13 to read out the
slave diagnostic data for a DP slave in the STEP 7 user program.
Assumptions The following are assumed to apply to this STEP 7 user program:
The diagnostic address of the ET 200S is 1022 (3FEh).
Slave diagnostic data must be stored in DB82: from address 0.0, length 64
bytes.
The slave diagnostic data can be up to 64 bytes long.
STEP 7 The SFC13 must be called in OB1 "cyclic mode since only this ensures that the
result data are completely written.
"DPNRM_DG"
EN ENO
BUSY ??.?
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 35 03/2007
Siemens AG 2007 - Subject to change without prior notice
Notes
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 36 03/2007
Siemens AG 2007 - Subject to change without prior notice
Diagnostic data The system function SFC 13 supplies the diagnostic data as shown in the figure
on the left. Set up an array with 64 bytes in a data block. This data area is entered
in the "RECORD" parameter of the SFC 13.
Station status Station statuses 1 to 3 provide an overview of the status of a DP slave. The
assignment of station status 1 and 2 can be seen in the figure on the right.
Only bit 7 of station status 3 is relevant. When bit 7 = "1", there are more
diagnostic messages than can be stored by the DP slave.
Master PB address The diagnostic byte "Master PROFIBUS address" contains the PROFIBUS
address of the DP master which configured the DP slave and which has read and
write access to the DP slave.
Manufacturer ID The manufacturer's ID contains a code which describes the type of DP slave e.g.
806A(hex) for ET 200S with IM 151.
ID-specific The ID-specific diagnostics indicate whether or not modules of the ET 200S have
diagnosis errors. Identifier-related diagnostics start at byte 6 and are 9 bytes long. From
byte 7, a bit is set for each defective module. Bit 0 ="1 from byte 7 is assigned to
Module 1 etc.
Module status This indicates the status of the configured modules and expands on the ID-
specific diagnosis. The module status, for example, lists whether a module is
missing or incorrect.
From OB 86
From OB 86
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 37 03/2007
Siemens AG 2007 - Subject to change without prior notice
Task description You will use system function SFC13 for extended slave diagnostics. The
diagnostic data for the slave which is currently failed will be stored in DB13.
Procedure 1. Program an FC13 function with the characteristics illustrated in the figure
above
2.Call FC13 in OB1 as well and load the relevant blocks
3.Open DB13 and switch the data view
4.Provoke a fault on the ET200S and monitor the entries in DB13
5.Interpret the entries in DB13 using the electronic equipment manual for the
ET200S: <Drive>:\IKPBSYS\ARCHIVES).
Chapter 6 also includes a description of the structure of standard diagnostic
data.
EN "DPSYC_FR"
ENO
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 38 03/2007
Siemens AG 2007 - Subject to change without prior notice
Description You can use SFC 11 (DPSYC_FR) to freeze one or more groups of
DP slaves. This is done by sending one of the following control commands or a
combination of them to the groups concerned:
FREEZE (freezes the input states for the DP slaves and reads in the frozen
inputs)
UNFREEZE (resets the FREEZE command)
Prerequisites Before you issue the control commands listed above, you must use the "HW
Config" tool of STEP 7 to organize the DP slaves into FREEZE groups.
FREEZE The control command FREEZE switches the relevant DP slaves into Freeze
mode. With each FREEZE command, the DP master causes the relevant DP
slaves to save the current status of the inputs simultaneously. The DP master
then transfers the saved data to the input data area of the CPU.
The inputs or outputs are not updated until the control command UNSYNC or
UNFREEZE is issued.
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 39 03/2007
Siemens AG 2007 - Subject to change without prior notice
Procedure Mark the symbol for the DP master system which contains the DP slave
that you want to assign to a group. Select menu commands
Edit Object Properties.
The "Group assignment" tab sheet is displayed complete with a table in which you
can assign the DP slave to SYNC/FREEZE groups.
Note You can assign each slave to a maximum of one SYNC and one FREEZE
group. Exception: When you use a CP 342-5 as a DP master, you can assign up
to 8 groups (SYNC and/or FREEZE groups) to each assigned DP slave (see
documentation for the CP 342-5).
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 40 03/2007
Siemens AG 2007 - Subject to change without prior notice
Notes
PB address = 35 PB address = 6
with active FREEZE
signal
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 41 03/2007
Siemens AG 2007 - Subject to change without prior notice
Notes
EN "DPSYC_FR" ENO
REQ RET_VAL ??.?
??.? LADDR BUSY ??.?
??.? GROUP
??.? MODE
Parameters Declaration Data type Memory area Description
REQ INPUT BOOL I, Q, M, D, L, constant Level-triggered control parameter
REQ=1: Activate the SYNC job
LADDR INPUT WORD I, Q, M, D, L, constant Diagnostic address of DP master in hex. format
GROUP INPUT BYTE I, Q, M, D, L, constant Group selection Bit 0 = 1: Group 1 selected
Bit 1 = 1: Group 2 selected ...
Bit 7 = 1: Group 8 selected
You can select more than one group per job.
MODE INPUT BYTE I, Q, M, D, L, constant Job ID (coded acc. to EN 50 170 V 3)
Bit 0, 1, 6, 7: reserved (value 0)
Bit 4 = 1: UNSYNC is performed
Bit 5 = 1: SYNC is performed
RET_VAL OUTPUT INT I, Q, M, D, L Error code. You must evaluate RET_VAL after
every function block execution.
BUSY OUTPUT BOOL I, Q, M, D, L BUSY=1: The job has not yet been completed.
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 42 03/2007
Siemens AG 2007 - Subject to change without prior notice
Prerequisites Before you issue the control commands listed above, you must use STEP 7 to
organize the DP slaves in SYNC or FREEZE groups.
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 43 03/2007
Siemens AG 2007 - Subject to change without prior notice
Notes
SITRAIN
IK-PBSYS / PROFIBUS Diagnostics Page 44 03/2007
Siemens AG 2007 - Subject to change without prior notice
Notes