applications & tools - siemens

73
Applications & Tools Answers for industry. Cover Diagnostics of Communication Connections of Industrial Ethernet CPx43-1 via STEP 7 and WinCC flexible User Interface CP343-1 and CP443-1 Application Description June 2010

Upload: others

Post on 19-Apr-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Applications & Tools - Siemens

Applications & Tools

Answers for industry.

Cover

Diagnostics of Communication Connections of Industrial Ethernet CPx43-1 via STEP 7 and WinCC flexible User Interface

CP343-1 and CP443-1

Application Description June 2010

Page 2: Applications & Tools - Siemens

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 2

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

42

453

077

_C

on

nect

ionD

iag

no

stic

_v1

0_e

.do

c

Industry Automation and Drives Technologies Service & Support Portal

This article is taken from the Service Portal of Siemens AG, Industry Automation and Drives Technologies. The following link takes you directly to the download page of this document.

http://support.automation.siemens.com/WW/view/en/42453077

If you have any questions about this document, please contact us at the following e-mail address:

[email protected]

Page 3: Applications & Tools - Siemens

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 3

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

SIMATIC Connection Diagnostics CPx43-1

FB170 “SR_DIAG” and FB171 “S7_DIAG”

Automation Task

1

Automation Solution

2 Function Mechanisms of this Application

3

Configuration and Settings

4

Installation

5 Starting up the Application

6

Operating the Application

7

Links & Literature

8

History

9

Page 4: Applications & Tools - Siemens

Warranty and Liability

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 4

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

42

453

077

_C

on

nect

ionD

iag

no

stic

_v1

0_e

.do

c

Warranty and Liability Note The application examples are not binding and do not claim to be complete

regarding configuration, equipment and any eventuality. The application examples do not represent customer-specific solutions. They are only intended to provide support for typical applications. You are responsible for ensuring that the described products are used correctly. These application examples do not relieve you of the responsibility to use sound 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 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 accept no liability for 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 shall be excluded. Such an exclusion shall 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”). However, claims arising from a breach of a condition which goes to the root of the contract shall be limited to the foreseeable damage which is intrinsic to the contract, unless caused by intent or gross negligence or based on mandatory liability for injury of life, body or health. The above provisions do not imply a change in the burden of proof to your detriment.

It is not permissible to transfer or copy these Application Examples or excerpts thereof without express authorization from Siemens Industry Sector.

Page 5: Applications & Tools - Siemens

Table of Contents

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 5

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Table of Contents Warranty and Liability ................................................................................................. 4

1 Automation Task................................................................................................ 7

1.1 Overview .............................................................................................. 7

2 Automation Solution ......................................................................................... 8

2.1 Overview of the overall solution ........................................................... 8 2.2 Description of the core functionality ................................................... 12

Process sequence of main functionality............................................. 12 2.3 Used hardware and software components......................................... 14 2.4 Performance data............................................................................... 15

Functions STOP and START ............................................................. 16

3 Function Mechanisms of this Application .................................................... 17

3.1 Diagnosing the SEND/RECEIVE connections with FB170 “SR_DIAG”19 3.1.1 Input and output parameters of FB170 “SR_DIAG” ........................... 19 3.1.2 Sequence of FB170 “SR_DIAG” ........................................................ 20 3.1.3 HMI interface ...................................................................................... 24 3.1.4 Functions............................................................................................ 27 3.1.5 Error evaluation .................................................................................. 28 3.2 Diagnosing SEND/RECEIVE connections with the FB270

“SR_DIAG_400” ................................................................................. 29 3.2.1 Input and output parameters of FB270 “SR_DIAG_400” ................... 29 3.2.2 Sequence of FB270 “SR_DIAG_400” ................................................ 30 3.2.3 HMI interface ...................................................................................... 31 3.2.4 Functions............................................................................................ 32 3.2.5 Error evaluation .................................................................................. 33 3.3 Diagnosing S7 connections with FB171 “S7_DIAG”.......................... 34 3.3.1 Sequence of FB171 “S7_DIAG”......................................................... 34 3.3.2 HMI interface ...................................................................................... 36

4 Configuration and Settings ............................................................................ 40

4.1 Configuring the communication connections ..................................... 40 4.1.1 Configuring the SEND/RECEIVE connection .................................... 40 4.1.2 Configuring the S7 connection ........................................................... 42 4.2 Programming the communication blocks for the data exchange ....... 44 4.2.1 Programming the communication function blocks for the data

exchange via SEND/RECEIVE connections...................................... 44 4.2.2 Programming the communication function blocks for data exchange

via S7 connections ............................................................................. 44 4.2.3 Programming the communication function blocks for data transfer with

FTP..................................................................................................... 45

5 Installation........................................................................................................ 46

5.1 Installation of the hardware ................................................................ 46 5.2 Installing the software......................................................................... 49 5.3 Application software installation ......................................................... 49

6 Starting up the Application............................................................................. 50

6.1 Preparation......................................................................................... 50 6.2 Commissioning the multi panel MP277 8’’ Touch .............................. 50 6.2.1 Hardware configuration ...................................................................... 50 6.2.2 Loading WinCC flexible Runtime ....................................................... 52 6.3 Commissioning the S7 station A ........................................................ 53 6.3.1 Loading the hardware configuration................................................... 53 6.3.2 Loading the communication connections........................................... 54

Page 6: Applications & Tools - Siemens

Table of Contents

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 6

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

6.3.3 Calling and configuring the function blocks FB170 “SR_DIAG” and FB171 “S7_DIAG”, and loading the user program............................. 55

6.4 Commissioning the S7 station B ........................................................ 56 6.4.1 Loading the hardware configuration................................................... 56 6.4.2 Loading the communication connections........................................... 57 6.4.3 Loading the user program .................................................................. 58

7 Operating the Application............................................................................... 59

7.1 Overview ............................................................................................ 59 7.2 Connection overview of the SEND/RECEIVE connections................ 60 7.3 Connection overview of the S7 connections ...................................... 62

Connection status............................................................................... 63 7.4 Details view of the SEND / RECEIVE connection diagnostic ............ 64 7.4.1 Visualizing the status information....................................................... 65 7.4.2 Functions............................................................................................ 67 7.4.3 Job status ........................................................................................... 68 7.5 Details view of the S7 connection diagnostic ..................................... 69 7.5.1 Visualizing the status information....................................................... 70

8 Links & Literature ............................................................................................ 72

8.1 Internet Links...................................................................................... 72

9 History............................................................................................................... 73

Page 7: Applications & Tools - Siemens

1 Automation Task

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 7

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

1 Automation Task

1.1 Overview

Introduction

In order to diagnose communication connections which are configured for data exchange via an Industrial Ethernet communication module (CP) of S7-300, the NCM S7 diagnostic is normally used. The NCM S7 diagnostic tool is integrated in STEP 7 and provides a clear overview of the status of the configured communication connections. The disadvantage here is that the status information of the NCM S7 diagnostic cannot be visualized on an operator panel or a control system.

In this application example we show you how the status of the communication connections in the user program of the CPU can be determined and visualized on an operator panel with little configuration and programming workload.

Overview of the automation task

The figure below provides an overview of the automation task.

Figure 1-1

Partner stations

S7 Station A

CP

HMI Multi Panel

S7 Station B S7 Station C S7 Station D

n connections via CP

Diagnostic of the connections

Industrial Ethernet

Description of the automation task

Visualizing the status of the configured communication connection of the Industrial Ethernet CP on an HMI Multi Panel using WinCC flexible requires:

analyzing all communication connections of the Industrial Ethernet CP and

storing them for the HMI Multi Panel in the user program of the CPU.

Page 8: Applications & Tools - Siemens

2 Automation Solution

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 8

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

2 Automation Solution

2.1 Overview of the overall solution

Schematic layout

The following figure displays the most important components of the solution:

Figure 2-1

CP

S7-300 Station A S7-300 Station B

n connections

SIMATIC Field PG MP277 8‘‘ Touch

FB170 “SR_DIAG“FB171 “S7_DIAG“

Partnerstation

SCALANCE X208

CP

U

Setup

The S7-300 stations A and B are connected at the Industrial Ethernet network via communication processors (CP343-1). The data exchange between the S7-300 stations A and B occurs via several, different communication connections with standard functions.

The function blocks FB170 “SR_DIAG” and FB171 “S7_DIAG” supplied with this application are implemented in the user program of S7-300 station A. These compact function blocks determine the status information of the communication connections, which have been configured on S7-300 station A for the Industrial Ethernet CP343-1.

Table 2-1 gives an overview of the communication connections and standard functions configured and programmed on S7-300 station A for the data exchange via CP343-1.

Page 9: Applications & Tools - Siemens

2 Automation Solution

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 9

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Table 2-1

Connection start ID Connection type Service Standard functions

active 1 S7 connection PUT / GET FB14 “GET” and FB15 “PUT”

active 2 S7 connection PUT / GET FB14 “GET” and FB15 “PUT”

active 3 S7 connection PUT / GET FB14 “GET” and FB15 “PUT”

passive 4 S7 connection BSEND / BRECV

FB12 “BSEND” and FB15 “BRECV”

passive 1 ISO-on-TCP connection

SEND / RECEIVE

FC5 “AG_SEND” and FC6 “AG_RECV”

passive 2 ISO-on-TCP connection

SEND / RECEIVE

FC5 “AG_SEND” und FC6 “AG_RECV”

passive 3 TCP connection SEND / RECEIVE

FC5 “AG_SEND” and FC6 “AG_RECV”

passive 4 TCP connection SEND / RECEIVE

FC5 “AG_SEND” und FC6 “AG_RECV”

passive 5 ISO-on-TCP connection

FETCH -

passive 6 ISO-on-TCP connection

WRITE -

- 7 TCP connection FTP FB40 “FTP_CMD”

- 8 UDP connection (multicast)

SEND / RECEIVE

FC5 “AG_SEND” and FC6 “AG_RECV”

Page 10: Applications & Tools - Siemens

2 Automation Solution

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 10

Copyright Siemens AG 2010 All rights reserved

Table 2-2 shows an overview of the communication connections which can be diagnosed with the supplied function blocks FB170 “SR_DIAG” and FB171 “S7_DIAG”.

The determined status information is structured stored in the instance data block of FB170 and FB171 and displayed on the HMI Multi Panel in WinCC flexible.

For diagnosing the communication connections configured on an S7-400 station for the Industrial Ethernet CP443-1, the FB270 “SR_DIAG_400” is available to you.

Table 2-2

Interface Function block Connection type Service

CP343-1 CP443-1 Integrated PN interface

FB171 “S7_DIAG” S7 connection PUT / GET X - -

FB171 “S7_DIAG” S7 connection BSEND / BRECV X - -

FB171 “S7_DIAG” S7 connection USEND / URECV X - -

FB170 “SR_DIAG” TCP connection AG_SEND / AG_RECV X - -

FB170 “SR_DIAG” TCP connection FETCH / WRITE X - -

FB170 “SR_DIAG” ISO transport connection AG_SEND / AG_RECV X - -

FB170 “SR_DIAG” ISO transport connection FETCH /WRITE X - -

FB170 “SR_DIAG” ISO-on-TCP connection AG_SEND / AG_RECV X - -

FB170 “SR_DIAG” ISO-on-TCP connection FETCH / WRITE X - -

FB170 “SR_DIAG” UDP connection (including multicast and broadcast) AG_SEND / AG_RECV X - -

FB170 “SR_DIAG” TCP connection FTP X - -

FB270 “SR_DIAG_400” TCP connection AG_SEND / AG_RECV - X -

FB270 “SR_DIAG_400” TCP connection FETCH / WRITE - X -

FB270 “SR_DIAG_400” ISO transport connection AG_SEND / AG_RECV - X -

FB270 “SR_DIAG_400” ISO transport connection FETCH / WRITE - X -

FB270 “SR_DIAG_400” ISO-on-TCP connection AG_SEND / AG_RECV - X -

FB270 “SR_DIAG_400” ISO-on-TCP connection FETCH / WRITE - X -

FB270 “SR_DIAG_400” UDP connection (including multicast and broadcast) AG_SEND / AG_RECV - X -

FB270 “SR_DIAG_400” TCP connection FTP - X -

Page 11: Applications & Tools - Siemens

2 Automation Solution

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 11

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Note In chapter “Performance Data” of the manual of the respective Industrial Ethernet CP (CP343-1 or CP443-1) you find information on the max. number of possible connections.

The HMI Multi Panel is connected to the same Industrial Ethernet network as the S7-300 stations. Via S7 connection it accesses the CPU of S7-300 station A, to read the structured status information of the communication connection from the instance data block of FB170 “SR_DIAG” and FB171 “S7_DIAG”. The read status information is displayed on the HMI Multi Panel in WinCC flexible Runtime.

Topics not covered by this application

This application does not contain a description

of the standard functions for the Industrial Ethernet CP343-1 or CP443-1 to exchange data via communication connections.

for configuring WinCC flexible

for operating the HMI Multi Panel

Basic knowledge of these topics is required.

Manuals are available to you on the internet as downloads providing you with detailed information on the standard functions for the data exchange via Industrial Ethernet CP (see \3\ and \16\).

The manuals of WinCC flexible 2008 are available to you as downloads on the internet (see \10\, \11\, \12\ and \17\).

The manual on HMI MP277 8’’ Touch is available to you as download on the internet (see \1\).

Required knowledge

Basic knowledge on using WinCC flexible, HMI Multi Panels and communication mechanisms of the Industrial Ethernet CPs is assumed.

Page 12: Applications & Tools - Siemens

2 Automation Solution

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 12

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

2.2 Description of the core functionality

Process sequence of main functionality

Table 2-3

No. Action Note

1. In the CPU the status information of all S7 and SEND/RECEIVE connections of the Industrial Ethernet CPs are read cyclically by FB170 “SR_DIAG” and FB171 “S7_DIAG”.

CPU of S7-300 station A

2. The status information is structured stored in the instance data blocks of FB170 and FB171.

CPU of S7-300 station A

3. Structured status information is read from the instance data blocks of FB170 and FB171 and displayed in several pictures in WinCC flexible Runtime.

HMI Multi Panel

4. Start screen

5. Overview of connections

Page 13: Applications & Tools - Siemens

2 Automation Solution

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 13

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

No. Action Note

6. Details view of a connection The details view contains the user information on connection status, connection type and connection number of a particular, selected connection. Note: Information on data transmission, e.g. number of sent and received data, are not displayed in the details view.

Advantages of this solution

The user has a reduced configuration and programming workload due to compact function blocks.

The user can quickly implement the prepared pictures of the visualization in his own HMI user interface.

No additional tool / SIMATIC field PG is required for the connection diagnostic.

Page 14: Applications & Tools - Siemens

2 Automation Solution

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 14

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

2.3 Used hardware and software components

The application has been set up with the following components:

Hardware components

Table 2-4

Component Qty. MLFB / order number Note

CPU 315-2DP 1 6ES7315-2AG10-0AB0 V2.6

CP343-1 Advanced 1 6GK7343-1GX30-0XE0 V1.0

CPU 319-3PN/DP 1 6ES7 318-3EL00-0AB0 V2.8

CP343-1 Lean 1 6GK7 343-1CX10-0XE0 V2.1

MP277 8’’ Touch 1 6AV6643-0CB01-1AX1

Standard software components

Table 2-5

Component Qty. MLFB / order number Note

STEP 7 V5.4 SP5 1 6ES7810-4CC08-0YA5 or higher

WinCC flexible 2008 SP1

1 6AV6612-0AA51-3CA5 or higher

Example files and projects

The following list contains all files and projects used in this example.

Table 2-6

Component Note

42453077_diagnostic_v10.zip This zip file contains the STEP 7 project

42453077_ConnectionDiagnostic_v10_e.pdf This document

Page 15: Applications & Tools - Siemens

2 Automation Solution

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 15

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

2.4 Performance data

Supported S7-300 Industrial Ethernet CPs

Table 2-7 contains an overview of the S7-300 Industrial Ethernet CPs which support FC10 “AG_CNTRL” and hence also FB170 “SR_DIAG”.

Table 2-7

Component MLFB Firmware

CP343-1 Lean 6ES7343-1CX10-0XE0 as of V2.1

CP343-1 6ES7343-1EX20-0XE0 as of 1.3.9

CP343-1 6ES7343-1EX21-0XE0 as of 1.0.17

CP343-1 6ES7343-1EX30-0XE0 as of 2.0.16

CP343-1 IT 6ES7343-1GX20-0XE0 as of 1.1.4

CP343-1 Advanced 6ES7343-1GX21-0XE0 as of 1.0.24

CP343-1 Advanced 6ES7343-1GX30-0XE0 as of 1.0.23

Supported S7-400 Industrial Ethernet CPs

Table 2-8 contains an overview of the S7-400 Industrial Ethernet CPs which support FC10 “AG_CNTRL” and hence also FB270 “SR_DIAG_400”.

Table 2-8

Component MLFB Firmware

CP443-1 6ES7443-1EX20-0XE0 as of 1.0.26

CP443-1 Advanced 6ES7443-1EX41-0XE0 as of 1.0.24

CP443-1 Advanced 6ES7443-1GX20-0XE0 as of 2.0

Function blocks FB170, FB270 and FB171

All communication connections listed in Table 2-2 can be diagnosed with function blocks FB170 “SR_DIAG”, FB171 “S7_DIAG” and FB270 “SR_DIAG_400”.

The call of FC10 “AG_CNTRL” from the SIMATIC_NET_CP CP 300 Blocks library has been implemented in FB170 “SR_DIAG”, i.e. the communication connections of the S7-300 Industrial Ethernet CPs listed in Table 2-7 can be diagnosed with FB170.

The call of FC10 “AG_CNTRL” from the SIMATIC_NET_CP CP 400 Blocks library has been implemented in FB270 “SR_DIAG_400”, i.e. the communication connections of the S7-400 Industrial Ethernet CPs listed in Table 2-8 can be diagnosed with FB270.

Using FB171 “S7_DIAG” only the S7 connections of CP343-1 can be diagnosed. The S7 connections of CP443-1 or the integrated PN interface of a CPU are not diagnosed (see Table 2-2).

The status information of max 64 connections is stored in the instance data blocks of FB170, FB270 and FB171.

Page 16: Applications & Tools - Siemens

2 Automation Solution

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 16

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Functions STOP and START

Table 2-9 contains an overview of the Industrial Ethernet CPs, on which the commands CMD 6 “CN_DISCON” and CMD 7 “CN_STARTCON” of FC10 “AG_CNTRL” are supported and on which therefore the functions STOP and START are available.

Table 2-9

Component MLFB Firmware

CP343-1 Advanced 6ES7343-1GX30-0XE0 as of V1.0.23

CP443-1 Advanced 6ES7443-1GX20-0XE0 as of V2.0

CP443-1 6ES7443-1EX20-0XE0 as of V1.0.26

Page 17: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 17

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

3 Function Mechanisms of this Application

General overview

Figure 3-1

CP

S7-300 Station A S7-300 Station B

S7 connectionSEND/RECEIVE connection

SIMATIC Field PG MP277 8‘‘ Touch

FB170 “SR_DIAG“FB171 “S7_DIAG“

Partnerstation

SCALANCE X208C

PU

STEP 7WinCC flexible

WinCC flexible Runtime

Between the CP343-1 in S7-300 stations A and B there are several S7 connections and SEND/RECEIVE connections via which data exchange is handled. Function blocks FB170 “SR_DIAG” and FB171 “S7_DIAG” are used to determine the status information of the configured connections and save it in the instance data block.

Program overview

Figure 3-2

S7-300 Station A

OB1DB170

FB170

FC10 “AG_CNTRL“

DB171

FB171

FC62 “C_CNTRL“

MP277 8‘‘ Touch

WinCC flexible Runtime

Status informationSEND/RECEIVE connection

Status informationS7 connection

Function blocks FB170 “SR_DIAG” and FB171 “S7_DIAG” are cyclically called in the user program of S7-300 station A. They internally call the functions FC10 “AG_CNTRL” or FC62 “C_CNTRL”. This way status information, e.g. connection type and connection status, is determined, and structured stored in the instance data blocks for visualization. The saved status information is transferred to multi panel MP2Z7 8’’ Touch and displayed in WinCC flexible Runtime.

Page 18: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 18

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

User program of S7-300 station A

The user program of S7-300 station A consists of the following blocks:

Table 3-1

Block Symbolic name Description

OB1 CYCL_EXC In OB1 the function blocks FB170 and FB171 including the appropriate instance data blocks DB170 and DB171 are called cyclically.

FB170 SR_DIAG Internally FB170 calls the function block FC10 “AG_CNTRL” with various commands (CMD). Amongst other things, the status information of the SEND/RECEIVE connections is determined this way and can be prepared for visualization.

FB171 S7_DIAG Internally FB171 calls the function block FC62 “C_CNTRL”. Status information of the S7 connections is determined this way and can be prepared for visualization.

DB170 iDB_SR_DIAG In instance data block DB170 the status information of the SEND/RECEIVE connections is saved.

DB171 iDB_S7_DIAG In instance data block DB171 the status information of the S7 connections is saved.

UDT170 UDT_170 The user-defined data type UDT170 has been implemented in instance data block DB170. Here the status information of all SEND/RECEIVE connections is saved (connection numbers 1 to 64).

FB100 SR_COMM Internally FB100 calls up the communication function for the data exchange via the configured SEND/RECEIVE connections.

FB200 S7_COMM Internally FB200 calls up the communication function for the data exchange via the configured S7 connections.

DB100 iDB_SR_COMM Instance data block of FB100

DB200 iDB_S7_COMM Instance data block of FB200

DB101 SR_SendData In DB101 the send data for the data exchange via the configured SEND/RECEIVE connections are saved..

DB102 SR_ReceiveData DB102 contains the data, which are received via the configured SEND/RECEIVE connections.

DB201 S7_SendData In DB201 the send data for the data exchange via the configured S7 connections are saved.

DB202 SR_ReceiveData DB202 contains the data, which are received via the configured S7 connections.

Page 19: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 19

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

3.1 Diagnosing the SEND/RECEIVE connections with FB170 “SR_DIAG”

Function block FB170 “SR_DIAG” is used for diagnosing the SEND/RECEIVE connections of the CP343-1. Figure 3-3 illustrates the call of FB170 in the user program of the CPU. FB170 is called cyclically in OB1.

3.1.1 Input and output parameters of FB170 “SR_DIAG”

FB170 “SR_DIAG” has an input parameter “LADDR”. At the input parameter “LADDR” you enter the module start address of the Industrial Ethernet CP343-1. The module start address is available in STEP 7 in the hardware configuration (see chapter 6.4.2 “Loading the communication connections”).

Figure 3-3

FB170

DB170

LADDRWORD

Page 20: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 20

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

3.1.2 Sequence of FB170 “SR_DIAG”

Overview

Figure 3-4 illustrates the sequence of FB170 “SR_DIAG”.

Figure 3-4

ID = connection number = 0

call FC10 “AG-CNTRL“ with CMD 0

call FC10 “AG-CNTRL“ with CMD 1

Determining the maximum number of configurable connections

Determining the connection type and status for dispaly in theconnection overview

HMI_CONN_RESET = TRUE

call FC10 “AG_CNTRL“ with CMD 2

HMI_CONN_STOP = TRUE

HMI_CONN_START = TRUE

call FC10 “AG_CNTRL“ with CMD 6

call FC10 “AG_CNTRL“ with CMD 7

yes no

yes no

yes no

yes no

• Error evaluation• Save the maximum number of configurable connections in the

instance DB• Prepare data for display in the details view

FB170 “SR_DIAG” encapsulates the call of FC10 “AG_CNTRL” from the “SIMATIC_NET_CP CP 300 Blocks” library with various commands (CMD) for determining:

the connection status and connection type of SEND/RECEIVE connections

the number of maximum configurable SEND/RECEIVE connections, as well as for realizing various functions e.g.:

Resetting the connection (RESET)

Disconnecting (START)

Establishing the connection (STOP)

Page 21: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 21

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Input and output parameters of FB10 “AG_CNTRL”

FC10 “AG_CNTRL” has the following input and output parameters.

Figure 3-5

FC10 „AG_CNTRL“

BOOL

INT

WORD

INT

ACT

ID

LADDR

CMD

BOOL

BOOL

WORD

DWORD

DWORD

DONE

ERROR

STATUS

RESULT1

RESULT2

Table 3-2

Input parameters Data type Description

ACT BOOL 1: function call 0: no function call and the block is quit immediately

ID INT Connection number The connection number is contained in the configuration.

LADDR WORD Module start address The module start address of the CP is contained in the hardware configuration.

CMD INT Command at FC10 “AG_CNTRL” Table 3-4 gives an overview of all possible commands.

Table 3-3

Output parameters Data type Description

DONE BOOL 1: job executed 0: job still processed or not triggered yet At DONE=1 the output parameters RESULT1 and RESULT2 can be evaluated.

ERROR BOOL Error code 1: error 0: no error

STATUS WORD Status code

RESULT1 DWORD Information returned according to command sent to FC10 “AG_CNTRL”

RESULT2 DWORD Can only be evaluated for S7-400. Part 2 of information according to the command sent to FC10 “AG_CNTRL”

Page 22: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 22

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Commands of the FC10 “AG_CNTRL”

The following commands can be configured at FC10 “AG_CNTRL” and be evaluated by the Industrial Ethernet CP:

Table 3-4

CMD Description

0 NOP no operation The block is processed without job for the CP.

1 CN_STATUS connection status This command provides the status of the connection selected with ID.

2 CN_RESET connection reset This command resets the connection selected with ID

3 CN_STATUS_ALL all connections status This command provides the connection status of all connections.

4 CN_RESET_ALL all connections reset This command resets all connections.

5 CN_CLEAR_RESET Resetting the reset identifier This command resets the reset identifier of the connection selected with ID. This command is only required in special cases.

6 CN_DISCON connection disconnect This command disconnects the connection selected with ID and LADDR (stop connection).

7 CN_STARTCON start connection This command establishes a connection selected with ID and LADDR and previously disconnected with CMD 6 (CN_DISCON).

Determining the connection type and status for the display in WinCC flexible

For connection number = 0 the FC10 “AG_CNTRL” is called with the input parameter CMD=0.

For each further connection number > 0 the FC10 “AG_CNTRL” is called with the input parameter CMD=1 and the job result of the output parameter RESULT1 and RESULT2 is evaluated.

The job result of the output parameter RESULT1 and RESULT2, which contains information on connection type and status, is evaluated and filed in the instance data block DB170 in a structure (see Table 3-7).

For the command CMD=1 the job result of the output parameters RESULT1 and RESULT2 is structured as follows:

Table 3-5

Parameters Hex value/ area

Bit Description

Bit 0-3: Display for the send direction

Bit 0 Connection type 0: no send or receive connection 1: connection reserved for send and receive jobs

RESULT1 0000 000*(hex)

Bit 1 Status of current job 0: no send job currently processed 1: send job currently processed not relevant

Page 23: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 23

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Parameters Hex value/ area

Bit Description

Bit 2+3 previous job not relevant

Bit 4-7: display for the receive direction

Bit 4 Connection type 0: no send or receive connection 1: connection reserved for send and receive jobs

Bit 5 Status of current job 0: no receive job currently processed 1: receive job currently processed not relevant

RESULT1 0000 00*0(hex)

Bit 6+7 Previous job not relevant

Bit 8-11: display for FETCH / WRITE

Bit 8 Connection type 0: no FETCH connection 1: connection reserved for FETCH jobs

Bit 9 Connection type 0: no WRITE connection 1: connection reserved for WRITE jobs

Bit 10 Job status (FETCH / WRITE) 0: job status OK 1: job status NOT OK not relevant

RESULT1 0000 0*00(hex)

Bit 11 Status FETCH / WRITE job 0: there is no job 1: a job from the LAN is currently processed not relevant

Bit 12-15: general CP information

Bit 12+13 Information on the connection status 00: connection cancelled 01: connecting process running 10: disconnecting process running 11: connection established

Bit 14 CP information (STOP/RUN) not relevant

RESULT1 0000 *000(hex)

Bit 15 Reset identification nicht relevant

RESULT1 **** 0000(hex) Bit 16-31 reserved for later expansion

RESULT2 0000 0000(hex) reserved for later expansion

Page 24: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 24

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Determining the maximum number of configurable SEND/RECEIVE connections

The maximum number of configurable SEND/RECEIVE connections is determined automatically. When calling the FC10 “AG_CNTRL” with the input parameter CMD=1 the value of the output parameter STATUS is evaluated.

If the value of the output parameter STATUS provides the value 8186H, then the maximum number of configurable SEND/RECEIVE connections is determined via the connection number specified at the input parameter ID and stored in the instance data block DB170 (see Table 3-6).

3.1.3 HMI interface

The data required for the visualization is stored in the instance data block DB170 in the following tags (see Table 3-6). These tags are integrated into WinCC flexible and form the HMI interface. This enables displaying the data stored in the tags at the HMI Multi Panel or the tags can be set by the HMI Panel.

Table 3-6

Address DB170

Tag Data type Description

32.0 CONN Array [0..65] of UDT 170

Status information of all configurable SEND/RECEIVE connections

296.0 MAX_CONNECTION Int Maximum number of configurable SEND/RECEIVE connections

298.0 HMI_CONN Int Connection number

300.0 HMI_Detail Bool Details view activated/deactivated

300.1 HMI_CONN_STOP Bool Stop SEND/RECEIVE connection

300.2 HMI_CONN_START Bool Start SEND/RECEIVE connection

300.3 HMI_CONN_RESET Bool Reset SEND/RECEIVE connection

301.0 HMI_CONN_TYPE Byte Connection type

302.0 HMI_CONN_STATUS Byte Connection status

303.0 HMI_CONN_RESERVE1 Byte Reserve

304.0 HMI_CONN_RESERVE2 Byte Reserve

306.0 HMI_CMD_STATUS Int Job status

Page 25: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 25

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Setup of UDT 170

The relevant status information of all configured SEND/RECEIVE connections, e.g. connection type and connection status, are stored in the instance data block DB170 in CONN array of data type UDT 170.

The user-defined data type UDT170 is structured as follows:

Table 3-7

Tag Data type

Value (bin) Value (dec)

Description

0000 0000 0 connection type is unknown

0000 0001 1 SEND/RECEIVE connection

0000 0010 2 FETCH connection

0000 0100 4 WRITE connection

CONN_TYPE Byte

0000 1000 8 undefined connection type

0000 0000 0 connection is disconnected

0000 0001 1 establishment is in process

0000 0010 2 disconnection is in process

CONN_STATUS Byte

0000 0011 3 Connection is established

RESERVE_1 Byte 0000 0000 0 Reserve

RESERVE_2 Byte 0000 0000 0 Reserve

The status information stored in the CONN array is implemented in WinCC flexible in the connection overview.

Details view

The HMI_Detail tag of data type Bool is controlled by the HMI Multi Panel. If the HMI_Detail tag has the value “true”, then the following status information of a selected SEND/RECEIVE connection is updated for the display in the details view and stored in the instance data block DB170.

Table 3-8

Tag Data type Status information

HMI_CONN Int connection number

HMI_CONN_STATUS Byte connection status

HMI_CONN_TYPE Byte connection type

HMI_CMD_STATUS Int error code

Connection status

In HMI_CONN_STATUS tag of data type Byte the connection status of the selected SEND/RECEIVE connection is stored for the display in the details view.

Table 3-9 shows the value range of the HMI_CONN_STATUS tag.

Table 3-9

Value (bin) Value (dec) Connection status

0000 0000 0 connection is disconnected

0000 0001 1 establishment is in process

0000 0010 2 disconnection is in process

0000 0011 3 connection is established

Page 26: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 26

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Connection type

In HMI_CONN_TYPE tag of data type Byte the connection type of the selected SEND/RECEIVE connection is stored for the display in the details view.

Table 3-10 shows the value range of the HMI_CONN_STATUS tag.

Table 3-10

Value (bin) Value (dec) Connection type

0000 0000 0 connection type is unknown

0000 0001 1 SEND/RECEIVE connection

0000 0010 2 FETCH connection

0000 0100 4 WRITE connection

0000 1000 8 undefined connection type

Connection number

In HMI_CONN tag of data type Integer the connection number is stored. The tag is set via the HMI Multi Panel in connection overview of the SEND/RECEIVE connection.

If the value of the HMI_CONN tag is larger than the determined maximum number of configurable SEND/RECEIVE connections, the HMI_CONN tag is set to value 1(dec).

If the value of the HMI_CONN tag is smaller than 1 (dec), the HMI_CONN tag is set to the determined maximum number of configurable SEND/RECEIVE connections.

Job status

The HMI_CMD_STATUS tag data type integer is implemented in the details view of SEND/RECEIVE connection. It displays the job status of the functions STOP, START und RESET.

Table 3-11 shows an overview of the job status of functions STOP, START and RESET and the value of the HMI_CMD_STATUS tag.

Table 3-11

Value of the HMI_CMD_STATUS (dec) tag

Job status

0 request is completed successfully

1 function not available

2 command isn’t allowed

9 general failure

Page 27: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 27

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

3.1.4 Functions

The tags of the instance data block DB170 listed in Table 3-12 are implemented in the details view of the SEND/RECEIVE connection diagnostic and can therefore be controlled via the HMI Multi Panel to realize different functions.

If the tags are controlled to value “true” a job for resetting, stopping or starting a certain, selected SEND/RECEIVE connection is initiated.

Table 3-12

Tag Data type Function

HMI_CONN_STOP Bool 0: no function 1: STOP (stop the connection)

HMI_CONN_START Bool 0 = no function 1 = START (start the connection)

HMI_CONN_RESET Bool 0 = no function 1 = RESET (reset the connection)

Reset the connection (RESET)

If the HMI_CONN_RESET tag of the type BOOL has the value “true”, then the FC10 “AG_CNTRL” is called with input parameter CMD=2. This resets the connection specified at the input parameter ID via the connection number.

If the job was completed successfully or with error, then the HMI_CONN_RESET tag is reset to value “false”.

If the job was completed with error, than there is an additional error evaluation (see chapter 3.1.5 “Error evaluation”).

Stop the connection (STOP)

If the HMI_CONN_STOP tag of the type BOOL has the value “true”, then the FC10 “AG_CNTRL” is called with input parameter CMD=6. This stops the connection specified at the input parameter ID via the connection number.

If the job was completed successfully or with error, then the HMI_CONN_STOP tag is reset to value “false”.

If the job was completed with error, than there is an additional error evaluation (see chapter 3.1.5 “Error evaluation”).

Start the connection (START)

If the HMI_CONN_START tag of the type BOOL has the value “true”, then the FC10 “AG_CNTRL” is called with input parameter CMD=7. This starts the connection specified at the input parameter ID via the connection number and which was previously stopped with CMD=6.

If the job was completed successfully or with error, then the HMI_CONN_START tag is reset to value “false”.

If the job was completed with error, than there is an additional error evaluation (see chapter 3.1.5 “Error evaluation”).

Page 28: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 28

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

3.1.5 Error evaluation

If the start, stop or reset job of the FC10 “AG_CNTRL” is transferred successfully to the Industrial Ethernet CP then the HMI_CMD_STATUS tag is set to value 0 (dec).

If one of the jobs of FC10 “AG_CNTRL” was not successfully transferred to the Industrial Ethernet CP and completed with error, then the value of the output parameter STATUS is evaluated.

For the display in the details view a value is assigned to the HMI_CMD_STATUS tag according to the value at the output parameter STATUS.

Table 3-13

Value at output parameter STATUS (hex)

Value of the HMI_CMD_STATUS (dec)

tag

Job status

0000 0 request is completed successfully

80B0

8189

1 function not available

8187 2 command isn’t allowed

8xxx 9 general failure

Page 29: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 29

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

3.2 Diagnosing SEND/RECEIVE connections with the FB270 “SR_DIAG_400”

Function block FB270 “SR_DIAG” is used for diagnosing the SEND/RECEIVE connections of the CP443-1. Figure 3-6 illustrates the call of FB270 in the user program of the CPU. FB270 is called cyclically in OB1.

3.2.1 Input and output parameters of FB270 “SR_DIAG_400”

Analog to FB170 “SR_DIAG”, the FB270 “SR_DIAG_400” has the input parameter “LADDR”. At the input parameter “LADDR” you enter the module start address of the Industrial Ethernet CP443-1. The module start address is available in STEP 7 in the hardware configuration.

Figure 3-6

FB270

DB270

LADDRWORD

Page 30: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 30

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

3.2.2 Sequence of FB270 “SR_DIAG_400”

Overview

Figure 3-7 illustrates the sequence of FB270 “SR_DIAG_400”.

Figure 3-7

ID = connection number = 0

call FC10 “AG-CNTRL“ with CMD 0

call FC10 “AG-CNTRL“ with CMD 1

Determining the maximum number of configurable connections

Determining the connection type and status for the display in theconnection overview

HMI_CONN_RESET = TRUE

call FC10 “AG_CNTRL“ with CMD 2

HMI_CONN_STOP = TRUE

HMI_CONN_START = TRUE

call FC10 “AG_CNTRL“ with CMD 6

call FC10 “AG_CNTRL“ with CMD 7

yes no

yes no

yes nein

yes no

• Error evaluation• Save the maximum number of configurable connections in the

instatance DB• Prepare data for display in the details view

FB270 “SR_DIAG_400” encapsulates the call of FC10 “AG_CNTRL” from the library “SIMATIC_NET_CP CP 400 Blocks” with various commands (CMD) for determining:

the connection status and connection type of SEND/RECEIVE connections

the number of maximum configurable SEND/RECEIVE connections, as well as for realizing various functions e.g.:

Reset the connection (RESET)

Start the connection (START)

Stop the connection (STOP)

Page 31: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 31

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

3.2.3 HMI interface

The data required for the visualization is stored in the instance data block DB270 in the following tags (see Table 3-14). These tags are integrated into WinCC flexible and form the HMI interface. This enables displaying the data stored in the tags at the HMI Multi Panel or the tags can be set by the HMI Panel.

Table 3-14

Address DB270

Tag Data type Description

32.0 CONN Array [0..65] of UDT 170

Status information of all configurable SEND/RECEIVE connections

296.0 MAX_CONNECTION Integer Maximum number of configurable SEND/RECEIVE connections

298.0 HMI_CONN Integer Connection number

300.0 HMI_Detail Bool Details view activated/deactivated

300.1 HMI_CONN_STOP Bool Stop SEND/RECEIVE connection

300.2 HMI_CONN_START Bool Start SEND/RECEIVE connection

300.3 HMI_CONN_RESET Bool Reset SEND/RECEIVE connection

301.0 HMI_CONN_TYPE Byte Connection type

302.0 HMI_CONN_STATUS Byte Connection status

303.0 HMI_CONN_RESERVE1 Byte Reserve

304.0 HMI_CONN_RESERVE2 Byte Reserve

306.0 HMI_CMD_STATUS Integer Job status

Setup of UDT 170

The relevant status information of all configured SEND/RECEIVE connections, e.g. connection type and connection status, are stored in the instance data block DB270 in CONN array of data type UDT 170.

Table 3-7 shows the setup of the user-defined data type UDT170.

Details view

The HMI_Detail tag of data type Bool is controlled by the HMI Multi Panel. If the HMI_Detail tag has the value “true”, then the following status information listed in Table 3-8 of a selected SEND/RECEIVE connection is updated for the display in the details view and stored in the instance data block DB270.

Connection status

In HMI_CONN_STATUS tag of data type Byte the connection status of a selected SEND/RECEIVE connection is stored for the display in the details view.

Table 3-9 shows the value range of the HMI_CONN_STATUS tag.

Page 32: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 32

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Connection type

In HMI_CONN_TYPE tag of data type Byte the connection type of a selected SEND/RECEIVE connection is stored for the display in the details view.

Table 3-10 shows the value range of the HMI_CONN_STATUS tag.

Connection number

In HMI_CONN tag of data type Integer the connection number is stored. The tag is set via the HMI Multi Panel in connection overview of the SEND/RECEIVE connection.

If the value of the HMI_CONN tag is larger than the determined maximum number of configurable SEND/RECEIVE connections, the HMI_CONN tag is set to value 1(dec).

If the value of the HMI_CONN tag is smaller than 1 (dec), the HMI_CONN tag is set to the determined maximum number of configurable SEND/RECEIVE connections.

Job status

The HMI_CMD_STATUS tag data type integer is implemented in the details view of SEND/RECEIVE connection. It displays the job status of the functions STOP, START und RESET.

Table 3-11 shows an overview of the job status of functions STOP, START and RESET and the value of the HMI_CMD_STATUS tag.

3.2.4 Functions

The tags of the instance data block DB270 listed in Table 3-12 are implemented in the details view of the SEND/RECEIVE connection diagnostic and can therefore be controlled via the HMI Multi Panel to realize different functions.

If the tags are controlled to value “true” a job for resetting, stopping or starting a certain, selected SEND/RECEIVE connection is initiated.

Reset the connection (RESET)

If the HMI_CONN_RESET tag of the type BOOL has the value “true”, then the FC10 “AG_CNTRL” is called with input parameter CMD=2. This resets the connection specified at the input parameter ID via the connection number.

If the job was completed successfully or with error, then the HMI_CONN_RESET tag is reset to value “false”.

If the job was completed with error, then there is an additional error evaluation (see 3.2.5 “Error evaluation”).

Stop the connection (STOP)

If the HMI_CONN_STOP tag of the type BOOL has the value “true”, then the FC10 “AG_CNTRL” is called with input parameter CMD=6. This stops the connection specified at the input parameter ID via the connection number.

If the job was completed successfully or with error, then the HMI_CONN_STOP tag is reset to value “false”.

If the job was completed with error, then there is an additional error evaluation (see 3.2.5 “Error evaluation”).

Page 33: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 33

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Start the connection (START)

If the HMI_CONN_START tag of the type BOOL has the value “true”, then the FC10 “AG_CNTRL” is called with input parameter CMD=7. This starts the connection specified at the input parameter ID via which the connection number has been specified and which was previously stopped with CMD=6.

If the job was completed successfully or with error, then the HMI_CONN_START tag is reset to value “false”.

If the job was completed with error, than there is an additional error evaluation (see 3.2.5 “Error evaluation”).

3.2.5 Error evaluation

If the start, stop or reset job of the FC10 “AG_CNTRL” is transferred successfully to the Industrial Ethernet CP then the HMI_CMD_STATUS tag is set to value 0 (dec).

If one of the jobs of FC10 “AG_CNTRL” was not successfully transferred to the Industrial Ethernet CP and completed with error, then the value of the output parameter STATUS is evaluated.

For the display in the details view a value is assigned to the HMI_CMD_STATUS tag according to the value at the output parameter STATUS (see Table 3-13).

Page 34: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 34

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

3.3 Diagnosing S7 connections with FB171 “S7_DIAG”

Function block FB171 “S7_DIAG” is used for diagnosing the S7 connections of the CP343-1.

FB171 is called cyclically in OB1.

When calling FB171 “S7_DIAG” a configuration of input and output parameters is not necessary.

3.3.1 Sequence of FB171 “S7_DIAG”

Overview

Figure 3-8 illustrates the sequence of FB171 “S7_DIAG”.

Figure 3-8

maximum number of diagnosable S7 connections in the validvalue range 1 to 64(dec)

call FC62 “C_CNTRL“

Job completed successfully

Determining the connection status

HMI_Detail = TRUE

yes no

yes no

yes no

Values of the connection number and connection status are stored in the instance data block for the display of the detailsview

maximum number of diagnosable S7 connections is set to value64(dec)

FB171 “S7_DIAG” encapsulates the call of function FC62 “C_CNTRL”, in order to determine the status of S7 connections of the CP343-1 for the S7-300. If function FC62 “C_CNTRL” is called at the control input EN_R with the value 1, the current status of the connection addressed via the input parameter ID is determined.

Page 35: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 35

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Input and output parameters of function FB62 “C_CNTRL”

Function FC62 “C_CNTRL” has the following input and output parameters.

Figure 3-9

FC62 „C_CNTRL“

BOOL

WORD

EN_R

ID

INT

BOOL

WORD

BOOL

WORD

RET_VAL

ERROR

STATUS

C_CONN

C_STATUS

Table 3-15

Input parameters Data type Description

EN_R BOOL Control parameter (enable to receive) The control parameter signals read to receive if the input is set.

ID WORD Connection number The connection number is contained in the configuration.

Table 3-16

Output parameters Data type Description

RET_VAL INT Error information

ERROR BOOL

STATUS WORD

Status parameters ERROR and STATUS:

ERROR=0 and STATUS has the values: 0000H: neither warning nor error <>0000H: warning

ERROR=1: error

C_CONN BOOL Status of the corresponding connection: 0: connection stopped or not started 1: connection exists

C_STATUS WORD Connection status: W#16#0000: connection is disconnected W#16#0001: establishment is in process W#16#0002: connection is established W#16#000F: connection status is not available W#16#00FF: connection is not configured

Page 36: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 36

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Value range of the maximum number of S7 connections

In FB171 “S7_DIAG” it is checked whether the maximum number of diagnosable S7 connections is in the valid value range 1 to 64 (dec). The maximum number of S7 connections is stored in the instance data block of FB171 in the Max_connection tag of data type integer.

If the maximum number of S7 connections lies outside the valid value range, then the MAX_connection tag is set to value 64(dec). The maximum number of diagnosable S7 connections is therefore limited to 64(dec).

Determining the connection status for the display in WinCC flexible

For each connection number in the value range from 1 to 64 the function FC62 “C_CNTRL” is called and the job result of the output parameters C_STATUS and C_CONN is evaluated.

The job result of the output parameter C_STATUS and C_CON, which contains information on the connection status, is evaluated and structured filed in the instance data block DB170 (see 3.2.3 “HMI interface”).

3.3.2 HMI interface

The data required for the visualization is stored in the instance data block DB171 in the following tags (see Table 3-17). These tags are integrated into WinCC flexible and form the HMI interface. This enables displaying the data stored in the tags at the HMI Multi Panel or the tags can be set by the HMI Panel.

Table 3-17

Address DB171

Tag Data type Description

16.0 CON_ACTIVE_1 DWord Status of the S7 connections (connection number 1-32)

20.0 CON_ACTIVE_2 DWord Status of the S7 connections (connection number 33-64)

24.0 CONN_STATUS Array [0..65] of Byte

Status information of all configurable S7 connections

90.0 HMI_Detail Bool Details view activated/deactivated

91.0 HMI_CONN_STATUS Byte Connection status

92.0 HMI_CONN Int Connection number

Page 37: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 37

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Structure of the CONN_STATUS tag

The value at output parameter C_STATUS of the FC62 “C_CNTRL” function is stored for each S7 connection in the instance data block DB171. The CONN_STATUS tag of data type Array is available for this.

The CONN_STATUS tag has the following structure:

Table 3-18

Tag Data type Value (hex)

Value (dec)

Description

B#16#00 0 connection is disconnected

B#16#01 1 establishment is in process

B#16#02 2 connection is established

B#16#0F 15 connection status is not available

CONN_STATUS[0] BYTE

B#16#FF 255 connection is not configured

B#16#00 0 connection is disconnected

B#16#01 1 establishment is in process

B#16#02 2 connection is established

B#16#0F 15 connection status is not available

CONN_STATUS[1] BYTE

B#16#FF 255 connection is not configured

B#16#00 0 connection is disconnected

B#16#01 1 establishment is in process

B#16#02 2 connection is established

B#16#0F 15 connection status is not available

CONN_STATUS[65] BYTE

B#16#FF 255 connection is not configured

The status information stored in the CONN_STATUS array is implemented in WinCC flexible in the connection overview.

Page 38: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 38

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Structure of the CONN_ACTIVE_1 und CONN_ACTIVE_1 tag

The value at output parameter C_CONN of the FC62 “C_CNTRL” is stored for each S7 connection in the instance data block DB171. The tags CONN_ACTIVE_1 and CONN_ACTIVE_2 of data type DWord are available for this.

Table 3-19 shows the structure of DWord CONN_ACTIVE_1. The individual bits of the DWord show the status of the configured S7 connections with the connection numbers 1 to 32.

Table 3-19

CONN_ACTIVE_1 Value range Description

0 Connection with connection number 1 stopped or not started

Bit 0

1 Connection with connection number 1 started

0 Connection with connection number 2 stopped or not started

Bit 1

1 Connection with connection number 2 started

Bit 31 0 Connection with connection number 32 stopped or not started

1 Connection with connection number 32 started

Table 3-20 shows the structure of DWord CONN_ACTIVE_2. The individual bits of the DWord show the status of the configured S7 connections with the connection numbers 33 to 64.

Table 3-20

CONN_ACTIVE_2 Value range Description

0 Connection with connection number 33 stopped or not started

Bit 0

1 Connection with connection number 33 started

0 Connection with connection number 34 stopped or not started

Bit 1

1 Connection with connection number 34 started

Bit 31 0 Connection with connection number 64 stopped or not started

1 Connection with connection number 64 started

Details view

The HMI_Detail tag of data type Bool is controlled by the HMI Multi Panel. If the HMI_Detail tag has the value “true”, then the following status information of the selected S7 connection is prepared for the display in the details view and stored in the instance data block DB171.

Table 3-21

Tag Data type Status information

HMI_CONN Int Connection number

HMI_CONN_STATUS Byte Connection status

Page 39: Applications & Tools - Siemens

3 2BFunction Mechanisms of this Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 39

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Connection status

In HMI_CONN_STATUS tag of data type Byte the connection status of the selected S7 connection is stored for the display in the details view.

Table 3-22 shows the value range of the HMI_CONN_STATUS tag.

Table 3-22

Value (hex) Value (dec)

Connection status

B#16#00 0 connection is disconnected

B#16#01 1 establishment is in process

B#16#02 2 connection is established

B#16#0F 15 connection status is not available

B#16#FF 255 connection is not configured

Connection number

In HMI_CONN tag of data type Integer the connection number is stored. The tag is set via the HMI Multi Panel in connection overview of the S7 connection.

If the value of the HMI_CONN tag is not within the valid value range 1 to 64 (dec), then the HMI_CON tag is set to value 64(dec). This corresponds to the maximum number of diagnosable S7 connections.

Page 40: Applications & Tools - Siemens

4 3BConfiguration and Settings

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 40

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

4 Configuration and Settings

4.1 Configuring the communication connections

4.1.1 Configuring the SEND/RECEIVE connection

The following instruction shows the configuration of a SEND/RECEIVE connection exemplary for a TCP connection:

Table 4-1

No. Action Note

1. Open NetPro in the SIMATIC Manager via menu Options Configure Network or via the “Configure Network” button.

2. Select the CPU of the SIMATIC Station and select the menu Insert New Connection….

The dialog box “New Connection” appears.

Page 41: Applications & Tools - Siemens

4 3BConfiguration and Settings

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 41

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

No. Action Note

3. Select “Unspecified” as the connection partner. If the communication partner has been configured in the same STEP 7 project, you can select the CPU of the communication partner directly. Select the connection type “TCP connection”. Apply the settings with “OK”. The properties dialog of the TCP connection opens.

4. Switch to the “General Information” tab. Specify whether the SIMATIC station is involved active or passive in establishing the connection, i.e. activate or deactivate the function “Active connection establishment”. When using the FTP service via the TCP connection, then activate the function “Use FTP protocol”.

5. Switch to the “Addresses” tab. Enter the IP address of the communication partner. Enter the local port of the SIMATIC station and the port of the communication partner.

Page 42: Applications & Tools - Siemens

4 3BConfiguration and Settings

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 42

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

No. Action Note

6. Go to the “Options” tab. Select one of the following modes.

Send/Recv

Fetch passive or

Write passive The operating modes Fetch or Write are only possible if the SIMATIC station is involved passive in establishing the connection. If you have already activated the function “Use FTP protocol” in the “General Information” tab, then the FTP mode is set. Apply the settings with “OK”.

4.1.2 Configuring the S7 connection

The following instruction shows the configuration of a S7 connection exemplary for an unspecified, unilaterally configured S7 connection:

Table 4-2

No. Action Note

1. Open NetPro in the SIMATIC Manager via menu Options Configure Network or via the “Configure Network” button.

2. Select the CPU of the SIMATIC Station and select the menu Insert New Connection….

The dialog box “New Connection” appears.

Page 43: Applications & Tools - Siemens

4 3BConfiguration and Settings

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 43

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

No. Action Note

3. Select “Unspecified” as the connection partner. If the communication partner has been configured in the same STEP 7 project, you can select the CPU of the communication partner directly. Select the connection type S7 connection. Apply the settings with “OK”. The properties dialog of the S7 connection opens.

4. Specify whether the SIMATIC station is involved active or passive in establishing the connection, i.e. activate or deactivate the function “Active connection establishment”. Enter the IP address of the communication partner. Click the “Address Details” button.

5. Enter the local TSAP of the SIMATIC station and the TSAP of the communication partner. Apply the settings with “OK”.

Page 44: Applications & Tools - Siemens

4 3BConfiguration and Settings

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 44

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

4.2 Programming the communication blocks for the data exchange

4.2.1 Programming the communication function blocks for the data exchange via SEND/RECEIVE connections

For data exchange via the following communication connections of a S7-300 Industrial Ethernet CP you call the communication function blocks FC5 “AG_SEND” and FC6 “AG_RECV” in the S7 program.

TCP connection with the services SEND/RECEIVE or FETCH/WRITE

ISO-on-TCP connection with the services SEND/RECEIVE or FETCH/WRITE

ISO transport connection with the services SEND/RECEIVE or FETCH/WRITE

USP connection with the SEND/RECEIVE services

The communication function blocks FC5 “AG_SEND” and FC6 “AG_RECV” are available in the “SIMATIC_NET_CP CP300 Blocks” library.

For data exchange via SEND/RECEIVE connections of a S7-400 Industrial Ethernet CP you use the communication function blocks FC50 “AG_LSEND” and FC60 “AG_LRECV” from the “SIMATIC_NET_CP CP 400 Blocks” library.

On the internet the following program examples are available to you as downloads (see \4\ and \5\).

4.2.2 Programming the communication function blocks for data exchange via S7 connections

For data exchange via the S7 connections of a S7-300 Industrial Ethernet CP the following communication function blocks are available to you:

FB14 “GET” and FB15 “PUT” for unilaterally and bilaterally configured S7 connections

FB12 “BSEND” and FB13 “BRECV” for bilaterally configured S7 connections

FB8 “USEND” and FB9 “URECV” for bilaterally configured S7 connections

These communication function blocks are available in the “SIMATIC_NET_CP CP300 Blocks” library. Call the respective communication function blocks in the S7 program.

For data exchange via the S7 connections of a S7-400 Industrial Ethernet CP the following system function blocks are available to you:

SFB14 “GET” and SFB15 “PUT” for unilaterally and bilaterally configured S7 connections

SFB12 “BSEND” and SFB13 “BRECV” for bilaterally configured S7 connections

SFB8 “USEND” and SFB9 “URECV” for bilaterally configured S7 connections

These system function blocks are available in the standard library at “System Function Blocks Blocks”.

On the internet the following program examples are available to you as downloads (see \6\, \7\ and \8\).

Page 45: Applications & Tools - Siemens

4 3BConfiguration and Settings

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 45

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

4.2.3 Programming the communication function blocks for data transfer with FTP

The following functions are available to you for data transfer with FTP:

Table 4-3

Function Symbolic name Description

FC40 FTP_CONNECT Establishment of an FTP connection from client to server

FC41 FTP_STORE Transfer of a DB from client to server

FC42 FTP_RETRIEVE Transfer of a file from server to client

FC43 FTP_DELETE Deleting a file on the server

FC44 FTP_QUIT Stopping a connection which has been started via ID

For the following module types the function block FB40 “FTP_CMD” is additionally available to you for data transfer with FTP:

CP343-1 Advanced as of 6ES7343-1GX30-0XE0

CP443-1 Advanced as of 6ES7443-1GX20-0XE0

With FB40 “FTP_CMD” you can establish FTP connections and transfer files from and to an FTP server.

Detailed information on the function blocks and on the functions for data transfer with FTP is available in the manual “Functions (FC) and Function Blocks (FB) for SIMATIC NET S7-CP Programming Manual” (see \16\).

Page 46: Applications & Tools - Siemens

5 4BInstallation

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 46

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

5 Installation

5.1 Installation of the hardware

Overview

The figure below shows the hardware setup of the application.

Figure 5-1

192.168.0.18192.168.0.150

192.168.0.20

CP

343-

1

S7-300 Station A S7-300 Station B

SIMATIC Field PG MP277 8‘‘ Touch

Partnerstation

SCALANCE X208

CP

343-

1

192.168.0.11

The following table gives you an overview of the IP addresses used.

Table 5-1

Device IP address Subnet mask

SIMATIC Field PG 192.168.0.150 255.255.255.0

MP277 8’’ Touch 192.168.0.18 255.255.255.0

CP343-1 (S7-Station A) 192.168.0.20 255.255.255.0

CP343-1 (S7-Station B) 192.168.0.11 255.255.255.0

SCALANCE X208 192.168.0.100 255.255.255.0

Note It is also important to read the descriptions, manuals and any delivery information supplied with the products.

Page 47: Applications & Tools - Siemens

5 4BInstallation

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 47

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Installation of the multi panel MP277 8’’ Touch

Assign the IP address to the multi panel MP277 8’’ Touch according to the configuration (see Figure 5-1).

Table 5-2

Action Screenshot

On the operator panel MP277 8’’ Touch at Control Panel Network and Dial-up Connections LAN90001 you set the IP address 192.168.0.18 and the subnet mask 255.255.255.0.

Installation of the S7 station A

Assign the IP address to the CP343-1 according to the configuration (see Figure 5-1).

Table 5-3

Action Screenshot

Open the SIMATIC Manager via the Windows Start menu SIMATIC SIMATIC Manager.

In the SIMATIC Manger via the menu PLC Edit Ethernet Node… you assign the IP address 192.168.0.20 and the subnet mask 255.255.255.0.

Page 48: Applications & Tools - Siemens

5 4BInstallation

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 48

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Installation of S7 station B

Assign the IP address to the CP343-1 according to the configuration (see Figure 5-1).

Table 5-4

Action Screenshot

Open the SIMATIC Manager via the Windows Start menu SIMATIC SIMATIC Manager.

In the SIMATIC Manger via the menu PLC Edit Ethernet Node… you assign the IP address 192.168.0.11 and the subnet mask 255.255.255.0.

Page 49: Applications & Tools - Siemens

5 4BInstallation

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 49

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

5.2 Installing the software

Keep the following order when installing the configuration software on the SIMATIC Field PG:

Install STEP 7 V5.4 SP5 or higher

Install WinCC flexible 2008 SP1.

Note In the manual of STEP 7 and WinCC flexible you find further information on installing the configuration software (see \10\ and \13\).

5.3 Application software installation

The application software is a STEP 7 project which contains the complete hardware configuration of multi panel MP277 8’’ Touch and S7-300 station.

In addition to the hardware configuration of MP277 8’’ Touch and the S7-300 station, the WinCC flexible project for the multi panel MP277 8’’ Touch as well as the S7 program for the S7-300 station are integrated in the STEP 7 project.

The STEP 7 project can be downloaded from the internet as a ZIP file.

Unzip the file “42453077_diagnostic_v10.zip” into a separate directory. The STEP 7 project is then automatically unzipped with all respective subdirectories. Subsequently, you can open and edit the extracted STEP 7 project with the SIMATIC Manager.

Page 50: Applications & Tools - Siemens

6 5BStarting up the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 50

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

6 Starting up the Application

6.1 Preparation

Assign the IP address to the network card of the SIMATIC Field PG according to the configuration (see Figure 5-1).

Table 6-1

Action Screenshot

Open the Properties dialog of the Local Area Network (LAN) in the Network Connections of Windows. Enter the IP address 192.168.0.150 and the subnet mask 255.255.255.0.

6.2 Commissioning the multi panel MP277 8’’ Touch

6.2.1 Hardware configuration

In the hardware configuration of the multi panel MP277 8’’ Touch you enter the IP address, already set on the multi panel, for the Industrial Ethernet interface (see chapter 5.1 “Installation of the hardware”).

Page 51: Applications & Tools - Siemens

6 5BStarting up the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 51

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Table 6-2

Action Screenshot

Open the Properties dialog of the Industrial Ethernet interface and click the “Properties...” button.

In the dialog “Properties – Ethernet interface HMI IE” “Parameters” tab you enter the IP address and Subnet mask which you have already set on the multi panel. In Subnet you select the Ethernet subnet to which you wish to assign the HMI IE interface. If an Ethernet subnet does not yet exist, you click the “New…” button to create a new Ethernet subnet.

Save and compile the hardware configuration of the multi panel MP277 8’’ Touch.

Save and compile

Page 52: Applications & Tools - Siemens

6 5BStarting up the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 52

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

6.2.2 Loading WinCC flexible Runtime

When loading the WinCC flexible Runtime onto the multi panel MP277 8’’ Touch, please proceed according to the following instruction:

Table 6-3

No. Action Screenshot

1 In the SIMATIC Manager under the object HMI Station “MP277” you right-click the entry “WinCC flexible RT” and select the “Open Object” item. The WinCC flexible project of the MP277 8’’ Touch opens.

2 In WinCC flexible you click the “Select transfer settings and start transfer to the device” button. The dialog “Select devices for transfer” appears.

Select transfer settings and start transfer to the device

3 Select the “Ethernet” mode and enter the IP address 192.168.0.18 of the MP277 8’’ Touch. Click the “Transfer” button to transfer the WinCC flexible Runtime to the MP277 8’’ Touch.

Page 53: Applications & Tools - Siemens

6 5BStarting up the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 53

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

6.3 Commissioning the S7 station A

6.3.1 Loading the hardware configuration

In the hardware configuration of S7 station A you enter the already assigned IP address for the CP343-1 (see chapter “5.1” “Installation of the hardware”).

Table 6-4

No. Action Screenshot

1. Open the Properties dialog of the PN-IO interface of the CP343-1 and click the “Properties...” button.

2. In the “Properties - Ethernet interface PN-IO” dialog select the “Parameters” tab and enter IP address and subnet mask which you have already assigned to the CP343-1. Acknowledge the entry with “OK”.

Page 54: Applications & Tools - Siemens

6 5BStarting up the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 54

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

No. Action Screenshot

3. Save and compile the hardware configuration of the S7-300 station and load it onto your CPU.

downloadSave and compile

6.3.2 Loading the communication connections

When loading the communication connections proceed as follows:

Table 6-5

No. Action Screenshot

1. Open NetPro in the SIMATIC Manager via menu Options Configure Network or via the “Configure Network” button.

2. Select the CPU of the SIMATIC Station “SIMATIC 315”. The connection table shows you the configured S7 and SEND/RECEIVE connections.

Page 55: Applications & Tools - Siemens

6 5BStarting up the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 55

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

No. Action Screenshot

3. Select the SIMATIC 300 station “SIMATIC 315”. Then save and compile the configuration and load it to the CPU.

Save and compile

download

6.3.3 Calling and configuring the function blocks FB170 “SR_DIAG” and FB171 “S7_DIAG”, and loading the user program

In the user program of the CPU315-2DP you call the function blocks FB170 “SR_DIAG” and FB171 “S7_DIAG”.

Table 6-6

Action Screenshot

1. Call the function blocks FB170 “SR_DIAG” and FB171 “S7_DIAG” in OB1. At the input parameter LADDR of the FB170 “SR_DIAG” you enter the module start address of the Industrial Ethernet CP.

2. The module start address is available in the hardware configuration. In the Properties dialog of the Industrial Ethernet CP select the “Addresses” tab. Here you find the module start address 256DEC = 100HEX.

3. After you have called and configured the function blocks in OB1 you load the user program to the CPU315-2DP.

Page 56: Applications & Tools - Siemens

6 5BStarting up the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 56

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

6.4 Commissioning the S7 station B

6.4.1 Loading the hardware configuration

In the hardware configuration of S7 station B you enter the already assigned IP address for the CP343-1 (see chapter “5.1” “Installation of the hardware”).

Table 6-7

Action Screenshot

1. Open the Properties dialog of the CP343-1 and click the “Properties...” button.

2. In the “Properties - Ethernet interface CP343-1 Lean” dialog select the “Parameters” tab and enter IP address and subnet mask which you have already assigned to the CP343-1. Acknowledge the entry with “OK”.

Page 57: Applications & Tools - Siemens

6 5BStarting up the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 57

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Action Screenshot

3. Save and compile the hardware configuration of the S7-300 station and load it onto your CPU.

Save and compile download

6.4.2 Loading the communication connections

When loading the communication connections proceed as follows:

Table 6-8

No. Action Screenshot

1. Open NetPro in the SIMATIC Manager via menu Options Configure Network or via the “Configure Network” button.

2. Select the CPU of the SIMATIC Station “SIMATIC 319”. The connection table shows you the configured S7 and SEND/RECEIVE connections.

Page 58: Applications & Tools - Siemens

6 5BStarting up the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 58

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

No. Action Screenshot

3. Select the SIMATIC 300 station “SIMATIC 319”. Then save and compile the configuration and load it to the CPU.

Save and compile

download

6.4.3 Loading the user program

Load the user program to the CPU 319-3PN/DP.

Page 59: Applications & Tools - Siemens

7 6BOperating the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 59

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

7 Operating the Application

7.1 Overview

The status information of the S7 connections and SEND/RECEIVE connections, which are configured for the CP343-1 in S7-300 station A, are displayed in WinCC flexible Runtime on the multi panel MP277 8’’ Touch.

Figure 7-1 C

P34

3-1

S7-300 Station A S7-300 Station B

SIMATIC Field PG MP277 8‘‘ Touch

Partner station

SCALANCE X208

CP

343-

1

STEP 7(Variable Table)

WinCC flexibleRuntime

Page 60: Applications & Tools - Siemens

7 6BOperating the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 60

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

If you start WinCC flexible Runtime on the HMI Multi Panel, the start screen will be display.

Table 7-1

No. Action Screenshot

1. The start screen of WinCC flexible Runtime, which runs on the multi panel MP277 8’’ Touch, has three buttons:

1. EXIT, to exit WinCC flexible Runtime

2. Diagnostic SEND/RECEIVE connection, to open the connection view of the SEND/RECEIVE connection

3. Diagnostic SEND/RECEIVE connection, to open the connection overview of the S7 connection

7.2 Connection overview of the SEND/RECEIVE connections

The connection overview displays the status of all possible SEND/RECEIVE connections of the Industrial Ethernet CP. This enables a fast diagnostic of the configured SEND/RECEIVE connection.

Table 7-2

No. Action Screenshot

1. In the start screen you click on the “Diagnostic SEND/RECEIVE connection” button to open the connection overview of the SEND/RECEIVE connections.

Page 61: Applications & Tools - Siemens

7 6BOperating the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 61

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

No. Action Screenshot

2. In the connection overview of the SEND/RECEIVE connections the connection number and the connection status determined in the S7 program for all possible SEND/RECEIVE connections are visualized via buttons. The number of displayed buttons is determined dynamically. It depends on the maximum number of configurable SEND/RECEIVE connections. The maximum number of configurable SEND/RECEIVE connections is determined in the S7 program.

3. Click on the “back” button to quit the connection overview of the SEND/RECEIVE connections and return to the start screen.

Connection status

The connection status of the SEND/RECEIVE connections determined in the S7 program is stored in the instance data block DB170 in the CONN array and represented via the color of the button.

The following tags of the CONN array are assigned to the buttons with connection numbers. The buttons are displayed in colors which depend on the value of these tags.

Table 7-3

Button Tag of the CONN array Value (dec)

Color Connection status

0 connection is disconnected

1 establishment is in process

2 disconnection is in process

3 connection is established

4 unknown

5 unknown

6 unknown

1 CONN[1].CONN_STATUS

7 unknown

Page 62: Applications & Tools - Siemens

7 6BOperating the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 62

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Button Tag of the CONN array Value (dec)

Color Connection status

0 connection is disconnected

1 establishment is in process

2 disconnection is in process

3 connection is established

4 unknown

5 unknown

6 unknown

2 CONN[2].CONN_STATUS

7 unknown

0 connection is disconnected

1 establishment is in process

2 disconnection is in process

3 connection is established

4 unknown

5 unknown

6 unknown

64 CONN[64].CONN_STATUS

7 unknown

7.3 Connection overview of the S7 connections

The connection overview displays the status of all possible S7 connections of the Industrial Ethernet CP. This enables a fast diagnostic of the configured S7 connection.

Table 7-4

No. Action Screenshot

1. In the start screen you click on the “Diagnostic S7 connection” button to open the connection overview of the S7 connections.

Page 63: Applications & Tools - Siemens

7 6BOperating the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 63

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

No. Action Screenshot

2. In the connection overview of the S7 connections the connection number and the connection status determined in the S7 program for all possible S7 connections are visualized via buttons. The number of displayed buttons is determined dynamically. It depends on the maximum number of configurable S7 connections. The maximum number of configurable S7 connections is determined in the S7 program.

3. Click on the “back” button to quit the connection overview of the S7 connections and return to the start screen.

Connection status

The connection status of the S7 connections determined in the S7 program is stored in the instance data block DB171 in the CONN_STATUS array and represented via the color of the button.

The following tags are assigned to the buttons with connection numbers. The buttons are displayed in colors which depend on the value of these tags.

Table 7-5

Button Tag Value (dec)

Color Connection status

0 connection is disconnected

1 establishment is in process

2 connection is established

15 connection status is not available

1 CONN_STATUS[1]

255 connection is not configured

0 connection is disconnected

1 establishment is in process

2 connection is established

2 CONN_STATUS[2]

15 connection status is not available

Page 64: Applications & Tools - Siemens

7 6BOperating the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 64

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Button Tag Value (dec)

Color Connection status

255 connection is not configured

0 connection is disconnected

1 establishment is in process

2 connection is established

15 connection status is not available

64 CONN_STATUS[64]

255 connection is not configured

7.4 Details view of the SEND / RECEIVE connection diagnostic

The details view shows the status information of the certain selected SEND/RECEIVE connection.

Table 7-6

No. Action Screenshot

4. In the connection overview you click the button of a SEND/RECEIVE connection to open its details view for the connection diagnostics. The HMI_CONN tag is set to the value displayed on the button. This value corresponds to the connection number of the SEND/RECEIVE connection. The HMI_Detail tag of data type Bool is set to the value “true”.

5. The details view of the SEND/RECEIVE connection diagnostic displays the following status information of the certain selected connection:

Connection number

Connection type

Connection status

Page 65: Applications & Tools - Siemens

7 6BOperating the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 65

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

No. Action Screenshot

6. Click the arrow buttons to go to the details view of the previous or subsequent SEND/RECEIVE connection.

7. Click on the “back” button to quit the details view of the SEND/RECEIVE connection diagnostic and return to the overview of the SEND/RECEIVE connections. The HMI_CMD_STATUS tag is set to the value 0 and the HMI_Detail tag is reset to “false”.

7.4.1 Visualizing the status information

To display the status information in WinCC flexible Runtime the following tags of the instance data block DB170 are linked with WinCC flexible basic objects in the details view.

Table 7-7

WinCC flexible basic object

Tag Data type Description

I/O field HMI_CONN INT Connection number

Symbolic I/O field

HMI_CONN_TYPE BYTE Connection type

Symbolic I/O field

HMI:CONN_STATUS BYTE Connection status

Connection number

The connection number is visualized via the HMI_CONN tag. The value of the HMI_CONN tag is displayed in an I/O field.

The background color of the I/O field depends on the value of the HMI_CONN_STATUS tag, i.e. the background color of the I/O filed displays the connection status of the selected SEND/RECEIVE connection.

Page 66: Applications & Tools - Siemens

7 6BOperating the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 66

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Table 7-8

Value of the HMI_CONN_STATUS (dec)

tag

Connection status Background color I/O field

0 connection is disconnected

1 establishment is in process

2 disconnection is in process

3 connection is established

4 unknown

5 unknown

6 unknown

7 unknown

Connection status

The connection status is visualized via the HMI_CONN_STATUS tag and displayed as text in a symbolic I/O field. The text to display the connection status is stored in the text list “SR_Connection_Status”. Depending on the value of the HMI_CONN_STATUS tag the respective text is displayed.

Table 7-9

Value of the HMI_CONN_STATUS (dec)

tag

Connection status Text list SR_Connection_Status

0 connection is disconnected connection is disconnected

1 establishment is in process establishment is in process

2 disconnection is in process disconnection is in process

3 connection is established connection is established

4 unknown unknown

5 unknown unknown

6 unknown unknown

7 unknown unknown

Connection type

The connection type is visualized via the HMI_CONN_TYPE tag and displayed as text in a symbolic I/O field. The text to display the connection type is stored in the text list “SR_Connection_Type”. Depending on the value of the HMI_CONN_STATUS tag the respective text is displayed.

Table 7-10

Value of the HMI_CONN_Type (dec) tag

Connection type Text list SR_Connection_Type

0 unknown connection type is unknown

1 SEND/RECEIVE connection

SEND/RECEIVE connection

2 FETCH connection FETCH connection

3 - not possible

4 WRITE connection WRITE connection

5 - not possible

6 - not possible

Page 67: Applications & Tools - Siemens

7 6BOperating the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 67

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Value of the HMI_CONN_Type (dec) tag

Connection type Text list SR_Connection_Type

7 - not possible

8 undefined, e.g. FTP connection or e-mail connection

undefined connection type

9 - not possible

10 - not possible

11 - not possible

12 - not possible

13 - not possible

14 - not possible

15 - not possible

7.4.2 Functions

In the details view of the SEND/RECEIVE connection diagnostic the following functions are available to the user:

RESET (reset the connection)

STOP (stop the connection)

START (start the connection)

These functions are implemented in FB170 “SR_DIAG”. In WinCC flexible Runtime you can control these functions in the details view of the SEND/RECEIVE connection diagnostic via buttons (see Table 7-11).

Page 68: Applications & Tools - Siemens

7 6BOperating the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 68

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Table 7-11

Button Action Comment

Reset the connection

RESET Click on the “RESET” button to reset the SEND/RECEIVE connection selected in the details view, i.e. the connection is automatically stopped and restarted via the S7 program. When the job has been completed, you can reset the same connection or a different connection again by clicking the “RESET” button.

The HMI_CONN_RESET tag of data type BOOL is set to the value “true”.

The FC10 “AG_CNTRL” is called with the input parameter CMD=2 and the connection number of the selected SEND/RECEIVE connection is assigned to the input parameter ID.

Changes of the connection status are displayed in the details view.

Stop the connection

STOP Click on the “STOP” button to automatically stop the SEND/RECEIVE connection selected in the details view via the S7 program. As soon as the connection is stopped you click the “START” button to restart it.

The HMI_CONN_STOP tag of data type BOOL is set to the value “true”.

The FC10 “AG_CNTRL” is called with the input parameter CMD=6 and the connection number of the selected connection is assigned to the input parameter ID.

Changes of the connection status are displayed in the details view.

Stop the connection

START Click on the “START” button to automatically start the SEND/RECEIVE connection selected in the details view via the S7 program. The requirement is that the connection has previously been stopped via the “STOP” button hence with CMD=6.

The HMI_CONN_START tag of data type BOOL is set to the value “true”.

The FC10 “AG_CNTRL” is called with the input parameter CMD=7 and the connection number of the selected connection is assigned to the input parameter ID.

Changes of the connection status are displayed in the details view.

7.4.3 Job status

The job status of FC10 “AG_CNTRL” for realizing the above functions is visualized via the HMI_CMD_STATUS tag and displayed in a symbolic I/O field as text. The symbolic I/O field is only visible if the job status has the value <> 0. The text to display the job status is stored in the text list “CMD_ERROR”. Depending on the value of the HMI_CMD_STATUS tag the respective text is displayed.

Table 7-12

Value of the HMI_CMD_STATUS (dec)

tag

Job status Text list CMD_ERROR

0 job completed successfully 0: request is completed successfully

1 function not available 1: function not available

2 command isn’t allowed 2: command isn’t allowed

9 general error 9: general failure

If the HMI_CMD_STATUS tag has the value 0, then the symbolic I/O field for display of the job status is hidden.

Page 69: Applications & Tools - Siemens

7 6BOperating the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 69

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

7.5 Details view of the S7 connection diagnostic

The details view shows the status information of the certain selected S7 connection.

Table 7-13

No. Action Screenshot

1. In the connection overview you click the button of an S7 connection to open its details view for the connection diagnostics. The HMI_CONN tag is set to the value displayed on the button. This value corresponds to the connection number of the S7 connection. The HMI_Detail tag of data type Bool is set to the value “true”.

2. The details view of the S7 connection diagnostic displays the following status information of a certain selected connection:

Connection number

Connection status

3. Click on the “back” button to quit the details view of the S7 connection diagnostic and return to the overview of the S7 connections. The HMI_Detail tag is set to the value “false”.

Page 70: Applications & Tools - Siemens

7 6BOperating the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 70

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

No. Action Screenshot

4. Click the arrow buttons to go to the details view of the previous or subsequent S7 connection.

5. Click on the “back” button to quit the details view of the S7 connection diagnostic and return to the overview of the S7 connections. The HMI_Detail tag is set to the value “false”.

7.5.1 Visualizing the status information

To display the status information in WinCC flexible Runtime the following tags of the instance data block DB171 are linked with WinCC flexible basic objects in the details view.

Table 7-14

WinCC flexible basic object

Tag Data type Description

I/O field HMI_CONN INT Connection number

Symbolic I/O field

HMI:CONN_STATUS BYTE Connection status

Connection number

The connection number is visualized via the HMI_CONN tag. The value of the HMI_CONN tag is displayed in an I/O field.

The background color of the I/O field depends on the value of the HMI_CONN_STATUS tag, i.e. the background color of the I/O filed displays the connection status of the selected S7 connection.

Page 71: Applications & Tools - Siemens

7 6BOperating the Application

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 71

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

Table 7-15

Value of the HMI_CONN_STATUS (dec)

tag

Connection status Background color I/O field

0 connection is disconnected

1 establishment is in process

2 connection is established

15 connection status is not available

255 connection is not configured

Connection status

The connection status is visualized via the HMI_CONN_STATUS tag and displayed as text in a symbolic I/O field. The text to display the connection status is stored in the text list “S7_Connection_Status”. Depending on the value of the HMI_CONN_STATUS tag the respective text is displayed.

Table 7-16

Value of the HMI_CONN_STATUS (dec)

tag

Connection status Text list S7_Connection_Status

0 connection is disconnected connection is disconnected

1 establishment is in process establishment is in process

2 connection is established connection is established

15 connection status is not available

connection status is not available

255 connection is not configured connection is not configured

Page 72: Applications & Tools - Siemens

8 7BLinks & Literature

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 72

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

8 Links & Literature

8.1 Internet Links

The following list is by no means complete and only provides a selection of appropriate sources.

Table 8-1

Topic Title

\1\ Manual MP277 http://support.automation.siemens.com/WW/view/en/23337820

\2\ FC10 “AG_CNTRL” http://support.automation.siemens.com/WW/view/en/22637440

\3\ FC62 “C_CNTRL” http://support.automation.siemens.com/WW/view/en/1214574

\4\ FC5 “AG_SEND”/ FC6 “AG_RECV”

http://support.automation.siemens.com/WW/view/en/17853532

\5\ FC50 “AG_LSEND”/ FC60 “AG_LRECV”

http://support.automation.siemens.com/WW/view/en/24693800

\6\ FB14 “GET”/ FB15 “PUT”

http://support.automation.siemens.com/WW/view/en/22792404

\7\ SFB14 “GET”/ SFB15 “PUT”

http://support.automation.siemens.com/WW/view/en/23378099

\8\ FB12 “BSEND”/ FB13 “BRCV”

http://support.automation.siemens.com/WW/view/en/22789990

\9\ FTP http://support.automation.siemens.com/WW/view/en/30374198

\10\ WinCC flexible 2008 http://support.automation.siemens.com/WW/view/en/18796010

\11\ WinCC flexible 2008 Communication Part1

http://support.automation.siemens.com/WW/view/en/18797552

\12\ WinCC flexible 2008 Communication Part2

http://support.automation.siemens.com/WW/view/en/18797249

\13\ STEP 7 V5.4 First Steps

http://support.automation.siemens.com/WW/view/en/18652511

\14\ STEP 7 V5.4 Programming

http://support.automation.siemens.com/WW/view/en/18652056

\15\ Configuring STEP 7 V5.4 Hardware and Connections

http://support.automation.siemens.com/WW/view/en/18652631

\16\ FC and FB for S7-CPs

http://support.automation.siemens.com/WW/view/en/30564821

\17\ WinCC flexible Runtime

http://support.automation.siemens.com/WW/view/en/18795593

Page 73: Applications & Tools - Siemens

9 8BHistory

Connection Diagnostics CPx43-1 V1.0 , Entry ID: 42453077 73

Co

pyr

igh

t

Sie

me

ns

AG

20

10

All

righ

ts r

ese

rve

d

9 History

Table 9-1

Version Date Changes

V1.0 29.06.2010 First issue