You are on page 1of 120

Applications & Tools

Answers for industry.



Diagnostic Block with Visualization
via HMI or Web Browser for AS
Interface
AS Interface, STEP 7 V5.x
Library Description November 2013
Warranty and Liability

ASI_DIAG
V30, Entry ID: 50897766 2

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Warranty and Liability

Note
The Application Examples are not binding and do not claim to be complete
regarding the circuits shown, equipping and any eventuality. The application
examples do not represent customer-specific solutions. You are responsible for
ensuring that the described products are used correctly. These Application
Examples do not relieve you of your responsibility to use safe practices in
application, installation, operation and maintenance. When using these
application examples, you recognize that we cannot be made liable for any
damage/claims beyond the liability clause described. We reserve the right to
make changes to these Application Examples at any time and without prior
notice. If there are any deviations between the recommendations provided in this
application example and other Siemens publications e.g. catalogs the
contents of the other documents have priority.

We do not accept any liability for the information contained in this document.
Any claims against us based on whatever legal reason resulting from the use of
the examples, information, programs, engineering and performance data etc.,
described in this application example will be excluded. Such an exclusion will not
apply in the case of mandatory liability, e.g. under the German Product Liability Act
(Produkthaftungsgesetz), in case of intent, gross negligence, or injury of life, body
or health, guarantee for the quality of a product, fraudulent concealment of a
deficiency or breach of a condition which goes to the root of the contract
(wesentliche Vertragspflichten). The damages for a breach of a substantial
contractual obligation are, however, limited to the foreseeable damage, typical for
the type of contract, except in the event of intent or gross negligence or injury to
life, body or health. The above provisions do not imply a change of the burden of
proof to your detriment.
Any form of duplication or distribution of these application examples or excerpts
hereof is prohibited without the expressed consent of Siemens Industry Sector.

Caution
The functions and solutions described in this entry are mainly limited to the
realization of the automation task. Please furthermore take into account that
corresponding protective measures have to be taken in the context of industrial
security when connecting your equipment to other parts of the plant, the enterprise
network or the Internet. Further information can be found under the Entry ID
50203404.
http://support.automation.siemens.com/WW/view/en/50203404


Siemens Industry Online Support
This document is an article from the Siemens Industry Online Support. The
following link takes you directly to the download page of this document:
http://support.automation.siemens.com/WW/view/en/50897766
Table of Contents

ASI_DIAG
V30, Entry ID: 50897766 3

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d


Table of Contents
Warranty and Liability .............................................................................................. 2
1 Task of the Library ......................................................................................... 5
1.1 Field of application and benefits ......................................................... 5
1.2 Structure of the library ....................................................................... 5
2 Library Content ............................................................................................... 9
2.1 Function diagram ............................................................................... 9
2.2 Information on the program blocks ................................................... 10
2.2.1 Overview of the blocks ..................................................................... 10
2.2.2 Representation ................................................................................ 12
2.2.3 Call environment.............................................................................. 15
2.2.4 Resources and performance data .................................................... 16
2.3 Overview of the HMI template .......................................................... 18
2.3.1 The diagnostic screen ...................................................................... 18
2.3.2 The statistic screen .......................................................................... 25
2.4 Overview of the web interface .......................................................... 26
2.4.1 The diagnostic screen ...................................................................... 26
2.4.2 The control board ............................................................................ 29
2.4.3 The statistic screen .......................................................................... 30
2.5 Hardware and software components ................................................ 31
2.5.1 Validity ............................................................................................ 31
2.5.2 Components used ........................................................................... 31
2.6 Guide for the library documentation ................................................. 33
3 The Program Blocks in Detail ...................................................................... 34
3.1 The visualization blocks ASI PANEL FB and ASI WEB FB .......... 34
3.1.1 Core functionality ............................................................................. 34
3.1.2 Managing the AS-i masters .............................................................. 34
3.1.3 The data supply of the visualization screens (HMI, Web).................. 35
3.1.4 Reset after CPU restart.................................................................... 37
3.2 The ASI DIAG FB diagnostic block ................................................ 38
3.2.1 Processing requirements ................................................................. 38
3.2.2 Core functionality ............................................................................. 39
3.2.3 Initialization phase ........................................................................... 39
3.2.4 Reading out of the diagnostic information......................................... 40
3.2.5 Reset after CPU restart.................................................................... 41
3.2.6 The Watchdog timer ........................................................................ 42
3.3 The control blocks ASI PANELCONTROL FB and ASI WEB
CONTROL FB ................................................................................ 42
3.3.1 Core functionality ............................................................................. 42
3.3.2 Reset after CPU restart.................................................................... 43
3.4 The raw data of the ASI DIAG FB .................................................. 44
3.4.1 Overview of the diagnostic raw data ................................................. 44
3.4.2 Data structure in the instance data block .......................................... 44
3.4.3 The structure of DataRecord_ASi_Slaves1 (IE/AS-i Link) ................. 46
3.4.4 The structure of DataRecord_ASi_Slaves2 ...................................... 47
3.4.5 The structure of Periphery_fault2 ..................................................... 48
4 How to Work with the Example Project ....................................................... 49
4.1 Addresses of hardware components ................................................ 49
4.2 Using the STEP 7 project ................................................................. 50
4.2.1 Parts of the STEP 7 project.............................................................. 50
4.2.2 Configuration notes.......................................................................... 51
4.2.3 Installing the STEP 7 project ............................................................ 53
4.3 Operating the STEP 7 project .......................................................... 55
Table of Contents

ASI_DIAG
V30, Entry ID: 50897766 4

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d


5 WinCC Flexible Configuration ..................................................................... 57
5.1 The WinCC flexible project............................................................... 57
5.2 Using visualization screens .............................................................. 58
5.3 Adjusting the AS-i master selection list............................................. 61
5.3.1 Logic operating diagram of the selection list ..................................... 61
5.3.2 Changes at the user interface .......................................................... 64
5.3.3 List position entries .......................................................................... 64
5.3.4 Integration of the AS-i master in the selection list ............................. 66
5.3.5 Definition of the text display for the selection list .............................. 68
5.4 Adjusting the AS-i slave information ................................................. 69
5.4.1 Logic operating diagram of the AS-i slave display ............................ 69
5.4.2 Integration of the AS-i master in the main list ................................... 71
5.4.3 Definition of the information for the AS-i slaves ................................ 73
5.5 Implementing graphics ..................................................................... 75
5.5.1 Coordination of the graphics ............................................................ 75
5.5.2 Graphics display of the AS-i masters ............................................... 76
5.5.3 Graphics display of the AS-i slaves .................................................. 78
6 HTML Configuration ..................................................................................... 84
6.1 Using web pages ............................................................................. 84
6.2 Adjusting the AS-i master information .............................................. 86
6.3 Adjusting the AS-i slave information ................................................. 88
6.4 Adapting the display texts ................................................................ 89
6.5 Accessing user-defined web pages .................................................. 90
7 The ASI_DIAG Library ............................................................................... 92
7.1 Prerequisites for using the blocks .................................................... 92
7.2 Integrating the library into STEP 7 V5.5 ........................................... 94
7.3 Using library blocks.......................................................................... 95
7.4 Initializing the blocks ...................................................................... 101
7.5 Enabling the web server ................................................................ 105
7.6 Creating a Web2PLC project ......................................................... 106
7.7 Generating the web data blocks ..................................................... 109
7.8 Changing the block properties to non-retain ................................... 112
7.9 Loading the blocks into the CPU .................................................... 112
8 Tips and Tricks ........................................................................................... 113
8.1 Avoiding unnecessary processing of blocks ................................. 113
8.2 Visualization in the configuration view ............................................ 115
8.3 Exporting and importing text lists ................................................... 116
9 References .................................................................................................. 120
10 History ........................................................................................................ 120

1 Task of the Library
1.1 Field of application and benefits

ASI_DIAG
V30, Entry ID: 50897766 5

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

1 Task of the Library
1.1 Field of application and benefits
AS-Interface slaves are connected with a SIMATIC controller via gateways or
communication modules. An individual evaluation of the diagnostic data of the AS-i
masters and slaves in the STEP 7 user program is very elaborate and therefore not
a trivial matter.
To simplify the AS-i diagnostic for the user, the present library contains a number
of blocks to be able to conveniently evaluate and visualize the diagnostic data:
in the user program: The read AS-i diagnostic data is ready for individual
further processing in a data block.
on HMI panels: The library includes blocks that serve as interface between
HMI panel and CPU.
via web browser: SIMATIC CPUs with PROFINET interface provide the
opportunity to access CPU variables with the help of individually designed web
pages provided by the system. The library includes blocks that serve as
interface between user-defined web pages and CPU.
1.2 Structure of the library
The library is made up of three parts:
1. A STEP 7 ASI_DIAG block library with the blocks relevant for the diagnosis
and an additional file with the user-defined web pages for the web server of the
CPU.
This library is used for generating your own AS-i diagnostic applications.
2. A STEP 7 example project ASI_DIAG_PROJECT in which the program blocks,
the HMI templates and the web-based AS-i diagnostic are used as examples.
3. This documentation for describing the application of library and example
project.

1 Task of the Library
1.2 Structure of the library

ASI_DIAG
V30, Entry ID: 50897766 6

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The following tables briefly summarize the components of the code packages once
more:
Table 1-1
Package name Component Application
STEP 7 project
ASI_DIAG_PROJECT
All blocks relevant for the diagnosis and
the HMI and web visualization have
already been integrated into the project
and their configuration has been
completed.
Completed STEP 7 project
for immediate usage (if your
own hardware configuration
corresponds to the one
supplied).
STEP 7 library
ASI_DIAG
Relevant program blocks for
diagnostics, HMI and web
visualization of an AS-i network
User-specific HTML pages and
JavaScript for the visualization of
the diagnostic information and
operation of the functions via web
server.
Creating your own diagnostic
applications
Integration into already
existing projects
Visualization via HTML
Visualization via HMI (copy
HMI template from STEP 7
project)
Apart from the description of the code package, this document includes:
a detailed description of the most important blocks regarding the core
functionality and of the internal functional sequences.
explanations regarding content and structure of the diagnostic information read
from the AS-i master.
This knowledge is vital for working without HMI templates and without HTML
pages.

In any case, the documents listed in chapter 9 are recommended as accompanying
literature.
Scope of validity
Supports all current AS-i masters from the SIMATIC product range:
DP/AS-i Link 20E
DP/AS-i LINK Advanced
DP/AS-i F-Link
IE/AS-i LINK Advanced
CP 343-2 (P)
ET200SP AS-i Master
STEP 7 V5.5 SP3 and WinCC flexible 2008 Advanced are used as the
configuration software.

Note
For further information on the hardware and software requirements refer to
chapter 2.5.

1 Task of the Library
1.2 Structure of the library

ASI_DIAG
V30, Entry ID: 50897766 7

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Schematic layout
The figure below shows a possible hardware setup for the application of STEP 7
blocks.

Figure 1-1
AS-Interface
PROFIBUS PROFINET / IE
ET 200SP
IE/AS-i Link
DP/AS-i Link
DP/AS-i Link
DP/AS-i F-Link
S7-300 + CP 343
HMI-Panel
PG

1 Task of the Library
1.2 Structure of the library

ASI_DIAG
V30, Entry ID: 50897766 8

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

HMI visualization
The figure below shows the HMI template for the visual diagnosis of AS-i masters
and slaves:
Figure 1-2

Web visualization
The figure below shows the web interface for the visual diagnosis of AS-i masters
and slaves:
Figure 1-3

2 Library Content
2.1 Function diagram

ASI_DIAG
V30, Entry ID: 50897766 9

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

2 Library Content
2.1 Function diagram
The figure below shows a schematic layout of the functionality of the AS-i library:
Figure 2-1
SIMATIC Station
User programm
Diagnostic data
AS-i Master 1 Diagnostic data
AS-i Master 2
Diagnostic data
AS-i Master n
AS-i
Master 2
AS-i
Master 1
AS-i
Master n
ASI DIAG FB
ASI PANEL FB
Reading out & saving
of diagnostic data
HMI
Panel
Preparation &
display
Web
browser
ASI WEB FB

2 Library Content
2.2 Information on the program blocks

ASI_DIAG
V30, Entry ID: 50897766 10

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

2.2 Information on the program blocks
Overview of the blocks
The following graphic shows the library blocks in its entity.
Figure 2-2
ASI DIAG FB
ASI PANEL FB
ASI WEB FB
ASI PANEL
CONTROL FB
ASI WEB
CONTROL FB
WWW
ASI WEB
INTERFACE DB
Diagnosis
Visualization
HMI Panel Web browser

Central diagnostic block
The central ASI DIAG FB (FB157) block is used for the reading out and
evaluating of the status of AS-Interface slaves and masters.
The ASI DIAG FB" supplies the status bits for an AS-Interface line (master and
slaves) respectively and stores the diagnostic data in the instance data block.
Per AS-i master one call each of the ASI DIAG FB with independent instance data
block is needed.
Visualization blocks
To display the diagnostic data in a WinCC flexible environment on a panel and/or
web browser, the appropriate visualization blocks can optionally be used.
ASI PANEL FB (FB154) for the visualization on a HMI panel
ASI WEB FB (FB158) for the visualization via web.
Note
The data exchange between HMI panel and CPU is performed via the ASI
PANEL FB instance data block.
For user-defined web pages an instance data block is not permitted as interface
for data exchange. This is why the web visualization uses a separate global ASI
WEB INTERFACE DB data block (see "web blocks" section).

2 Library Content
2.2 Information on the program blocks

ASI_DIAG
V30, Entry ID: 50897766 11

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Control blocks
Particularly for the ET200SP-AS-i master other operating and monitoring interfaces
are available on the panel and web browser.
Statistic display
Control board (only integrated in the web browser).
For the ET200SP-AS-i master to respond to control commands of the user, the
following control blocks are responsible:
ASI PANEL CONTROL FB (FB155) for control via the HMI panel
ASI WEB CONTROL FB (FB156) for control via the web interface.
Note
The additional operating and monitoring interfaces are only selectable when the
active AS-i master is an ET200SP-AS-i master.
As a result, the control blocks are also only required when there is an ET200SP-
AS-i master in the AS-i network.

Web blocks
STEP 7 converts and saves the user-defined web pages as control DB and DB
fragments via the Web2PLC tool. The WWW instruction triggers the call of the
coded and fragmented data blocks and the interaction between web page and
STEP 7 user program
To access the CPU variables, the ASI WEB INTERFACE DB (DB6) global data
block is used next to the above mentioned diagnostic and visualization blocks.
2 Library Content
2.2 Information on the program blocks

ASI_DIAG
V30, Entry ID: 50897766 12

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Representation
ASI DIAG FB
The graphic below shows the FB157 in FBD representation:
Figure 2-3


The parameters have the following meaning:
Table 2-1
Type Variable Data type Default
value
Meaning
I
n
p
u
t

Master_Address DINT L#0 Logic address of the master module as Long
INT e.g. L#1.
ASi_Web_DB DINT L#0 Optional web visualization: Number of the ASI
WEB FB instance data block.
ASi_Panel_DB DINT L#0 Optional HMI visualization: Number of the ASI
PANEL FB instance data block.
MASTER_ID INT L#0 Device type of the AS-i master; the following
applies
1: IE/AS-i LINK Advanced
2: DP/AS-i (F-)Link, CP343-1 (P), DP/AS-I Link
(Adv.)
3: ET200SP AS-i Master
REQ BOOL 1 Request Bit; when there is a positive edge at
REQ, the block will be processed.
O
u
t
p
u
t

BUSY BOOL 0 True, when the block is processed.
ERROR BOOL 0 True, when an error has occurred.
2 Library Content
2.2 Information on the program blocks

ASI_DIAG
V30, Entry ID: 50897766 13

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

ASI DIAG FB
The graphic below shows the FB158 in FBD representation:
Figure 2-4

This block has no parameters.
ASI PANEL FB
The graphic below shows the FB154 in FBD representation:

Figure 2-5

This block has no parameters.

ASI WEB CONTROL FB
The graphic below shows the FB156 in FBD representation:
Figure 2-6

This block has no parameters.
ASI PANEL CONTROL FB
The graphic below shows the FB155 in FBD representation:
Figure 2-7

This block has no parameters.

2 Library Content
2.2 Information on the program blocks

ASI_DIAG
V30, Entry ID: 50897766 14

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

WWW instruction
The graphic below shows the www instruction in FBD representation:
Figure 2-8

Table 2-2
Type Variable Data type Default
value
Meaning
Input CTRL_DB DINT L#0 Number of the control data block
Output RET_VAL DWORD 0 Contains an error code in the event of an error.


2 Library Content
2.2 Information on the program blocks

ASI_DIAG
V30, Entry ID: 50897766 15

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Call environment
Overview
ASI DIAG must be called in the cyclic OB 1 and is enabled either by a parameter
input in the OB 1 call, or automatically by calling the block in an error or cyclic
interrupt OB.
Enabling by means of another OB occurs by means of the error or cyclic interrupt
organization block (OB). The block can be optionally integrated here.
Enabling ASI DIAG FB via the error or cyclic interrupt OBs has the advantage that
the block is only processed for certain situations (error or cyclic interrupt). This
approach saves unnecessary processing of the diagnostic block in the cyclic
execution level.

Note
The error and cyclic interrupt OBs are only active for one cycle; the ASI DIAG
FB, however, takes several runs for its execution.
Therefore, the block is only triggered in this OB. Further processing is handled
by the cyclic OB 1.

Per AS-i master one call each of the ASI DIAG FB with independent instance
data block is needed.
So it is mandatory to call all ASI DIAG FBs in OB 1, while the calls in the error
alarms or cyclic interrupts are optional.

For the visualization it is sufficient to call the respective blocks once in the cyclic
OB 1 execution level. The following blocks are concerned
For the HMI visualization:
ASI PANEL FB
ASI PANEL CONTROL FB
For the web visualization
ASI DIAG FB
ASI WEB CONTROL FB
WWW
The following table summarizes all call types:
Table 2-3
OB 1 Error OB 8x Cyclic interrupt
OB 3x
ASI DIAG FB

(optional) (optional)
ASI PANEL FB

ASI PANEL CONTROL FB

ASI DIAG FB

ASI WEB CONTROL FB

WWW instruction

2 Library Content
2.2 Information on the program blocks

ASI_DIAG
V30, Entry ID: 50897766 16

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Error OBs
When an error occurs, the AS-i master generates a diagnostic interrupt and sends
it to the CPU. In order to respond to the error with a defined (programmed)
behavior, this alarm calls a respective organization block in the user program.
OB 82: diagnostic interrupt OB
OB 83: unplug/plug OB
OB 84: CPU hardware error OB
OB 85: program sequence error OB
OB 86: module rack failure OB
NOTICE Not all masters trigger a diagnostic interrupt for a slave I/O error. This is why an
additional call via a cyclic interrupt OB may be useful.

Cyclic Interrupt OBs
By using the cyclic interrupt OBs of S7 CPUs, certain program sequences can be
started after up to nine equidistant time intervals. Numbers OB 30 OB 38 serve
as cyclic interrupt OBs.
The call in the cyclic interrupt OB has the function to poll the AS-i masters cyclically
in a certain time grid. Errors can also be detected this way, even if the AS-i master
reports no diagnostic interrupt and hence causes no error OB call.
Employing the cyclic interrupts avoids putting unnecessary load on the cyclic OB 1.
Resources and performance data
Library resources
The table below shows the size of the program blocks or instance data blocks in
main memory:
Table 2-4
No. Block Size Note
1. ASI DIAG FB 6052 Bytes A separate instance data block
per AS-i line is required.
2. Instance data blocks to
ASI DIAG FB
2548 Bytes
3. ASI PANEL FB 2018 Bytes Only when a panel for operating
and monitoring is used.
4. Instance data blocks to
ASI PANEL FB
772 Bytes
5. ASI PANEL CONTROL FB 442 Bytes
6. Instance data blocks to
ASI PANEL CONTROL FB
180 Bytes
7. ASI DIAG FB 1240 Bytes Only when a web browser for
operating and monitoring is used.
8. Instance data blocks to
ASI WEB FB
670 Bytes
9. ASI WEB CONTROL FB 630 Bytes
10. Instance data blocks to
ASI WEB CONTROL FB
172 Bytes
2 Library Content
2.2 Information on the program blocks

ASI_DIAG
V30, Entry ID: 50897766 17

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Number of AS-i masters
One ASI DIAG FB per AS-i master is required for the visualization. Which master
stores its data under which instance data block number, is stored internally in lists
in the ASI PANEL FB or ASI WEB FB.
In ASI PANEL FB there is space for 255 list entries and therefore for 255 AS-i
masters or AS-i lines, for ASI WEB FB the number of list entries is restricted to
20, for reasons of performance.
The real maximum number of ASI DIAG FBs in the project is largely dependent
on the frame conditions. These include factors such as:
CPU used and its computing power
type of the FB calls
(restrictions for the number of parallel running SFB 52/SFB 53 jobs)
maximal OB 1 cycle time
size of the work memory of the CPU
Watchdog timer
The watchdog timer prevents the diagnostic FB from being stuck in an infinite loop.
This is preset to 400ms.
Using the watchdog timer (TIME variable DBX2380.0 byte 4 in the instance data
block of the ASI DIAG FBs) enables analyzing the average processing time of a
block.
AS-i performance data
Up to 62 slaves can be connected per AS-i line, which are addressed as address
1A - 31A and 1B - 31B. According to the specification, the update time is 5ms for
31 slaves and up to 10ms for maximum configuration.
Load memory capacity
The user-defined web pages are coded in data blocks, fragmented and stored in
the load memory of the CPU. The size of the allocation area depends on the
content of the web pages. Plug-in memory cards can increase the internal load
memory of the CPU.
The web pages of this application require a load memory of approx. 144kbytes
storage space.
Restrictions for read/write record and command interface
In the ASI DIAG FB library block, information on the status of the AS-i slaves is
requested and read at the respective master via data records or the command
interface. System functions SFB 52 (RDREC; read data record) and SFB 53
(WRREC; write data record) are used for this.
Depending on the CPU type, only a certain number of SFB calls, hence ASI DIAG
FB calls as well, can be processed in parallel.
The number varies between four (for smaller CPUs) and eight (for larger CPUs)
simultaneous calls.
Further information is available in the following FAQ: BID:15364459.
Note
In most cases no particular action is required; but if it is, please note the
approach according to chapter 7.3.

2 Library Content
2.3 Overview of the HMI template

ASI_DIAG
V30, Entry ID: 50897766 18

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

2.3 Overview of the HMI template
With the help of WinCC flexible, there is the option to visualize the AS-i network via
a panel.

Note
All the functions described in this chapter only work in conjunction with the
function blocks.
ASI DIAG FB
ASI PANEL FB
ASI PANEL CONTROL FB

The diagnostic screen
Overview of the layout of the AS-i master diagnosis
The diagnostic screen provides the status of the configured AS-i masters and their
slaves clearly and graphically and therefore enables a convenient diagnostic
overview.
The data required for this purpose is read via the ASI DIAG FB from the AS-i
master and prepared by the ASI PANEL FB.
The AS-i diagnostic screen is subdivided into four areas:
Figure 2-9


2 Library Content
2.3 Overview of the HMI template

ASI_DIAG
V30, Entry ID: 50897766 19

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The table below shows the meaning of the individual areas:
Table 2-5
No. Function
1. Selecting and deselecting the AS-i master; each AS-i master is represented with its
bus.
2. State of the AS-i master according to the AS-i specification.
3. Overview and state of the slaves connected at the bus.
4. Menu fields
AS-i master selection
The AS-i master is selected via a drop-down list. The following screenshot shows
the list with the five entries as an example:
Figure 2-10


Only those AS-i masters appear in the drop-down list which have previously logged
on at the ASI PANEL FB via their ASI DIAG FB with their instance data block
number. More information can be found in chapter 0 (Initialization phase).
A graphic of the AS-i master and the slaves can also appear next to the display
text.
Note
Information on how to change display texts or graphics and adding further AS-i
masters is available in chapter 5 (WinCC Flexible Configuration).

Status of the AS-i master
From all AS-i master connections information can be read or written via data
records or command calls.
Apart from information via the connected slaves, the AS-i master also provides
appropriate status flags according to the AS-i specification.
The flags of the selected AS-i masters are read and highlighted in color in WinCC
flexible depending on their status.

2 Library Content
2.3 Overview of the HMI template

ASI_DIAG
V30, Entry ID: 50897766 20

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Figure 2-11


The meaning of the individual statuses is illustrated in the following table:
Table 2-6
Flag Display text Meaning
AUTO_ADDR_ENABLE Automatic address
assignation enabled
The flag indicates whether automatic
addressing is blocked (bit = 0) or
enabled (bit = 1) by the user.
OFFLINE_READY Offline The flag is set if the offline phase is
active.
APF AS-i Power Fail The flag is set if the voltage at the
AS-i line is too low.
CONFIG_MODE AS-i Master in
configuration mode
The flag is set in the configuration
mode and reset in protected mode.
AUTO_ADDR_AVAIL Automatic address
assignation possible
The flag is set if the automatic
address programming can be
performed (i.e. if precisely one AS-i
slave has failed).
LDS_0 Slave with address 0
present
The flag has been set if an AS-i
slave with address 0 exists.
CONFIG_OK Configuration Error The flag is set when the setpoint
configuration and the actual
configuration match.

2 Library Content
2.3 Overview of the HMI template

ASI_DIAG
V30, Entry ID: 50897766 21

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

A diagnostic as shown in the example in figure 2-11 means the following state of
the AS-i master:
Automatic addressing is disabled.
The AS-i master is in offline mode
The voltage at the connected AS-i line is too low, or no AS-i line is connected.
The AS-i master is in configuration mode
The setpoint configuration does not correspond to the actual configuration.
Slave state
The Slave state area displays an overview of the configured slaves. A maximum
of 62 slaves (31 A slaves and 31 B slaves) can be diagnosed. In addition, there is
diagnostic information for a possibly existing AS-i slave with the address 0.
The status of the slaves is read via data records or command calls from the AS-i
masters.
With the Get_lists_and_flags call and if required Read_I/O_fault_list the
following entries are read from the AS-i master:
List of active AS-i slaves (LAS)
List of detected AS-i slaves (LDS)
List of configured AS-i slaves (LPS)
List of the present I/O error of the enabled AS-i slaves (LPF)
Flags of the AS-i master according to AS-i specification.

Using WinCC flexible, the slave states are symbolized via various background
colors.
Figure 2-12


2 Library Content
2.3 Overview of the HMI template

ASI_DIAG
V30, Entry ID: 50897766 22

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The following color assignments apply:
Table 2-7
Color Meaning
Green The slave is detected, enabled and configured. No I/O error reported.
Yellow The slave was detected but has not yet been configured.
Orange The slave reports an I/O error.
Red The slave is configured but has failed (disabled and/or not detected).
Gray Slave is not configured and does not exist.
Blue
frame
The AS-i master has not detected a multiple assignment of this address. This
function is not supported by all AS-i masters. This function is available, e.g. for
the ET200SP AS-i master.

For each slave a detailed description can be stored (e.g. MLFB number, location,
function).
A simple click on a slave displays the stored information and the current status in
plain text in the output field.
Figure 2-13


Note
How to store additional information on the slaves is described in chapter 5.4
(Adjusting the AS-i slave information)

2 Library Content
2.3 Overview of the HMI template

ASI_DIAG
V30, Entry ID: 50897766 23

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Further states
Apart from the states of the AS-i master and the AS-i slaves, failures from the
visualization environment are also displayed. These include messages, such as:
No connection between CPU and visualization;
CPU in stop;
No data from ASI PANEL FB

The visualization displays the messages in plain text, as shown in the figure below:
Figure 2-14


Checking whether the connection between CPU and display device exists, is
implemented via system messages. System messages at the operator panel
provide information of internal states of the operator panel and the controller.
The table shows the possible states and the cause:
Table 2-8
Message text Trigger
CPU in STOP No further value change at the counter in ASI PANEL
FB.
Data missing from HMI block The AS-i master has not logged on to the ASI PANEL
FB or reports an internal error in
ASI DIAG FB.
The ASI PANEL FB receives no or incorrect
information.
No connection to CPU Connection between CPU and visualization terminated.

As soon as the CPU goes to stop or the data block of ASI PANEL FB supplies no
further data, the status of the slaves is grayed.

2 Library Content
2.3 Overview of the HMI template

ASI_DIAG
V30, Entry ID: 50897766 24

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Figure 2-15

Menu fields
The menu field is used to switch between languages, to change images and to
terminate Runtime.
Figure 2-16


Note
The Statistic menu field is only enabled if the currently selected AS-i master is
an ET200SP AS-i master.


2 Library Content
2.3 Overview of the HMI template

ASI_DIAG
V30, Entry ID: 50897766 25

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The statistic screen
Overview of the AS-i statistic layout
The statistic screen shows the error counter of AS-i masters and AS-i slaves.
The data is read via the ASI DIAG FB from the AS-i master and prepared by the
ASI PANEL FB. The transmission of the function commands to the AS-i master is
via ASI PANEL CONTROL FB.
Figure 2-17




2 Library Content
2.4 Overview of the web interface

ASI_DIAG
V30, Entry ID: 50897766 26

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

2.4 Overview of the web interface
The combination of HTML and JavaScript provides an option to create user-defined
websites for PROFINET CPUs and to carry out a web-based diagnosis of the AS-i
network and perform online functions.
All files (HTML, images, JavaScript, etc.) required for the display are converted to
control and fragment DBs via the Web2PLC tool. The WWW" instruction
cyclically updates the website.

Note
For all the functions described in this chapter the following blocks are required:
ASI DIAG FB
ASI WEB FB
ASI WEB CONTROL FB
ASI WEB INTERFACE FB
WWW
all control and fragment DBs of the websites.

The diagnostic screen
Overview of the layout of the AS-i master diagnosis
The diagnostic screen provides the status of the configured AS-i masters and their
slaves clearly and graphically and therefore enables a convenient diagnostic
overview.
The data required for this, is read via the ASI DIAG FB from the AS-i master,
prepared through the ASI WEB FB and provided to the website via the
ASI WEB INTERFACE DB interface. The screen of the AS-i web diagnostic is
subdivided into four areas:
Figure 2-18

2 Library Content
2.4 Overview of the web interface

ASI_DIAG
V30, Entry ID: 50897766 27

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The table below shows the meaning of the individual areas:
Table 2-9
No. Function
1. Selecting and deselecting the AS-i master; each AS-i master is represented with its
bus.
2. State of the AS-i master according to the AS-i specification.
3. Overview and state of the slaves connected at the bus.
4. Menu fields
AS-i master selection
The AS-i master is selected via a drop-down list and is transferred into the CPU via
the button next to it. The current AS-i master is displayed via a text field.
The following screenshot shows the list:
Figure 2-19

AS-i master state
Via a data record, information can be read or written through the AS-i master
connection.
Apart from information via the connected slaves, the AS-i master also provides
appropriate status flags according to the AS-i specification.
The flags of the selected AS-i masters are read and highlighted in color on the web
interface according to their status.
Figure 2-20

The meaning of the individual statuses is analog to the HMI visualization (see
Table 2-6).
2 Library Content
2.4 Overview of the web interface

ASI_DIAG
V30, Entry ID: 50897766 28

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Slave state
The Slave state area displays an overview of the configured slaves. A maximum
of 62 slaves (31 A slaves and 31 B slaves) can be diagnosed. In addition, there is
diagnostic information for a possibly existing AS-i slave with the address 0.
The state of the slaves is read via a data record from the AS-i master.
With the Get_lists_and_flags call and if required Read_I/O_fault_list the
following entries are read from the AS-i master:
List of active AS-i slaves (LAS)
List of detected AS-i slaves (LDS)
List of configured AS-i slaves (LPS)
List of the present I/O error of the enabled AS-i slaves (LPF)
Flags of the AS-i master according to AS-i specification.
Using JavaScript, the slave states are symbolized via various background colors.
Figure 2-21


The color assignments are according to the color-coding of the HMI visualization
(see Table 2-7).
For each slave a detailed description can be stored (e.g. MLFB number, location,
function).
By simply clicking on a slave, the stored information and the current status is
displayed as plain text in the output field underneath the Slave state area.
Figure 2-22


Note
How to store additional information on the slaves is described in chapter 6.3
(Adjusting the AS-i slave information)

If the CPU or the AS-i master is no longer available, the states of the slaves are
grayed.
2 Library Content
2.4 Overview of the web interface

ASI_DIAG
V30, Entry ID: 50897766 29

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Menu fields
The menu field is for changing the language.
Figure 2-23

The control board
Note
The control board can only be selected for an ET200SP AS-i master.

Overview of the AS-i control board layout
The TIA Portal offers a control board for the ET200SP AS-i master in online mode,
in order to directly perform functions from the portal. This control board is
reproduced on the web interface. The following functions are available:
Change operating mode
Adopt slave configuration
Transfer AS-i slave address
The function commands are transferred via the ASI WEB INTERFACE DB
interface to the user program, prepared in the ASI WEB CONTROL FB and are
also sent through it to the AS-i master.
The screen of the AS-i control board is subdivided into three areas.
Figure 2-24


The table below shows the meaning of the individual areas:
Table 2-10
No. Function
1. Status of the AS-i master and changing the operating mode
2. Adopt slave configuration
3. Transfer AS-i slave address

2 Library Content
2.4 Overview of the web interface

ASI_DIAG
V30, Entry ID: 50897766 30

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The statistic screen
Note
The statistic overview can only be selected for an ET200SP AS-i master.

Overview of the AS-i statistic layout
The statistic screen shows the error counter of AS-i masters and AS-i slaves.
Figure 2-25

The values are read via the ASI DIAG FB from the AS-i master, prepared through
the ASI WEB FB and are provided to the website via the
ASI WEB INTERFACE DB. The transmission of the function commands is
analogous to the control board.

2 Library Content
2.5 Hardware and software components

ASI_DIAG
V30, Entry ID: 50897766 31

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

2.5 Hardware and software components
Validity
This application is valid for
STEP 7 V5.5 SP3
SIMATIC S7-300 from firmware 3.2 onward
SIMATIC S7-400 from firmware 6.0 onward
Components used
Library requirements
The library blocks are hardware independent and can be integrated in all STEP 7
classic projects.
The WinCC flexible visualization screens were optimized for the following operator
panels:
MP277 8 (resolution corresponds to the 10 panel)
Runtime 15

The following AS-i masters are supported here:
DP/AS-i Link 20E (6GK1 415-2AA10)
DP/AS-i LINK Advanced single master (6GK1 415-2BA10)
DP/AS-i LINK Advanced double master (6GK1 415-2BA20)
DP/AS-i F-Link (3RK3 141-1CD10 / 3RK3 141-2CD10)
IE/AS-i LINK single master (6GK1 411-2AB10)
IE/AS-i LINK double master (6GK1 411-2AB20)
CP 343-2 (6GK7 343-2AH01-0XA0)
CP 343-2P (6GK7 343-2AH11-0XA0)
ET200SP AS-i Master (3RK7137-6SA00-0BC1)
2 Library Content
2.5 Hardware and software components

ASI_DIAG
V30, Entry ID: 50897766 32

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Hardware components of the example project
The example project was created with the following components:
Table 2-11
No. Order number No. Component
1. 6ES7317-2EK14-0AB0 1 CPU317-2 PN/DP
2. 6GK1 415-2BA20 1 DP/AS-i LINK Advanced Double Master
3. 6GK1 411-2AB20 1 IE/AS-i LINK Double Master
4. 6GK7 343-2AH11-0XA0 1 CP 343-2P
5. 3RK7137-6SA00-0BC1 1 CM AS-i Master ST
6. 6ES7155-6AU00-0BN0 1 ET 200SP IM155-6 PN ST
7. 6ES7193-6PA00-0AA0 1 Server module
8. 6AV6643-0CB01-1AX5 1 HMI panel MP277 8
Software components
Table 2-12
No. Order number No. Component
1. 6ES7810-4CC10-0YA5 1 STEP 7 V5.5 Floating license
2. 6AV6613-0AA51-3CA5 1 WinCC flexible 2008 Advanced
3. Located on CD2 of the
STEP 7 installation
software
1 Web2PLC (is only required for the web
application)
Software requirements for the web server
The user-defined web pages were designed for Internet Explorer 8 and
Firefox 11. A JavaScript is used for the interaction on the web page.
Proper usage of the web visualization requires a mandatory activation of
JavaScript on your browser.
2 Library Content
2.6 Guide for the library documentation

ASI_DIAG
V30, Entry ID: 50897766 33

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

2.6 Guide for the library documentation
This document provides the user with an overview and if necessary a detailed
description of the library blocks. Furthermore, short configuration instructions for
the following scenarios are shown:
how the AS-i diagnostic blocks are used and configured in a project.
how the preprogrammed visualization masks are used.
For a convenient diagnosis of the AS-i slaves and AS-i masters, the
preprogrammed WinCC flexible projects can be used in conjunction with the ASI
PANEL FB. This block prepares the diagnostic raw data of the AS-i masters and
supplies it to a panel.
It is furthermore possible to process the actual diagnostic raw data in the user
program. The supplied visualization options are optional. In this case, some
chapters of this document become irrelevant for you.
The table below shows the respective chapters:
Table 2-13
Chapter Panel+
ASI DIAG FB
Web interface +
ASI DIAG FB
Processing
by user
Chapter 2.3
Overview of the HMI template

Chapter 2.4
Overview of the web interface

Chapter 3.1
The visualization blocks ASI PANEL FB
and ASI WEB FB


Chapter 3.2
The ASI DIAG FB diagnostic block

Chapter 3.3
The control blocks ASI PANELCONTROL
FB and ASI WEB CONTROL FB

Chapter 3.4
The raw data of the ASI DIAG FB

Chapter 4
How to Work with the Example Project

Chapter 5
WinCC Flexible Configuration

Chapter 6
HTML Configuration

Chapter 7
The ASI_DIAG Library

Chapter 8.1
Avoiding unnecessary processing of blocks

Chapter 8.2
Visualization in the configuration view

Chapter 8.3
Exporting and importing text lists

Chapter 9
References

3 The Program Blocks in Detail
3.1 The visualization blocks ASI PANEL FB and ASI WEB FB

ASI_DIAG
V30, Entry ID: 50897766 34

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

3 The Program Blocks in Detail
This chapter gives a detailed description of the library blocks regarding the core
functionality and the internal function processes.
Furthermore, content and structure of the diagnostic information read from the AS-i
master is explained. This knowledge is vital for working without visualization.
3.1 The visualization blocks ASI PANEL FB and ASI
WEB FB
Note
The visualization blocks ASI PANEL FB and ASI WEB FB are identical in
terms of functionality.
Due to the application of use (ASI PANEL FB for the HMI panel and
ASI WEB FB for the web interface) they only differ in the way of the data
preparation.

Core functionality
The function blocks ASI PANEL FB and ASI WEB FB have two important tasks:
managing the configured AS-i masters with the respective instance data block
number.
Providing images for the AS-i master visualization in WinCC flexible and the
web browser with data.
Managing the AS-i masters
For storing diagnostic information and status about itself and its connected slaves,
each AS-i master requires the ASI DIAG FB with its appropriate instance data
block.
For the visualization in WinCC flexible or web browser the ASI PANEL FB or ASI
WEB FB accesses the respective instance data blocks, reads out the information
and copies it to its appropriate instance data block.
For assigning AS-i Master Instance data block number the visualization
blocks manage a master list in which all ASI DIAG FBs log on with the respective
number.
The following screenshot gives an example of the master list with five logged on
ASI DIAG FBs:
Figure 3-1


The master list only shows which position refers to which data block number, and
does not provide information on the respective AS-i master itself. You find the
actual type (IE/AS-i link, PROFIBUS/ central processor module, ET200SP) stored
3 The Program Blocks in Detail
3.1 The visualization blocks ASI PANEL FB and ASI WEB FB

ASI_DIAG
V30, Entry ID: 50897766 35

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

in the respective ASI DIAG FB instance data block via the MASTER_ID input
parameter.
Using this list, WinCC flexible and the website forms the display texts of the
selection list for the AS-i master diagnostic screen (see chapter 5.3 Adjusting the
AS-i master selection list as well as chapter 6.2 Adjusting the AS-i master
information).

Note
The positions in the master list are decisive for the order of the AS-i masters in
the selection list and the visualization interfaces.
Position [0] in the master list corresponds to position 1 in the selection list.

The data supply of the visualization screens (HMI, Web)
The second task of the visualization blocks is supplying the visualization screens
with the desired data.
On the visualization screens the user is given the option, via the selection list, to
select an AS-i master configured in STEP 7.
Depending on the AS-i master whose data is required, the raw information from the
respective ASI DIAG FB instance data block is transferred to the appropriate
visualization block and prepared for display.
The following graphic illustrates this procedure, using the example of an HMI panel.
3 The Program Blocks in Detail
3.1 The visualization blocks ASI PANEL FB and ASI WEB FB

ASI_DIAG
V30, Entry ID: 50897766 36

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Figure 3-2
Selection list in WinCC flexible
Master list in ASI PANEL FB
iDB101
ASI PANEL FB
iDB105
ASI DIAG FBs
Data record
Row data
WinCC flex
display
Display in WinCC flexible
iDB104
Data record
iDB103
Data record
iDB102
Data record
Data record
iDB100
DP/AS-i Link
iDB 100
Get row data e.g. from iDB100
Format data for the display
Display of
diagnostic data
WinCC flexible STEP 7 User program

3 The Program Blocks in Detail
3.1 The visualization blocks ASI PANEL FB and ASI WEB FB

ASI_DIAG
V30, Entry ID: 50897766 37

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Reset after CPU restart
To remove old data from the instance data blocks of the blocks ASI PANEL FB
and ASI WEB FB, the block properties of STEP 7 are accessed. Using the Non
Retain keyword resets the data blocks to the loading values each time the network
is switched on and off and after each STOP-RUN transition of the CPU.
Figure 3-3

3 The Program Blocks in Detail
3.2 The ASI DIAG FB diagnostic block

ASI_DIAG
V30, Entry ID: 50897766 38

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

3.2 The ASI DIAG FB diagnostic block
Processing requirements
For the program to run in ASI DIAG FB certain requirements must be fulfilled.
The function block is equipped with an REQ input parameter, which is responsible
for processing the program.

Note
Principally, the following applies:
If REQ is connected to 0, the block will not be processed.

The default setting for REQ is value 1.

Overview
Depending on the call environment, different responses are required at the REQ
input of the ASI DIAG FB. The table below shows the respective responses:
Table 3-1
Call layer Status at REQ input Response
OB 1 Positive edge Block FB157 is enabled and
processed
OB 1 Unconnected (default
value at REQ is true)
The block is only processed after it has
previously been activated (through
another OB error / cyclic interrupt
OB).
OB 1 false The block is never processed.
OB 8x, OB 3x Unconnected (default
value at REQ is true)
The block is activated (further
processing occurs in OB 1).
OB 8x, OB 3x false The block is never processed.

Detailed description
If the block is called up in an error or cyclic interrupt OB, no further connection is
necessary at the REQ input. The block is triggered if OB 8x/3x is called up (default
setting of the REQ input is 1).
Since one cycle is not sufficient for processing the ASI DIAG FB, further
processing occurs in OB 1 where the integration of ASI DIAG FB is therefore
mandatory. REQ can also remain unconnected here, since a trigger has already
been performed by another OB.
If the function block shall be processed even without trigger by an error or cyclic
interrupt in OB 1, the REQ input must be triggered by a positive edge.

Note
Further information and examples on the interconnection and call options are
available in chapter 7.3ff. (Using library blocks).

3 The Program Blocks in Detail
3.2 The ASI DIAG FB diagnostic block

ASI_DIAG
V30, Entry ID: 50897766 39

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Core functionality
The ASI DIAG FB function block has two core functionalities:
Organization of independent initialization. The AS-i master reports to the
visualization blocks if required.
Reading the diagnostic information and flags from the AS-i master. The read
data is prepared, sorted and stored in the internal instance data block of the
AS-i master.
Since each AS-i master provides different data, it is mandatory that each AS-i
master has its appropriate ASI DIAG FB instance data block assigned to it.
Initialization phase
The AS-i master is initialized after calling the block and is necessary for later
processing of the WinCC flexible/web display as well as for reading out of the
diagnostic information.
In this phase the ASI DIAG FB logs in at the master list of the visualization block
by storing its instance data block number if visualization is desired.
The following arrangement applies:
Table 3-2
Input parameters Value Response of the AS-i master block
ASi_Web_DB >0 Login at the ASI WEB FB master list.
ASi_Web_DB 0 No logon in the ASI WEB FB; visualization via web
is not desired.
ASi_Panel_DB >0 Login at the ASI PANEL FB master list.
ASi_Panel_DB 0 No logon in the ASI PANEL FB; visualization via
HMI panel is not desired.
The following diagram outlines this phase:
Figure 3-4
Has the
master already been
initialized?
Has the
master already been
initialized?
Jump
initialization phase
Jump
initialization phase
Entry in the master list
of the "ASI WEB FB"
Entry in the master list
of the "ASI WEB FB"
Master list in
"ASI WEB FB"
Master list in
"ASI WEB FB"
yes
nein
iDB number
Input parameter
ASi_Web_DB <>0?
Input parameter
ASi_Web_DB <>0?
Entry in the master list
of the "ASI PANEL FB"
Entry in the master list
of the "ASI PANEL FB"
Master list in
"ASI PANEL
FB"
Master list in
"ASI PANEL
FB"
iDB number
Input parameter
ASi_Panel_DB <>0?
Input parameter
ASi_Panel_DB <>0?
yes
yes

3 The Program Blocks in Detail
3.2 The ASI DIAG FB diagnostic block

ASI_DIAG
V30, Entry ID: 50897766 40

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Reading out of the diagnostic information
Prerequisite for the read out of diagnostic information is the initialization phase and
the specification of the AS-i master type via the MASTER_ID input parameter.
There are essential differences in the approach to read the diagnostic information
and flags from the AS-i master between the IE/AS-i link and PROFIBUS/central/
ET200SP-AS-i master.
The AS-i master is addressed via the Master_Address input parameter which is
configured with the logic address from the hardware configuration.
IE/AS-i LINK
For the IE/AS-i Link (MASTER_ID = 1), reading occurs via a single Read data
record command (data record number 84).
Figure 3-5

The content of the data record is stored in the instance data block of the AS-i
master.
PROFIBUS/central/ET200SP AS-i master
PROFIBUS-AS-i master, CP343-1 (P) (MASTER_ID = 2) and the ET200SP AS-i
master (MASTER_ID = 3) have a command interface via which the acyclic services
are processed. The command interface is addressed respectively with data record
number 2 via the Read data record and Write data record commands.
Unlike the IE/AS-i Link, a write data record command comes first, where the
command number that is to be read is transferred. The status of the command
processing can be polled via so-called status nibbles (bit 7-4 of byte 1 of the logic
address of the AS-i master). As soon as command processing has been
completed, the results of the command can be fetched via a Read data record
command.
3 The Program Blocks in Detail
3.2 The ASI DIAG FB diagnostic block

ASI_DIAG
V30, Entry ID: 50897766 41

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The sequence is represented as follows:
Figure 3-6
Is
command processing
complete?
Send "read data record"
command with data record
number 2
Save result of
command in iDB
no
yes
Send
"Write data record"
command
with data record number 2
and command number
Evaluate status Nibble
(Bit 7-4)


Note
This sequence does not have to be implemented independently in the user
program, but can be via the ASI_CTRL block.
This block handles the command protocol independently and also enables the
user to parameterize SIMATIC AS-i masters and to read out information data.
Notes on this matter can be found here:
http://support.automation.siemens.com/WW/view/en/51678777
The ASI_CTRL is already integrated in the ASI DIAG FB. Because of this,
nothing else has to be done.


Note
PROFIBUS devices and the ET200SP AS-i master only differ in terms of the
command numbers and the structure of the read data. The functionality via the
command interface is identical.

Reset after CPU restart
Deleting old information from the instance data blocks of the AS-i master requires a
reset function. Unlike the instance data blocks of the blocks ASI PANEL FB and
ASI WEB FB, this is not realized via the Non Retain block function, but code-
based. The Non Retain should be enabled for the instance data blocks of all AS-i
masters, which may quickly become confusing for several masters.
The code-based reset is stored in ASI DIAG FB. After each processing the
variables that are no longer used are set to default values.
3 The Program Blocks in Detail
3.3 The control blocks ASI PANELCONTROL FB and ASI WEB CONTROL FB

ASI_DIAG
V30, Entry ID: 50897766 42

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The Watchdog timer
In order to prevent that the ASI DIAG FB is stuck in an infinite loop, there is a
watchdog timer that is programmed as switch-on delay.
A switch-on delay delays a rising edge by a defined time interval (PT), i.e. the
output Q of the switch-on delay is only set to value 1 after this time interval has
elapsed and stays in this state until the IN input changes to 0.
If the input IN already changes to 0 before the delay time has elapsed, output Q
remains on 0.
In the time diagram the switch-on delay has been defined as follows:

Figure 3-7

In ASI DIAG FB this process has been realized as follows:
At the beginning, the watchdog is started with a positive edge. If the program is
running without errors and within the defined time interval of 400ms, the input of
the timer is reset and the output remains 0.
If the program gets stuck due to an error occurring during processing, and the
defined delay time elapses, the output of the timer is set and the program
processing is cancelled. This procedure prevents the program from getting stuck
in a step sequence.
3.3 The control blocks ASI PANELCONTROL FB and
ASI WEB CONTROL FB
Core functionality
The control blocks ASI WEB CONTROL FB and ASI PANEL CONTROL FB
have the following tasks
to respond to commands from the statistic screen or the control board.
to prepare the respective command for the AS-i master and to transfer it to it.
Commands from the visualization screens are among others:
Change operating mode.
Adopt slave configuration.
Change AS-i slave address
Select slave for the error counter.
Delete the error counter on AS-i master or AS-i slave.
3 The Program Blocks in Detail
3.3 The control blocks ASI PANELCONTROL FB and ASI WEB CONTROL FB

ASI_DIAG
V30, Entry ID: 50897766 43

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Note
The control board and the statistic display are only available for the ET200SP-
AS-i master. This is why it is only necessary to prepare the commands for the
command interface.
The ASI_CTRL block is used for the communication to the ET200SP-AS-i
master.

Reset after CPU restart
To remove old data from the instance data blocks of the blocks ASI PANEL
CONTROL FB and ASI WEB CONTROL FB, the block properties of STEP 7 are
accessed. Using the Non Retain keyword resets the data blocks to the loading
values each time the network is switched on and off and after each STOP-RUN
transition of the CPU.
Figure 3-8


3 The Program Blocks in Detail
3.4 The raw data of the ASI DIAG FB

ASI_DIAG
V30, Entry ID: 50897766 44

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

3.4 The raw data of the ASI DIAG FB
Processing the diagnostic raw data in the user program requires knowing which
information is provided by the system and where it is located in the instance data
block of the ASI DIAG FB.
Overview of the diagnostic raw data
The status of the slaves and the AS-i masters is read from the AS-i masters via
data records or command calls.
Calling Get_lists_and_flags and if required Read_I/O_fault_list provides the
following entries:
List of active AS-i slaves (LAS)
List of detected AS-i slaves (LDS)
List of configured AS-i slaves (LPS)
List of the present I/O error of the enabled AS-i slaves (LPF)
Flags of the AS-i master according to AS-i specification.
Each slave assigns one bit per list, hence, a list has 8 bytes of read data assigned
to it.
If the bit is FALSE, the AS-i slave is depending on the list not detected,
disabled or not configured or does not indicate any I/O errors.
Data structure in the instance data block
For the IE/AS-i Link a total of 36 bytes are read and for the other AS-i master 48
bytes.
This has the result that the read lists have a different offset. The slave sequence is
furthermore not identical there.
Due to these discrepancies, two data areas were declared for storing the
diagnostic data of the AS-i masters in function block "ASI DIAG FB:
For the IE/AS-i LINK: DataRecord_ASi_Slaves1
(in the instance data block: byte 2290- byte 2325)
For the remaining AS-i master:
DataRecord_ASi_Slaves2
(in the instance data block: byte 2326- byte 2357)
PeripheryFault_2
(in the instance data block: byte 2358- byte 2371)

3 The Program Blocks in Detail
3.4 The raw data of the ASI DIAG FB

ASI_DIAG
V30, Entry ID: 50897766 45

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Slave sequence in the lists
For the IE/AS-i link and the ET200SP AS-i master the slaves are addressed in
ascending bit address.

The following assignments apply:
Table 3-3
Slave no.
Address (byte x beginning of list)
0A Byte x, bit 0
1A Byte x, bit 1
2A Byte x, bit 2

8A byte (x+1), bit 0
9A byte (x+1), bit 1
10A byte (x+1), bit 2

0B byte (x+4), bit 0
1B byte (x+4), bit 1
2B byte (x+4), bit 2

8B byte (x+5), bit 0
9B byte (x+5), bit 1
10B byte (x+5), bit 2
For the remaining AS-i master the slaves are addressed in descending bit
address.

The following assignments apply:
Table 3-4
Slave no.
Address (byte x beginning of list)
0A Byte x, bit 7
1A Byte x, bit 6
2A Byte x, bit 5

8A byte (x+1), bit 7
9A byte (x+1), bit 6
10A byte (x+1), bit 5

0B byte (x+4), bit 7
1B byte (x+4), bit 6
2B byte (x+4), bit 5

8B byte (x+5), bit 7
9B byte (x+5), bit 6
10B byte (x+5), bit 5
3 The Program Blocks in Detail
3.4 The raw data of the ASI DIAG FB

ASI_DIAG
V30, Entry ID: 50897766 46

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The structure of DataRecord_ASi_Slaves1 (IE/AS-i Link)
For the IE/AS-i link, all lists (LAS, LDS, LPS, LPF and AS-i master flags) required
for the diagnosis are read with only one call (Get_lists_and_flags) and stored in
the DataRecord_ASi_Slaves1 data area.
Structure of the information
The following table shows the structure of the 36 bytes for
DataRecord_ASi_Slaves1:
Table 3-5
Byte Address in iDB Description
Byte [0] - Byte [1] DBB 2290 DBB 2291 Version ID
Byte [2] Byte [9] DBB 2292 DBB 2299 List of activated slaves (LAS)
Byte [10] Byte [17] DBB 2300 DBB 2307 List of detected slaves (LDS)
Byte [18] Byte [25] DBB 2308 DBB 2315 List of configured slaves (LPS)
Byte [26] Byte [33] DBB 2316 DBB 2323 List of present I/O faults (LPF)
Byte [34] DBB 2324 AS-i master flags 1
Byte [35] DBB 2325 AS-i master flags 2
Bit granular description of the AS-i master flags
Assignment and meaning of the bits for AS-i Master Flags 1 are given below:
Table 3-6
Bit Meaning
0 CONFIG_OK
1 LDS_0
2 AUTO_ADDR_ASSIGN
3 AUTO_ADDR_AVAIL
4 CONFIG_MODE
5 NORMAL_MODE
6 APF
7 OFFLINE_READY
Assignment and meaning of the bits for AS-i Master Flags 2 are given below:
Table 3-7
Bit Meaning
0 PERIPHERY_OK
1 DATA_EXCHANGE_ACTIVE
2 OFFLINE
3 AUTO_ADDR_ENABLE
4 GROUND_ERROR
5 EPROM_OK
6 reserved
7 reserved
3 The Program Blocks in Detail
3.4 The raw data of the ASI DIAG FB

ASI_DIAG
V30, Entry ID: 50897766 47

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Example
In the DataRecord_ASi_Slaves1 data structure, hence for Slave 1, the following
addresses are relevant:
Table 3-8
Address for
slave 1A
Address for
slave 1B
Meaning
DBX 2292.1 DBX 2296.1 Slave active (LAS)
DBX 2300.1 DBX 2304.1 Slave detected (LDS)
DBX 2308.1 DBX 2312.1 Slave configured (LPS)
DBX 2316.1 DBX 2320.1 I/O error (LPF)
The structure of DataRecord_ASi_Slaves2
For PROFIBUS/ ET200SP-AS-i master and CP343-1 (P), the lists LAS, LDS, LPS
and AS-i master flags required for the diagnosis are read via the
Get_lists_and_flags command and are stored in the DataRecord_ASi_Slaves2
data area.
Structure of the information
The following table shows the structure of the 32 bytes for
DataRecord_ASi_Slaves2:
Table 3-9
Byte Address in iDB Description
Byte [0] - Byte [7] DBB 2326 DBB 2333 List of activated slaves (LAS)
Byte [8] Byte [15] DBB 2334 DBB 2341 List of detected slaves (LDS)
Byte [16] Byte [23] DBB 2342 DBB 2349 List of configured slaves (LPS)
Byte [24] DBB 2350 AS-i master flags 1
Byte [25] DBB 2351 AS-i master flags 2
Byte [26] Byte [31] DBB 2352 DBB 2357 reserved
Bit granular description of the AS-i master flags
Assignment and meaning of the bits for AS-i Master Flags 1 are given below:
Table 3-10
Bit Meaning
0 OFFLINE_READY
1 APF
2 NORMAL_MODE
3 CONFIG_MODE
4 AUTO_ADDR_AVAIL
5 AUTO_ADDR_ASSIGN
6 LDS_0
7 CONFIG_OK

Assignment and meaning of the bits for AS-i Master Flags 2 are given below:
3 The Program Blocks in Detail
3.4 The raw data of the ASI DIAG FB

ASI_DIAG
V30, Entry ID: 50897766 48

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Table 3-11
Bit Meaning
0 OFFLINE
1 INTERNAL
2 EEPROM_OK
3 AUTO_ADDR_ENABLE
4 PERIPHERY_FAULT
5 reserved
6 reserved
7 MPO startup
Example
In the DataRecord_ASi_Slaves2 data structure, hence for Slave 1, the following
addresses are relevant:
Table 3-12
Address for
slave 1A
Address for
slave 1B
Meaning
DBX 2326.7 DBX 2330.7 Slave active (LAS)
DBX 2334.7 DBX 2338.7 Slave detected (LDS)
DBX 2342.7 DBX 2344.7 Slave configured (LPS)

The structure of Periphery_fault2
The still missing LPF list is read through the Read_I/O_fault_list command for
PROFIBUS/ ET200SP-AS-i master and CP343-1 (P) and is stored separately in
the Periphery_fault2 data area.
Structure of the information
The following table shows the structure of the 14byte for Periphery_fault2:
Table 3-13
Byte Address in iDB Description
Byte [0] - Byte [7] DBB 2358 DBB 2365 List of present periphery faults (LPF)
Byte [8] Byte [13] DBB 2366 DBB 2371 reserved
4 How to Work with the Example Project
4.1 Addresses of hardware components

ASI_DIAG
V30, Entry ID: 50897766 49

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

4 How to Work with the Example Project
This chapter shows how you can use the included ASI_DIAG_PROJECT STEP 7
project without any changes.
4.1 Addresses of hardware components
Network addresses
The SIMATIC station, the panel and the AS-i components have been configured
with the following addresses:

Figure 4-1

Module address
The AS-i masters are assigned the following addresses in the process image:
Table 4-1
AS-i Master Address
IE/AS-i link interface 1 8184
IE/AS-i link interface 2 8182
ET200SP AS-i Master 273
DP/AS-i link interface 1 124
CP343-1P 256

The symbolic flag tags are used throughout the STEP 7 project for the address and
the device type. This has the advantage that if the addresses in the project change,
they only have to be adjusted in one position.
4 How to Work with the Example Project
4.2 Using the STEP 7 project

ASI_DIAG
V30, Entry ID: 50897766 50

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The assignment is in network 1 of OB100.
Figure 4-2

4.2 Using the STEP 7 project
Parts of the STEP 7 project
The STEP 7 ASI_DIAG_PROJECT project contains the following elements:
Blocks, to conveniently provide diagnostic information of one or several AS-i
master systems for further evaluations in the STEP 7 user program and for
representation on a HMI panel or a web browser.
HMI templates to visualize the diagnostic information on a HMI panel.
User-defined web pages for visualizing the diagnostic information via the web
server of the CPU.
You can find these projects in the download section of this document
(see chapter 9).
4 How to Work with the Example Project
4.2 Using the STEP 7 project

ASI_DIAG
V30, Entry ID: 50897766 51

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Configuration notes
Note
The configurations below are already stored in the STEP 7 project
ASI_DIAG_PROJECT.

Login data
For full access (write and read rights) to the user-defined websites on the CPU a
previous login is required.
The login data as well as the respective rights are stored in the CPU properties in
STEP 7. In this example project, the user name and the password is siemens.
Figure 4-3

4 How to Work with the Example Project
4.2 Using the STEP 7 project

ASI_DIAG
V30, Entry ID: 50897766 52

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Cyclic interrupt
Employing the cyclic interrupts avoids putting unnecessary load on the cyclic OB 1.
The call intervals can be specified in the CPU properties.
Figure 4-4

4 How to Work with the Example Project
4.2 Using the STEP 7 project

ASI_DIAG
V30, Entry ID: 50897766 53

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Installing the STEP 7 project
Note
For the following installation instruction it is assumed that you are using the
STEP 7 project without any changes.
Changes in the hardware configuration and addresses require an adjustment of
the WinCC flexible projects (see chapter 5).

When using the STEP 7 ASI_DIAG_PROJECT project the steps below must be
followed:
Table 4-2
Step Function Screen/Comment
1. Set up your network in accordance with the
specifications in chapter 4.1 (Addresses of
hardware components).
Connect any number of AS-i slaves to the AS-i
networks
2. Connect one AS-i network with any number
of AS-i slaves per AS-i master.

3. The ACTUAL configuration has to be
accepted for all AS-i masters as SETPOINT
configuration.
The approach is described in the respective
manual (see chapter 9 References).
IE/AS-i link and DP/AS-i link: The
ACTUAL/SETPOINT transfer can take place via
the display.
For the ET200SP AS-i master the transfer is via
the SET button.
In the CP343-1 P the ACTUAL/SETPOINT
comparison is via STEP 7.
4. Unzip the
50897766_ASI_DIAG_Classic_CODE_S73
00.zip ZIP archive into a directory of your
choice.
The STEP 7 project is located in the
ASI_DIAG_PROJECT folder.
5. Open the SIMATIC MANAGER and navigate
to the project via File > Open.

6. Check the module address of your
AS-i master. If it deviates from your
configured address, the Master_Address
block parameter of ASI DIAG FB must be
adjusted each time it is called in the
organization blocks.
When using a CP343-2 (P) please ensure
that the address is located in the process
image of the CPU.
To facilitate the change of address, it is worked
with symbolic variables throughout the project.
Assigning the module addresses to the symbolic
variables is performed in network 1 of OB 100.
7. Save the changes.
8. Download the project into your controller.

4 How to Work with the Example Project
4.2 Using the STEP 7 project

ASI_DIAG
V30, Entry ID: 50897766 54

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Step Function Screen/Comment
9. Select the HMI station or Runtime and open
it.

10. WinCC flexible is opened.
Compile the project.

11. When the compilation was error free, load
the project into the panel.

4 How to Work with the Example Project
4.3 Operating the STEP 7 project

ASI_DIAG
V30, Entry ID: 50897766 55

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

4.3 Operating the STEP 7 project
In this example project the two visualization variants are enabled by connecting the
two inputs ASi_Web_DB and ASi_Panel_DB.
Figure 4-5

Visualization via the HMI panel
Loading the HMI projects onto the panel automatically starts Runtime with the
Diagnostic screen start screen.
Figure 4-6

The AS-i masters configured in this project have logged in at the master list of the
ASI PANEL FB and appear in the selection list.
4 How to Work with the Example Project
4.3 Operating the STEP 7 project

ASI_DIAG
V30, Entry ID: 50897766 56

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Figure 4-7

Select an AS-i master. The diagnostic information of the selected AS-i master is
displayed graphically at the next update.
Visualization via web
All files required for the visualization have already been converted to data blocks
with the help of the Web2PLC tool and transferred to the CPU memory by loading
the controller.
Enter the http://192.168.0.1 address in a web browser. The website of the CPU
opens up. Login with the following data:
User name: siemens
Password: siemens
Figure 4-8

Open the web visualization via CustomerPages > ASI_DIAG
Figure 4-9


5 WinCC Flexible Configuration
5.1 The WinCC flexible project

ASI_DIAG
V30, Entry ID: 50897766 57

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

5 WinCC Flexible Configuration
Enabling a diagnosis of your own AS-i environment requires adjustments in WinCC
flexible.
This chapter describes the necessary, individual adjustment of the HMI template,
as well as the configuration steps in WinCC flexible.
5.1 The WinCC flexible project
Description
The WinCC flexible projects are integrated in the STEP 7 project
ASI_DIAG_PROJECT. The integrated configuring allows direct access to the
STEP 7 configuration data. This offers the following advantages:
SIMATIC MANAGER is the central coordination point for configuring SIMATIC
controllers and WinCC flexible projects.
When configuring tags and area pointers, WinCC flexible provides direct
access to the STEP 7 icons.
Symbolic names in STEP 7 can be used in WinCC flexible.
Appropriate operator panels
The visualization screens were created for and adjusted to the following operator
panels:
MP277 8 (resolution corresponds to the 10 panel)
Runtime 15
Note
The pictures in the chapters below were all taken with Runtime 15.


5 WinCC Flexible Configuration
5.2 Using visualization screens

ASI_DIAG
V30, Entry ID: 50897766 58

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

5.2 Using visualization screens
Enabling a diagnosis of your own AS-i environment requires adjustments in WinCC
flexible.
Configuring a connection between CPU and panel
The Ethernet-based connection between CPU and panel must be configured
correctly to allow data exchange.
Open the WinCC flexible project and navigate to Connections. Adapt the panel's
and CPU's IP addresses to your requirements.
Figure 5-1

5 WinCC Flexible Configuration
5.2 Using visualization screens

ASI_DIAG
V30, Entry ID: 50897766 59

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Adjusting the area pointer
Using the area pointer of WinCC flexible enables detecting whether the connection
to the CPU has been established or terminated.
The area pointers are configuration fields and contain the size of a data area from
the controller. During communication, writing and reading occurs in turn between
controller and operator panel of this data area. By evaluating the data filed in the
data areas, controller and operator panel mutually trigger exactly defined actions.
Open the Area pointer tab under Connections. Change the address of the tags in
Coordination as follows:
DB [Instance data block number of your ASI PANEL FB].DBW718
Figure 5-2

5 WinCC Flexible Configuration
5.2 Using visualization screens

ASI_DIAG
V30, Entry ID: 50897766 60

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Coordinating access to tags
The images for the display of the AS-i line state are controlled via the tags from the
instance data block of the ASI PANEL FBs.
To make the project as flexible for the user as possible, the tags are not linked
directly to an address (e.g. DB201.DBW2), but indirectly using tag multiplexing.
This means that the tag address during runtime is adjusted depending on the value
of the b51__DB_Number index tag.
Figure 5-3

Tag multiplexing has the advantage, that the instance data block number of ASI
PANEL FB can be flexibly defined by the user. Instead of adjusting all WinCC
flexible tags, it is sufficient to modify only the index tag.
To do this, open the Tags list via Communication in WinCC flexible. Select the
b51__DB_Number index tag and enter the number of your instance data block for
the ASI PANEL FB as a start value in the tag properties.
Figure 5-4

5 WinCC Flexible Configuration
5.3 Adjusting the AS-i master selection list

ASI_DIAG
V30, Entry ID: 50897766 61

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

5.3 Adjusting the AS-i master selection list
As a next step the WinCC flexible project is expanded by the number of selectable
AS-i masters. This requires adjustments at several locations in the project.
The AS-i master is selected via a drop-down list. Here, all AS-i masters are
displayed whose ASI DIAG FBs have logged on in the master list of the ASI
PANEL FB.
Logic operating diagram of the selection list
The basis for creating the selection list, is the master list of the ASI PANEL FB.
All AS-i master blocks log on here with their instance data block number.
The display texts of the AS-i master in the selection list are managed dynamically
via the Master and Master_Name text lists.
While the order of the selection list is determined via the Master text list, the
Master_Name text list manages the suitable display text for each occurring
instance data block number.

Note
Text lists are objects from the WinCC flexible environment and assign the values
of a tag to different texts. The texts can be changed at will and created in several
languages too.
Text lists can be exported and imported into WinCC flexible in .csv format.
Please note chapter 8.3 (Exporting and importing text lists).

Behind each row of the Master text list there is the b51_ASi_DB_FB_x WinCC
flexible tag, which represents an entry of the master list of the ASI PANEL FB and
hence contains the instance data block number as information.
Using the Master_Name text list, the suitable display text is output for each
occurring instance data block number.
Both text lists are dynamically interconnected and, during runtime, they provide the
display of the AS-i master in correct order as well as the correct text in the
selection list.

5 WinCC Flexible Configuration
5.3 Adjusting the AS-i master selection list

ASI_DIAG
V30, Entry ID: 50897766 62

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The following figure shows the logic operating diagram for the structure of the
selection list based on a concrete example:
Figure 5-5

5 WinCC Flexible Configuration
5.3 Adjusting the AS-i master selection list

ASI_DIAG
V30, Entry ID: 50897766 63

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The sequence is represented as follows:
Table 5-1
Section Area Description
STEP 7 OB 1 Instance data block 105 was assigned to an ASI DIAG
FB and interconnected with the address of CP343-2P.
Master list In the initialization phase the block logs on at the master
list with the instance data block number (here: 105)
WinCC
flexible
Tags For each list position of the master list a WinCC flexible
tag was declared.
In this example, the block of the CP343-2P has logged on
first at the list. The respective WinCC flexible tag is also
b51_ASi_DB_FB_1
Master text list The Master text list reflects the order in the selection list.
Each row of the text list is linked with one of the
b51_ASi_DB_FB_x tags.
Value 0: b51_ASi_DB_FB_1
Value 1: b51_ASi_DB_FB_2
Value 2: b51_ASi_DB_FB_3
etc.
The tags provide reference to the master list in the
controller. The b51_ASi_DB_FB_1 tag, hence references
the master list position [0] and in this concrete example it
includes the number of the instance data block of the
CP343-2P (here: 105).
Master_Name
text list
The respective display text for the various numbers is
stored in the Master_Name text list. Here, the user must
enter the appropriate texts for all generated instance data
blocks. For the number 105, WinCC flexible finds the text
CP343-2P.
Runtime During runtime all logged on AS-i masters are included in
the selection list. The order is determined by the Master
text list in combination with the stored tags and their
values.

5 WinCC Flexible Configuration
5.3 Adjusting the AS-i master selection list

ASI_DIAG
V30, Entry ID: 50897766 64

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Changes at the user interface
The selection list can manage up to eight AS-i masters as default settings. Should
more devices be managed, you have to adjust the threshold.
Figure 5-6

List position entries
Each AS-i master is represented by a tag (b51_ASi_DB_FB_x), which points to a
position in the master list of the ASI PANEL FB.
As in chapter 0 (Managing the AS-i masters) the AS-i master blocks log on at the
master list with their instance data block number. The list position tags in WinCC
flexible reference to this information.
The allocation between list position tag in WinCC flexible and the master list must
follow the structure below:
Figure 5-7


For the first five positions in the master list, the respective tags have already been
integrated in WinCC flexible. Should you have more AS-i masters, you need to
create further list position tags.
In Communication you open the Tag table. For a better overview, sort the Name
column alphabetically by clicking on the column header. This way, the five list
position tags are listed one below the other.
5 WinCC Flexible Configuration
5.3 Adjusting the AS-i master selection list

ASI_DIAG
V30, Entry ID: 50897766 65

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Figure 5-8


The simplest option to add further list position tags is the following:
Select the row with an already configured tag and duplicate it, using copy & paste.
WinCC flexible adds the tag at the end of the tag table and automatically names it
with the next consecutive number. You only need to increment the address by
another two bytes.
Figure 5-9


You also have the option to create a new tag. Ensure that the tag name
corresponds to the b51_ASi_DB_FB_x format and the tag address points to the
next list position in the master list. The Acquisition mode for the tag must be
Cyclic continuous.
5 WinCC Flexible Configuration
5.3 Adjusting the AS-i master selection list

ASI_DIAG
V30, Entry ID: 50897766 66

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Integration of the AS-i master in the selection list
The display texts of the AS-i master in the selection list are managed dynamically
via the Master and Master_Name text lists.
The Master text list defines the number of AS-i masters appearing in the selection
list. Each AS-i master must be represented accordingly, with a separate entry in
the text list.
Open the text lists in Text and Graphics lists and select the Master text list.
Figure 5-10


Entries have already been preconfigured for the first five positions. If you have less
AS-i masters, the surplus entries have to be deleted. For more AS-i masters the list
must be expanded.
5 WinCC Flexible Configuration
5.3 Adjusting the AS-i master selection list

ASI_DIAG
V30, Entry ID: 50897766 67

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Deleting existing entries
When using fewer AS-i masters in your project, select the surplus entries and
delete them from the text list:
Figure 5-11

Adding further entries
If you wish to add further AS-i masters, select the last text list entry, duplicate it
with copy & paste and increment the entry in Value.
The Value column corresponds to the order in the selection list and reflects the list
positions in the master list of the ASI_HMI_FB at the same time.
Each row of the text list is linked with a tag of the b51_ASi_DB_FB_x type, which
as we already know represents a list position in the master list, and contains
the instance data block number of the logged on AS-i master as the information.
Select the Entry column in the just added row and assign the next available list
position tag.
Figure 5-12


5 WinCC Flexible Configuration
5.3 Adjusting the AS-i master selection list

ASI_DIAG
V30, Entry ID: 50897766 68

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Definition of the text display for the selection list
Now open the Master_name text list. Here, the instance data block numbers are
assigned with the text to be displayed.
Figure 5-13

The user program of STEP 7 requires an ASI DIAG FB call with appropriate
instance data block for each AS-i master.
Note down the respective number of the instance data block generated by STEP 7
for all AS-i masters.
This allocation is adopted in the Master_Name text list. Correct the number in the
Value column and enter the respective display test at Entry.
For further entries, you select an empty row and add new entries via the context
menu. The Value column is automatically incremented by WinCC flexible.
Figure 5-14

5 WinCC Flexible Configuration
5.4 Adjusting the AS-i slave information

ASI_DIAG
V30, Entry ID: 50897766 69

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

5.4 Adjusting the AS-i slave information
Logic operating diagram of the AS-i slave display
Similar to the AS-i masters, user-defined information can also be stored for the AS-
i slaves. By clicking on the slave, this information then appears during runtime in an
output field.
The display of the accompanying texts is also controlled via dynamic text lists here,
and referenced to the instance data block number of the AS-i master.
In WinCC flexible a Slave_Description main list and several slave sub-lists
Slave_NW_x are configured. The sub-lists manage the information for the slaves
of an AS-i master.
The AS-i masters, whose slave information shall be displayed are included in the
main list with their instance data block number and respective sub-list.
Behind each entry of the Slave_Description main list there is the WinCC flexible
b51__SlaveNr tag, which includes information in the form of a number of the slave
you clicked on.
The entry of the main list is selected via the b51_DB_active tag. This tag
references to the instance data block of ASI PANEL FB and contains the instance
data block number of the AS-i line active during runtime.
Figure 5-15


Both text lists are dynamically interconnected with each other and provide the AS-i
slave information for display at runtime.
5 WinCC Flexible Configuration
5.4 Adjusting the AS-i slave information

ASI_DIAG
V30, Entry ID: 50897766 70

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The following figure shows the logic operating diagram for the structure of the
selection list based on a concrete example:
Figure 5-16

5 WinCC Flexible Configuration
5.4 Adjusting the AS-i slave information

ASI_DIAG
V30, Entry ID: 50897766 71

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The sequence is represented as follows:
Table 5-2
Section Area Description
STEP 7 OB 1 Instance data block 102 was assigned to an ASI DIAG
FB and interconnected with the address of IE/AS-i link.
Runtime In runtime the IE/AS-i link was selected from the selection
list. The status of the respective slave is indicated in color.
The active instance data block is therefore DB 102.
WinCC
flexible
The slaves are represented by buttons and provided with
an event. When clicked, the slave number is saved in the
b51__SlaveNr tag (here: Slave 2; the tag therefore
receives the value 2).
Slave_Descrip
tion text list
The Slave_Description text list manages the AS-i
masters for whose slaves, information has been stored.
Each entry contains the respective instance data block
number of the AS-i master, the sub-list and a reference to
the b51__SlaveNr tag.
In this example the active instance data block is number
102 (IE/AS-i link). Using this number, the suitable entry is
found in the main list and the respective Slave_NW_2
sub-list is referenced.
Slave_NW_x
text list
The Slave_NW_x sub-lists manage the information for
each AS-i line. Slaves which are to display an item of
information, are included here with their number and a
suitable text.
The value of the b51__SlaveNr tag determines the active
row.
In the concrete example the row with Value = 2 is
referenced to, since b51__SlaveNr has the value 2.
Runtime Clicking a slave during runtime displays the stored
information in an output field.

Integration of the AS-i master in the main list
The information texts of the AS-i slave are dynamically managed via the
Slave_Description and Slave_NW_x text lists.
The Slave_Description text list coordinates the sub-list of the AS-i slaves
(referenced via its instance data block number) which are part of an AS-i master.
Each AS-i master, whose slaves shall display information, must be represented
accordingly with a separate entry in the text list.
Open the text lists in Text and Graphics lists and select the Slave_Descripton
text list.
For five AS-i lines the entries have already been defined in the main list and the
slave sub-lists been created. Should you have fewer AS-i masters, the surplus
entries can be deleted, for more masters the list must be expanded or corrected.
5 WinCC Flexible Configuration
5.4 Adjusting the AS-i slave information

ASI_DIAG
V30, Entry ID: 50897766 72

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Deleting surplus entries
To delete surplus entries from the main list, mark the respective row and delete it
via the context menu.
Figure 5-17


Select the slave sub-lists no longer required and also remove them from the
project.
Figure 5-18

5 WinCC Flexible Configuration
5.4 Adjusting the AS-i slave information

ASI_DIAG
V30, Entry ID: 50897766 73

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Changes in the main list
Correct the Value column in the Slave_Description text list. Use the numbers of
the instance data blocks for the AS-i masters from your STEP 7 project.
For further entries, select the last entry and add further entries via copy & paste.
Adjust the Value column.
If you wish to use an already existing slave sub-list for this AS-i master as well,
select it from the Entry column.
Otherwise, leave the Entry column since a new slave sub-list must be created
first.
Definition of the information for the AS-i slaves
Adding a new slave sub-list
For a new slave sub-list, go to the text list overview and select the last
Slave_NW_x slave sub-list. Add a new list with copy & paste. WinCC flexible
automatically increments the index x.
Figure 5-19

Go back to the Slave_Description and change the Entry column in the just added
row.
Figure 5-20

5 WinCC Flexible Configuration
5.4 Adjusting the AS-i slave information

ASI_DIAG
V30, Entry ID: 50897766 74

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Changes in the sub-lists
One sub-list can be created per AS-i master in order to save user-defined
information on the AS-i slaves.
One AS-i line can, depending on the specification, manage up to 64 slaves (31 A
slaves and 31 B slaves). Since WinCC flexible expects only integers in the Value
column, the slaves cannot be addressed with A or B. The following assignment has
therefore been defined:
Table 5-3
Slave in STEP 7 Value of b51__SlaveNr
1A
In WinCC flexible
this corresponds to
1
2A 2
3A 3

0B 32
1B 33
2B 34
3B 35


Open a sub-list and enter the slave number in Value and the associated text in
Entry.
Figure 5-21

5 WinCC Flexible Configuration
5.5 Implementing graphics

ASI_DIAG
V30, Entry ID: 50897766 75

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

5.5 Implementing graphics
User-defined images of AS-i masters or AS-i slaves are realized via graphic
input/output fields.
The coordination between graphic and AS-i master and slaves occurs in separate
graphics lists in WinCC flexible via the instance data block number or the slave
address.
A separate output field per AS-i line is required. For the AS-i master image, one
common output field is sufficient. All output fields are superimposed in the
visualization screen and shown or hidden as required. The rule applies that the AS-
i master output field must lie above all others.
A graphic of the AS-i master and the slaves can also appear next to the display
text.
Note
It is recommended to give each output field a meaningful name and assign it to a
separate layer in order to maintain a clear overview or to select the correct
output field when making changes. These can be shown or hidden on demand.
The layer assignment of this WinCC flexible project is available in section 8.2
(Visualization in the configuration view).

Coordination of the graphics
Using the assigned tags, the graphics lists coordinate which graphic appears in the
output field.
The visibility of the graphics output fields is controlled via defined states of tags.
The AS-i master graphic is hidden when the internal WinCC flexible tag is
b51__SlaveNr < 64.
The output fields of the AS-i lines are invisible if the respective instance data block
number of the AS-i line currently visible in runtime does not correspond to the
stored number.

Note
The output field measures 170x195 px. Please ensure that your graphics do not
exceed this size, otherwise the default settings in the project automatically scale
the picture to the correct size, which may lead to blurring.


5 WinCC Flexible Configuration
5.5 Implementing graphics

ASI_DIAG
V30, Entry ID: 50897766 76

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Graphics display of the AS-i masters
Properties of the graphics display
The graphic list_Master graphics list is used in conjunction with the
b51_DB_active tag to display the AS-i master images.
Figure 5-22


The tag points to the instance data block of the ASI PANEL FB and reads the
instance data block number of the currently displayed AS-i master (see chapter 0
(Managing the AS-i masters)).
Figure 5-23

5 WinCC Flexible Configuration
5.5 Implementing graphics

ASI_DIAG
V30, Entry ID: 50897766 77

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Showing and hiding the AS-i master graphic is controlled by a definition in WinCC
flexible.
Figure 5-24

Modifying the graphics display
To modify the graphics display of the AS-i master, select the graphic list_Master
graphics list in the Text and graphics lists menu.
To exchange the existing pictures, select the Entry column of the row to be
changed and open the selection window. Import your graphic and accept it as new
AS-i master picture.
Figure 5-25

5 WinCC Flexible Configuration
5.5 Implementing graphics

ASI_DIAG
V30, Entry ID: 50897766 78

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Graphics display of the AS-i slaves
Properties of the graphics display
The graphic list_Slave_x graphics lists are used in conjunction with the
b51_SlaveNr tag to display the AS-i pictures.
Figure 5-26

Clicking a slave during runtime writes the respective number to the tag (see
chapter 5.4 (Adjusting the AS-i slave information)).
Showing and hiding is controlled via the b51_DB_active tag (contains the currently
active instance data block number of an AS-i line). If this value lies outside of the
defined range, the graphic output field is hidden.
Figure 5-27


5 WinCC Flexible Configuration
5.5 Implementing graphics

ASI_DIAG
V30, Entry ID: 50897766 79

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Graphics output fields have already been integrated into the visualization picture
for five AS-i lines. The following definitions were used:
Table 5-4
AS-i line Layer Used instance data block
no
Used slave sub-list
DP/AS-i SS1 10 100 graphic list_Slaves_1
DP/AS-i SS2 11 102 graphic list_Slaves_2
CP343 12 103 graphic list_Slaves_3
IE/AS-i SS1 13 104 graphic list_Slaves_4
DP 20E 14 105 graphic list_Slaves_5
Modifying the existing output fields
To adjust such a graphic output field according to your requirements, please
proceed as follows (here the example of DP/AS-i SS1):
Switch off all layers up to layer 10 in WinCC flexible and select the output field.
Figure 5-28

5 WinCC Flexible Configuration
5.5 Implementing graphics

ASI_DIAG
V30, Entry ID: 50897766 80

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

You can determine the slave sub-list via the arrow next to Graphics list.
Figure 5-29


Note
Only the already existing graphics lists are displayed. If you wish to assign a new
slave sub-list to this output field, it must be previously created.


In Animation -> Visibility you can adjust the range in which this field shall be
visible. Here, you enter the instance data block number of your AS-i line.
Figure 5-30


To also edit the other output fields which have already been integrated, switch the
respective layer active and switch the previously processed layer off.
5 WinCC Flexible Configuration
5.5 Implementing graphics

ASI_DIAG
V30, Entry ID: 50897766 81

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Inserting new output fields
The copy & paste function is the simplest option of integrating further graphics
output fields into the visualization. Select a graphics output field for an AS-i line (to
do this, switch off all layers up to, for example layer 10) and duplicate it.
Change the slave sub-list, as described in the last section, as well as the area for
visibility.
In Properties -> Miscellaneous, create the Name and place the output field into
the next available layer.
Figure 5-31


Changes in the slave sub-list
To modify the graphics display of the AS-i slave, select the graphic list_Slave_x
graphics list to be changed in the Text and Graphics Lists menu. The number in
the Value column represents one each of the 62 possible slaves.
To exchange the existing pictures, select the Entry column of the row to be
changed and open the selection window. Import your graphic and accept it as new
AS-i slave image.
Figure 5-32


5 WinCC Flexible Configuration
5.5 Implementing graphics

ASI_DIAG
V30, Entry ID: 50897766 82

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

To enter a new slave graphic you select an empty row and add a new entry via the
context menu.
Figure 5-33


Enter the number of the respective slave in Value, and link a picture in the Entry
column.
Figure 5-34

5 WinCC Flexible Configuration
5.5 Implementing graphics

ASI_DIAG
V30, Entry ID: 50897766 83

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Creating a new slave sub-list
To create a new slave sub-list for a new AS-i line, select an empty line in the
graphics list overview and add a new list via the context menu.
Figure 5-35


To enter a new slave graphic, select an empty row and add a new entry via the
context menu.
Figure 5-36


Enter the number of the respective slave in Value, and link a picture in the Entries
column.
6 HTML Configuration
6.1 Using web pages

ASI_DIAG
V30, Entry ID: 50897766 84

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

6 HTML Configuration
Enabling a diagnosis of your own AS-i environment requires adjusting the web
pages to your hardware configuration.
This chapter describes the necessary individual adjustments.
6.1 Using web pages
Note
The web pages, as well as respectively required files, are coded as data blocks
and fragmented by the Web2PLC tool.
Modifying these files always requires a new generation of web data blocks (see
chapter 7.7 (Generating the web data blocks)).

Overview of the editable parameters
The information of the slaves, the label, addressing and the picture of the AS-i
master as well as the display text for tooltip and legend are controlled via XML files.
The following XML files are used:
Table 6-1
File name Responsible for...
SlavesX.xml Slave information (e.g. MLFB, application location,
etc.)
Master.xml Display text in the AS-i master selection list
Module address of AS-i Master
Path specification of the AS-i master screen
Texte_de.xml
Texte_en.xml
Tooltip texts
Status display texts
6 HTML Configuration
6.1 Using web pages

ASI_DIAG
V30, Entry ID: 50897766 85

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Structure of an XML file
The structure of an XML file is specified and must not be changed.
An XML file consists of several elements headed by a root element.
Each element is integrated into the XML structure by means of a <> start tag and
an </> end tag and can be fitted with unique attributes for meta information.
In the example of the Master.xml XML file, this structure is represented as follows:
Figure 6-1

Table 6-2
Structure element Description
<Infos> </Infos> Root element; outermost element of the XML structure.
<Master id=1> </Master> First element; additional attribute for unique
identification.
<DB_no> </DB_no> Second child element of <Master>
1 Text content of child element

The following characteristics must be noted:
Each XML element must have an opening and a closing tag.
XML distinguishes between lower and upper case letters (e.g. <DB_NR>
cannot be completed with </db_nr>).
An XML structure must only be headed by a single root element.
Umlauts and special characters are not permitted with XML and must be
specifically formatted.
6 HTML Configuration
6.2 Adjusting the AS-i master information

ASI_DIAG
V30, Entry ID: 50897766 86

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

6.2 Adjusting the AS-i master information
Changing the instance data block number
For a diagnosis of your AS-i network, the instance data block number of the AS-i
master must be correctly stored in the Master.xml XML file.
Proceed as follows:
Table 6-3
Step Function Screen/Comment
1. Open the html folder in the STEP 7 project
directory under Web2PLC > ASI_DIAG.
This directory contains all of the files required for
the user-defined web pages.
2. Select the Master.xml XML file and open it
with an editor, for example, Notepad.

3. Two AS-i masters are entered here as an
example.
Change the instance data block number
according to your requirements for masters.
If necessary, add further masters with the
same structure as the existing ones, or
delete those which are no longer necessary.

4. Save the XML file.
6 HTML Configuration
6.2 Adjusting the AS-i master information

ASI_DIAG
V30, Entry ID: 50897766 87

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Adjusting the AS-i master display
The display text of the AS-i master in the selection list, as well as the image path
are also managed via the Master.xml text file.
Figure 6-2

The child element <Name> contains the name of the AS-i master on the web
interface and the path details on the AS-i master picture <Image>.
Change these child elements according to your requirements and save the XML
file.
Note
The ./MasterX.gif images are located in the HTML folder.
If you wish to use a different picture than the one specified, please ensure this
picture is placed and integrated with the correct path details starting from the
HTML folder.

6 HTML Configuration
6.3 Adjusting the AS-i slave information

ASI_DIAG
V30, Entry ID: 50897766 88

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

6.3 Adjusting the AS-i slave information
Similar as for the AS-i master, user-defined information can also be stored for AS-i
slaves. They will then appear in an output field by clicking the mouse on the slave.
The slave information is stored in the SlavesX.xml XML file, the X stands for the
respective master.
The assignment is analogous to the master list of the ASI WEB FB (see chapter 0
Managing the AS-i masters):
Table 6-4
XML file name Master
Slaves0.xml Master 1
Slaves1.xml Master 2
Slaves2.xml Master 3

Figure 6-3

6 HTML Configuration
6.4 Adapting the display texts

ASI_DIAG
V30, Entry ID: 50897766 89

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

For each slave, a separate element is reserved which can be allocated directly to
the slave via the id attribute.
The following division applies:
Table 6-5
id range Slave
id = 1 to id = 31 Slave 1A to slave 31A
Id=32 Slave 0
id = 33 to id = 63 Slave 1B to slave 31B
Change this slave information according to your requirements and save the XML
file.

Note
Elements which were not used must not be deleted, but must be defined with an
empty string (e.g. <Slave id = 4></Slave>).

6.4 Adapting the display texts
The tooltip texts and the status texts on the web visualization are also controlled
via an XML file (Texte_xx.xml) and can be adjusted on demand.
Figure 6-4


The <Tooltip> element includes the split tooltip text which appears when moving
the mouse over a slave button.
The <Statustext> element contains the display texts for the various slave statuses.
Change these elements according to your requirements and save the XML file.
6 HTML Configuration
6.5 Accessing user-defined web pages

ASI_DIAG
V30, Entry ID: 50897766 90

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

6.5 Accessing user-defined web pages
Downloading the web data blocks into the CPU and enabling the web server gives
you the option to access the standard or user-defined web pages.
This procedure is illustrated in the instruction below:
Table 6-6
Step Function Screen/Comment
1. Make sure that the S7-300 and the PC are
located in a common Ethernet network or are
directly interconnected via a standard
Ethernet cable.

2. Open a web browser and enter the URL
"http://ww.xx.yy.zz". Here,
"ww.xx.yy.zz" corresponds to the IP address
of the S7-300 CPU. (192.168.0.1)

3. The introduction page of the web server
opens

4. You need to log in at the web server to be
able to perform certain actions in the CPU or
to write variables to the CPU.
Enter the name: siemens.
The user name corresponds to the one
entered when enabling the web server in
User administration (see chapter 6.5
(Accessing user-defined web pages)).
In the provided STEP 7 project the password
is siemens.
Transfer the login data by pressing the
RETURN key or Login.

5. Go to Customer Pages in the navigation
menu.

6 HTML Configuration
6.5 Accessing user-defined web pages

ASI_DIAG
V30, Entry ID: 50897766 91

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Step Function Screen/Comment
6. The web browser calls the page which
provides access to the standard page of the
user-defined web application. Click on the
link.


7. The start page of the web application opens
in a new window.


7 The ASI_DIAG Library
7.1 Prerequisites for using the blocks

ASI_DIAG
V30, Entry ID: 50897766 92

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

7 The ASI_DIAG Library
This chapter describes how the ASI_DIAG library can be included in STEP 7 and
the blocks be integrated into the user program.
Overview of the blocks
In order to integrate the diagnostic function described in this document into your
own STEP 7 project, the following blocks are required:
ASI DIAG FB
ASI_CTRL
In addition, for the HMI visualization:
ASI PANEL FB
ASI PANEL CONTROL FB
In addition, for the web visualization:
ASI WEB FB
ASI WEB CONTROL FB
ASI WEB INTERFACE DB
WWW
These blocks are included in the STEP 7 ASI_DIAG block library. You can find this
library in the download section of this document (see chapter 9).
7.1 Prerequisites for using the blocks
For the use of the diagnostic blocks, some points have to be observed.
Table 7-1
Step Function Screen/Comment
1. Open STEP 7 and create a new project.
2. Create a hardware configuration appropriate
for your setup.

7 The ASI_DIAG Library
7.1 Prerequisites for using the blocks

ASI_DIAG
V30, Entry ID: 50897766 93

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Step Function Screen/Comment
3. When using a CP343-2, please check
whether the module is located in the process
image of the CPU.
If necessary, please extend the size of the
process image of the CPU.

4. Manually add the connected AS-i slaves for
each AS-i master. If the AS-i slaves have
already been addressed, you can have the
AS-i line configuration be read in
automatically.
Note:
The disadvantage of automatic reading in is
that no detailed information is stored in the
configuration. From the AS-i Slave ID it
cannot be determined exactly which slave is
used.

5. Enable the diagnostic interrupts for the AS-i
masters as well as the automatic addressing,
if necessary.
Close the dialog box with OK.

6. When using cyclic interrupt OBs, the cyclic
interrupt time must be set in the CPU.
Recommended time: 10000ms (10s).

7 The ASI_DIAG Library
7.2 Integrating the library into STEP 7 V5.5

ASI_DIAG
V30, Entry ID: 50897766 94

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Step Function Screen/Comment
7. Save and compile the hardware configuration.
Load it in your controller.


7.2 Integrating the library into STEP 7 V5.5

Note
Since the library blocks interact with each other, the symbolic block names must
not be changed.

Table 7-2
Step Function Screen/Comment
1. Unzip the
50897766_ASI_DIAG_Classic_CODE_S730
0.zip ZIP archive into a directory of your
choice.
The STEP 7 library is located in the
ASI_DIAG_LIB folder and the files required for
the web visualization are located in the
HMTL_FILES folder.
2. Open the Libraries tab in the SIMATIC
MANAGER via File > Open.

3. Navigate to the just extracted file and open
the ASI_DIAG library file.

4. The ASI_DIAG library appears. The block
folder contains all blocks relevant for the
diagnosis.

5. Copy the blocks required by you into your
STEP 7 project.

7 The ASI_DIAG Library
7.3 Using library blocks

ASI_DIAG
V30, Entry ID: 50897766 95

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Step Function Screen/Comment
6. If necessary, create error interrupts and cyclic
interrupts.

7. Save your project.

7.3 Using library blocks
Diagnosing more than one AS interface line in a project requires a separate ASI
DIAG FB with unique instance data block for each individual line.
Principally, there are two options to call the individual ASI DIAG FBs.
1. All ASI DIAG FBs are triggered simultaneously.
2. The ASI DIAG FBs are called up in sequence.

Note
In the first variant all AS-i master blocks are enabled in the same cycle and then
processed. Therefore, this option is only recommended when using a maximum
of four AS-i masters in your project.
Generally, variant 2 is preferred!

7 The ASI_DIAG Library
7.3 Using library blocks

ASI_DIAG
V30, Entry ID: 50897766 96

C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Option 1: simultaneous call
For this method, all ASI DIAG FB blocks are called simultaneously in the
organization blocks (OB 1, error/cyclic interrupt OBs). Inputs EN and REQ as well
as the BUSY output remain unconnected.
This means, that in the case of an error or cyclic interrupt, the ASI DIAG FB
blocks are enabled and further processed in OB 1.
The following picture shows the procedure using two AS-i lines. This call is
identical for all organization blocks (OB 1, OB 8x, OB 3x).
Figure 7-1


Processing the blocks in OB1 without trigger, requires interconnecting the REQ
input with a positive edge.

Note
The diagnostic data is read from the modules using SFB 52/SFB 53 (read/write
data record). Depending on the CPU type, only a certain number of SFB calls
can be processed in parallel. Further information is available in the following
FAQ: BID:15364459.


7 The ASI_DIAG Library


ASI_DIAG
V30, Entry-ID: 50897766 97



Copyright Siemens AG 2013 All rights reserved
The interaction between function block and organization block is illustrated in the following flowchart:
Figure 7-2


7 The ASI_DIAG Library


ASI_DIAG
V30, Entry ID: 50897766 98



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Option 2: sequential processing
The individual ASI DIAG FBs are called in sequence in the cyclic user program
OB 1. The step chain is interconnected via the parameters BUSY and REQ.
This procedure is illustrated in the figure below:
Figure 7-3


In the cyclic interrupts or the error OBs it is sufficient to only call the Start ASI
DIAG FB. In the case of errors or cyclic interrupts, this block is enabled and further
processed in OB1.
Due to the mutual interconnection in OB1, the first block triggers the sequential
processing of the subsequent ASI DIAG FB.

7 The ASI_DIAG Library


ASI_DIAG
V30, Entry ID: 50897766 99



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

The required call in the error or cyclic interrupt OBs is given in the figure below:
Figure 7-4


Processing the blocks in OB1 without trigger requires interconnecting the REQ
input at the first ASI DIAG FB in OB1 with a positive edge.

The interaction between function blocks and organization blocks is illustrated in the
flowchart below:
7 The ASI_DIAG Library


ASI_DIAG
V30, Entry ID: 50897766 100



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d


Figure 7-5

7 The ASI_DIAG Library


ASI_DIAG
V30, Entry ID: 50897766 101



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

7.4 Initializing the blocks
By means of a call, the following instruction shows you how to integrate the library
blocks into your project and how to configure them.
Configuring the blocks
The function blocks ASI PANEL FB, ASI WEB FB, ASI PANEL CONTROL FB,
ASI WEB CONTROL FB and WWW have no parameters and are called without
any changes in the organization blocks.
ASI DIAG FB has input and output parameters. The following table shows, which
parameters need to be interconnected depending on the call environment:
Table 7-3
Type Tag Data type Default value Interconnection necessary?
I
n
p
u
t

EN BOOL 1 No
Master_Address DINT L#0 Yes;
the logic address for PN IO modules is the
diagnostic address, for PB and central
modules the lowest output byte.
ASi_Web_DB DINT L#0 Yes, if web visualization is desired. The
number of the instance data block of the
ASI WEB FB is entered here.
No, if no web visualization shall occur.
ASi_Panel_DB DINT L#0 Yes, if HMI visualization is desired. The
number of the instance data block of the
ASI PANEL FB is entered here.
No, if no HMI visualization shall occur.
MASTER_ID INT L#0 Yes;
Device type of the AS-i master; the following
applies
1: IE/AS-i LINK Advanced
2: DP/AS-i (F-)Link, CP343-1 (P), DP/AS-I
Link (Adv.)
3: ET200SP AS-i Master
REQ BOOL 1 In OB 8x and OB 3x: No
In OB 1:
No, if the block shall only be processed
in the case of an error or cyclic
interrupt.
Yes, if the block shall also be processed
in the normal case, or if the FBs are
configured as a step chain (interconnect
BUSY and REQ).
7 The ASI_DIAG Library


ASI_DIAG
V30, Entry ID: 50897766 102



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Type Tag Data type Default value Interconnection necessary?
O
u
t
p
u
t

BUSY BOOL 0 In OB 8x and OB 3x: No
In OB 1:
No, if ASI DIAG FB is called in
parallel.
Yes, if the ASI DIAG FBs are
configured as step chain (interconnect
BUSY and REQ).
ERROR BOOL 0 Yes, to cause a response in the other user
program in the event of an error.

Note
When using double masters, it must be ensured that two ASI DIAG FBs, hence,
two different addresses (diagnostic address or output byte, see above) are
required as input parameters.

The block call
The number of configured AS-i lines depends on the how many calls of the ASI
DIAG FBs you require.
The ASI PANEL FB and ASI PANEL CONTROL FB are required for the optional
WinCC flexible visualization and only have to be integrated in the OB 1 of the user
program.
The ASI WEB DIAG, ASI WEB CONTROL FB and WWW are required for the
optional web visualization and only have to be integrated in the OB 1 of the user
program.
Table 7-4
Step Function Screen/Comment
1. Only required for HMI visualization:
Open OB 1 and call
ASI PANEL FB as well as
ASI PANEL CONTROL FB. You are
prompted to enter an instance data block
number each. After confirming the respective
dialog box, STEP 7 automatically generates
the data blocks.
The two blocks have no parameters.
Note: memorize the number of the ASI
PANEL FB instance data block. This
number must be entered at the
ASi_Panel_DB input of the ASI DIAG FB,
as well as in the WinCC flexible project.

7 The ASI_DIAG Library


ASI_DIAG
V30, Entry ID: 50897766 103



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Step Function Screen/Comment
2. Only required for web visualization:
Create a new network and call the ASI WEB
FB as well as the
ASI WEB CONTROL FB. You are
prompted to enter an instance data block
number each. After confirming the respective
dialog box, STEP 7 automatically generates
the data blocks.
The two blocks have no parameters.
Note: memorize the number of the ASI
WEB FB instance data block. This number
must be entered at the ASi_Web_DB input
of the ASI DIAG FB.

3. Create a new network and call up WWW.
This block is responsible for the interaction
between website and CPU.
Enter the number 333 at the CTRL_DB input
parameter. Enter the memory word 846 at
the RET_VAL output parameter.

4. Mandatory requirement for AS-i
diagnosis:
Create a new network and call ASI DIAG
FB. Here, you must also enter an instance
data block number. After confirming the
dialog box, STEP 7 automatically generates
the data block.

5. Add further ASI DIAG FBs, depending on
the number of AS-i lines to be diagnosed
with respective new instance data blocks.

6. Configure the input and output parameters of
the ASI DIAG FB.
If the ASI DIAG FBs shall all be processed
simultaneously, it is not necessary to
interconnect the BUSY and REQ bits.
For several ASI DIAG FB calls, interlinking the
blocks via BUSY and REQ is recommended (see
chapter 7.4 (Initializing the blocks)).
7. Save OB 1.
8. Open an error or cyclic interrupt OB.
9. When using the all blocks simultaneously
method in OB 1, copy all networks from OB1
which contain an ASI DIAG FB call.
Add the networks into the error or cyclic
interrupt.

10. For the Interlinking the ASI DIAG FBs
method in OB 1, it is sufficient to copy and
paste the network with the start ASI DIAG
FB.

7 The ASI_DIAG Library


ASI_DIAG
V30, Entry ID: 50897766 104



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Step Function Screen/Comment
11. The blocks have already been configured by
copying the networks.

12. Save the OBs.
Locking the blocks for ET200SP-AS-i Master
Note
The following additional programming is only required if you are using an
ET200SP-AS-i master and the visualization via WEB or HMI.

The ASI DIAG FB diagnostic block as well as the control blocks
ASI PANEL CONTROL FB and ASI WEB CONTROL FB are using the
command interface of the AS-i master.
Since the ET200SP-AS-i master can only process one command via this interface
and not several at the same time, the diagnostic block and the control blocks have
to be locked from each other.
Locking is performed via the REQ bit of the ASI_CTRL block from the control
blocks.
Add the following code lines before calling the diagnostic block for the ET200SP
AS-i master:
Figure 7-6

7 The ASI_DIAG Library


ASI_DIAG
V30, Entry ID: 50897766 105



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

7.5 Enabling the web server
The web server of the CPU must be enabled for accessing the standard or user-
defined web pages.
Table 7-5
Step Function Screen/Comment
1. Open the hardware configuration of your
STEP 7 project. Select the CPU and its
properties.
Open the Web tab.
Enable the Web server and the Automatic
Update

2. Writing variables via the web server requires
special authorization.
Create a new user via Add.


3. Assign a name and define the rights for this
new user.
Click into the password field and assign a
password. Also acknowledge the password in
the neighboring input field.

Close the dialog box with OK.

4. Save and compile the hardware
configuration.


7 The ASI_DIAG Library


ASI_DIAG
V30, Entry ID: 50897766 106



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

7.6 Creating a Web2PLC project
The following table contains an instruction for creating a Web2PLC project:
Table 7-6
Step Function Screen/Comment
1. For this purpose, select the block folder of
your STEP 7 project and open the Web2PLC
tool via the context menu.



2. Select New > New Project to create a
new project.

3. Assign a project name and acknowledge it
with OK.

7 The ASI_DIAG Library


ASI_DIAG
V30, Entry ID: 50897766 107



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Step Function Screen/Comment
4. A new project was created and saved in the
directory of your STEP 7 project in the
Web2PLC > [PROJECT NAME] folder.

5. All the files for the web visualization are
located in the
50897766_ASI_DIAG_CODE_CLASSIC_V3
0 > HTML_FILES folder. Copy the content of
the Web2PLC > [PROJECT NAME] >
HTML folder created by Web2PLC

6. Open the project settings via File > Change
Project Settings in the Web2PLC tool.


7 The ASI_DIAG Library


ASI_DIAG
V30, Entry ID: 50897766 108



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Step Function Screen/Comment
7. The HTML folder already refers to the html
folder of your Web2PLC program. Define the
start page of the web application via the
button at Start html page.

8. Select ASI_DIAG_xx.htm as the start page.

9. Store the project via File > Save Project.


7 The ASI_DIAG Library


ASI_DIAG
V30, Entry ID: 50897766 109



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

7.7 Generating the web data blocks
The web pages, as well as respectively required files, are coded and fragmented
as data blocks by the Web2PLC tool.
Modifying these files always requires a new generation of the web data blocks.
Table 7-7
Step Function Screen/Comment
1. Select the block folder of the STEP 7 project
and open the Web2PLC tool via the context
menu.



2. The data blocks are generated in several
steps.

3. First, export the symbols from the STEP 7
project.

4. The export must be completed without errors.

7 The ASI_DIAG Library


ASI_DIAG
V30, Entry ID: 50897766 110



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Step Function Screen/Comment
5. Generate the data source.

6. The data blocks must be generated without
errors. The generated blocks and their sizes
appear in the output window.

7. Compile the data source.

8. The blocks must be generated and compiled
without errors.

7 The ASI_DIAG Library


ASI_DIAG
V30, Entry ID: 50897766 111



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Step Function Screen/Comment
9. Store the project via File > Save Project.

10. To ensure that all necessary blocks are
downloaded to the CPU, select the SIMATIC
station in STEP 7 and download it to your
CPU.
Make sure that the S7-300 and the PC are
located in a common Ethernet network or are
directly interconnected via a standard
Ethernet cable.


7 The ASI_DIAG Library


ASI_DIAG
V30, Entry ID: 50897766 112



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

7.8 Changing the block properties to non-retain
As described in chapter 0 (Reset after CPU restart), the visualization and control
blocks are reset to initialization values via the Non Retain block property.
Select the respective instance data block and open the block properties in the
STEP 7 block folder. Enable the non-retain function in the second tab and close
the dialog window by clicking OK.
Figure 7-7

7.9 Loading the blocks into the CPU
Inserting the library blocks into your user program automatically prompts STEP 7 to
update the block folder with further system function blocks. These blocks are used
internally by ASI DIAG FB.
To ensure that all necessary blocks are downloaded to the CPU, select the
SIMATIC station in STEP 7 and download it to your CPU.
Figure 7-8


8 Tips and Tricks


ASI_DIAG
V30, Entry ID: 50897766 113



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

8 Tips and Tricks

Note
In this section no concrete code solutions are given. Instead, tips & tricks are
illustrated for modifying and setting up the program.

8.1 Avoiding unnecessary processing of blocks
The aim of the AS-i diagnostic function library is a visual display of the AS-i
masters status and their connected slaves.
A change in status should subsequently also cause a change in the display.
Transferring these requirements to the programming level, it can be said that it is
normally sufficient assuming all diagnostic FBs were called at least once for
initialization to enable and process only the ASI DIAG FB of the affected AS-i
master in the event of an error. Cyclic processing in OB1, even without a status
change, is not relevant for the display in the HMI.
This means, that the ASI DIAG FBs are only called in OB 1. They are not
interconnected with each other (see chapter 7.3 (All ASI DIAG FBs are triggered
simultaneously.).
In the error OBs 8x only an evaluation of the diagnostic address occurs as well as
setting the REQ bits for the ASI DIAG FB of the affected AS-i master.
In the next cycle the associated block in OB1 detects a positive edge at the REQ
input and the block is processed.
Such programming can be realized according to the structure below:
8 Tips and Tricks


ASI_DIAG
V30, Entry ID: 50897766 114



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Figure 8-1


NOTICE If a master does not trigger a diagnostic interrupt for a slave I/O fault, it makes
sense to program an additional diagnostic FB call via cyclic interrupt OBs to be
able to monitor all status changes on the HMI or web browser.
8 Tips and Tricks


ASI_DIAG
V30, Entry ID: 50897766 115



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

8.2 Visualization in the configuration view
The AS-i diagnostic overview screen in WinCC flexible consists of many individual
elements, which partly may also overlap.
For a better overview, the objects were assigned to different display layers, which
can be hidden or shown on demand.
Figure 8-2

The table below shows, which objects belong to which layer:
Table 8-1
Layer Objects
Layer 0 All texts and frames
Layer 1 All current elements such as buttons for displaying the slave
status, the selection list of the AS-i masters, the output field
and the display of the AS-i master status.
Layer 2 Grayed elements which only become visible in the event of
an error.
Layer 10 and higher Slave pictures
Layer 10: DP/AS-i SS1
Layer 11: DP/AS-i SS2
Layer 12: CP343
Layer 13: IE/ASI SS1
Layer 14: DP 20E
Layer 3 Layer 6 Error messages (one per layer)
Layer 20 Master pictures

8 Tips and Tricks


ASI_DIAG
V30, Entry ID: 50897766 116



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

8.3 Exporting and importing text lists
WinCC flexible provides the option to import or export text lists in .csv format. This
has the huge advantage that all information can be clearly managed and edited in
one file and that they can furthermore be imported into other projects or display
devices.
Exporting text lists
During the export, all information from the text lists are stored in a .csv file. You can
either export all lists or only a certain selection of lists.
The list selection and the storage path can be determined in the CSV export
dialog. Select the Operator panel in the Project window and open CSV export
via the context menu.
Figure 8-3


8 Tips and Tricks


ASI_DIAG
V30, Entry ID: 50897766 117



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Enable the text lists and specify the storage path.
Figure 8-4


Select the text lists to be exported via Options.
Figure 8-5


8 Tips and Tricks


ASI_DIAG
V30, Entry ID: 50897766 118



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Start the export process via the Export button.
Figure 8-6


The information of the text lists is now located as .csv file in the specified path.
Importing text lists
To make the information from the text lists also available to other display devices,
or after modifying the text lists outside of WinCC flexible, the .csv file can be
imported.
Select the Operator panel in the Project window and open CSV import via the
context menu.
Figure 8-7


8 Tips and Tricks


ASI_DIAG
V30, Entry ID: 50897766 119



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

Enable the text lists, permit overwriting of text lists currently stored on the operator
panel, and navigated to the .csv file. Trigger the export process via the Import
button.
Figure 8-8


Note
If only selected text lists were exported, the export file will also only contain these
selected lists. When importing this file, only the text lists that are included the
.csv file will be overwritten.

9 References


ASI_DIAG
V30, Entry ID: 50897766 120



C
o
p
y
r
i
g
h
t


S
i
e
m
e
n
s

A
G

2
0
1
3

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d

9 References
Table 9-1
Topic Title
\1\ Siemens Industry Online
Support
http://support.automation.siemens.com
\2\ Download page of the entry http://support.automation.siemens.com/WW/view/en/50897766
\3\ ET200SP AS-i Master manual Manual CM AS-i Master ST for SIMATIC ET 200SP
http://support.automation.siemens.com/WW/view/en/71756485
\4\ IE/AS-i LINK PNIO manual Manual SIMATIC NET IE/AS-INTERFACE LINK PN IO
http://support.automation.siemens.com/WW/view/en/22712154
\5\ DP/AS Link Advanced manual Manual DP/AS-Interface Link Advanced
http://support.automation.siemens.com/WW/view/en/22710305
\6\ DP/AS-i Link 20E manual Manual DP/AS-Interface Link 20E acc. to V3.0
http://support.automation.siemens.com/WW/view/en/33563718
\7\ AS-i F-Link manual Manual DP/AS-i F-Link V1.0 (Edition 10/2006) with
Supplements (Edition 04/2011)
http://support.automation.siemens.com/WW/view/en/24196041
\8\ CP343-2 (P) manual Manual CP 343-2 / CP 343-2 P AS-Interface Master (Issue
08/2008) with supplements (Issue 08/2010)
http://support.automation.siemens.com/WW/view/en/5581657
\9\ AS-I system manual AS interface system manual (Edition 11/2008)
http://support.automation.siemens.com/WW/view/en/26250840
\10\ Supplements to system
manual
Supplements to AS interface system manual
http://support.automation.siemens.com/WW/view/en/44365425
\11\ AS-i slaves manuals Manuals of the AS interface slaves
http://support.automation.siemens.com/WW/view/en/10805898/133300


History
Table 0-1
Version Date Modifications
V1.0 08/2007 First version
V2.0 06/2011 Complete revision
V2.1 05/2012 Expansion via the visualization via a web browser
V3.0 09/2013 Complete revision of the blocks
integration of the ET200SP-AS-i Master

You might also like