0% found this document useful (0 votes)
246 views

IsoOnTcp BaseComm V1 en

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
246 views

IsoOnTcp BaseComm V1 en

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 59

Basic Examples for

Open User
Communication:
ISO-on-TCP
Siemens
Programmed ISO-on-TCP Connection Industry
Online
https://support.industry.siemens.com/cs/ww/en/view/109747710 Support
Legal information

Legal information
Use of application examples
Application examples illustrate the solution of automation tasks through an interaction of several
components in the form of text, graphics and/or software modules. The application examples are
a free service by Siemens AG and/or a subsidiary of Siemens AG (“Siemens”). They are non-
binding and make no claim to completeness or functionality regarding configuration and
equipment. The application examples merely offer help with typical tasks; they do not constitute
customer-specific solutions. You yourself are responsible for the proper and safe operation of the
products in accordance with applicable regulations and must also check the function of the
respective application example and customize it for your system.
Siemens grants you the non-exclusive, non-sublicensable and non-transferable right to have the
application examples used by technically trained personnel. Any change to the application
examples is your responsibility. Sharing the application examples with third parties or copying the
application examples or excerpts thereof is permitted only in combination with your own products.
The application examples are not required to undergo the customary tests and quality inspections
of a chargeable product; they may have functional and performance defects as well as errors. It is
your responsibility to use them in such a manner that any malfunctions that may occur do not
result in property damage or injury to persons.

Disclaimer of liability
Siemens shall not assume any liability, for any legal reason whatsoever, including, without
limitation, liability for the usability, availability, completeness and freedom from defects of the
application examples as well as for related information, configuration and performance data and
any damage caused thereby. This shall not apply in cases of mandatory liability, for example
under the German Product Liability Act, or in cases of intent, gross negligence, or culpable loss of
life, bodily injury or damage to health, non-compliance with a guarantee, fraudulent
non-disclosure of a defect, or culpable breach of material contractual obligations. Claims for
damages arising from a breach of material contractual obligations shall however be limited to the
© Siemens AG 2017 All rights reserved

foreseeable damage typical of the type of agreement, unless liability arises from intent or gross
negligence or is based on loss of life, bodily injury or damage to health. The foregoing provisions
do not imply any change in the burden of proof to your detriment. You shall indemnify Siemens
against existing or future claims of third parties in this connection except where Siemens is
mandatorily liable.
By using the application examples you acknowledge that Siemens cannot be held liable for any
damage beyond the liability provisions described.

Other information
Siemens reserves the right to make changes to the application examples at any time without
notice. In case of discrepancies between the suggestions in the application examples and other
Siemens publications such as catalogs, the content of the other documentation shall have
precedence.
The Siemens terms of use (https://support.industry.siemens.com) shall also apply.

Security information
Siemens provides products and solutions with industrial security functions that support the secure
operation of plants, systems, machines and networks.
In order to protect plants, systems, machines and networks against cyber threats, it is necessary
to implement – and continuously maintain – a holistic, state-of-the-art industrial security concept.
Siemens’ products and solutions constitute one element of such a concept.
Customers are responsible for preventing unauthorized access to their plants, systems, machines
and networks. Such systems, machines and components should only be connected to an
enterprise network or the internet if and to the extent such a connection is necessary and only
when appropriate security measures (e.g. firewalls and/or network segmentation) are in place.
For additional information on industrial security measures that may be implemented, please visit
https://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them more secure.
Siemens strongly recommends that product updates are applied as soon as they are available
and that the latest product versions are used. Use of product versions that are no longer
supported, and failure to apply the latest updates may increase customer’s exposure to cyber
threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed
at: http://www.siemens.com/industrialsecurity.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 2
Table of Contents

Table of Contents
Legal information ......................................................................................................... 2
1 Introduction ........................................................................................................ 4
1.1 Overview............................................................................................... 4
1.2 Mode of Operation ................................................................................ 7
1.3 Components used .............................................................................. 11
2 Engineering ...................................................................................................... 13
2.1 Interface description for S7-1200 and S7-1500 ................................. 13
2.2 Interface description for S7-300 and S7-400 ..................................... 15
2.3 Integration into the user project .......................................................... 18
2.3.1 Opening library in STEP 7 (TIA Portal) .............................................. 18
2.3.2 Integrating "LOpenUserComm_IsoOnTcp" function block into
the user program ................................................................................ 21
2.4 Determining hardware identifier of the CPU or CP/CM interface ....... 23
2.5 Error handling S7-1200 and S7-1500 ................................................ 24
2.5.1 Error while establishing the connection .............................................. 24
2.5.2 Error when receiving data .................................................................. 30
2.5.3 Error when sending data .................................................................... 32
2.5.4 Error while connection termination ..................................................... 34
2.6 Error handling S7-300 and S7-400 .................................................... 36
2.6.1 Error while establishing the connection .............................................. 36
2.6.2 Error when receiving data .................................................................. 40
© Siemens AG 2017 All rights reserved

2.6.3 Error when sending data .................................................................... 42


2.6.4 Error while connection termination ..................................................... 44
2.7 Explanation regarding the "stateMachine" region .............................. 46
2.7.1 STATE_IDLE ...................................................................................... 46
2.7.2 STATE_PARAM ................................................................................. 46
2.7.3 STATE_CONNECT ............................................................................ 46
2.7.4 STATE_CONNECTED ....................................................................... 47
2.7.5 STATE_RECEIVE .............................................................................. 47
2.7.6 STATE_SEND .................................................................................... 47
2.7.7 STATE_DISCONNECT ...................................................................... 48
2.7.8 STATE_ERROR ................................................................................. 48
3 Valuable Information ....................................................................................... 52
3.1 Basics ................................................................................................. 52
3.1.1 Basics on ISO-on-TCP Protocol ......................................................... 52
3.1.2 Configuration of the "TCON_IP_RFC" parameter data record .......... 52
3.1.3 Configuration of the "TCCON_PAR" parameter data record ............. 53
3.2 Details on the mode of operation ....................................................... 56
3.2.1 Structure of the program .................................................................... 56
3.2.2 Explanation regarding the "edgeDetection" region ............................ 56
3.2.3 Explanation regarding the "initStates" region ..................................... 57
3.2.4 Explanation regarding the "stateMachine" region .............................. 57
3.2.5 Explanation regarding the "callOUCblocks" region ............................ 57
4 Annex ................................................................................................................ 58
4.1 Service and support ........................................................................... 58
4.2 Links and literature ............................................................................. 59
4.3 Change documentation ...................................................................... 59

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 3
1 Introduction

1 Introduction
1.1 Overview
Content of the application example
The TCP/IP based Open User Communication (OUC) is now the standard in the
communication with SIMATIC S7 CPUs.
In the S7 CPU, the OUC is implemented on the basis of instructions (for example,
TCON, TSEND, TRCV and TDISCON). The user has to configure the instructions
in their user program and in a fail-tolerant way. This task has to be rethought by
each user again and again. In order to facilitate this, we offer a function block (FB)
in SCL. The FB calls the OUC instructions in the order and in the way that is
recommended in the manuals. The FB also includes the following mechanisms:
• Connection management with the instructions "TCON" and "TDISCON"
• Sending data to a partner CPU
• Receiving data from a partner CPU
You can use the FB as template for your own communication projects.
The application example provides the following information:
• Library for STEP 7 (TIA Portal) that contains the FB
• Description of the FB to communicate via programmed connection with ISO-
on-TCP
© Siemens AG 2017 All rights reserved

The application example shows in which places you can integrate your individual
expansions in the code.

Overview of all OUC variants in this row


This application example is part of a larger series of basic examples for PLC
communication.
Table 1-1 shows the variants of the OUC that are provided to the user in a series of
basic examples. The variant described in this application example is highlighted in
color.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 4
1 Introduction

Table 1-1
Protocol Frame length Programmed Note
connection
ISO-on-TCP Dynamic ✓ • Fast data transmission rate
• Transmission of medium to large
data amounts. Information on the
max. amount of CPU data can
be found in the FAQ 18909487.
• Mainly only applicable in
SIMATIC-homogenous
structures.
• Acknowledged
• Package-oriented data
transmission, i.e. length and
information on start and end of a
frame are also transmitted.
TCP Fixed ✓ • Fast data transmission rate.
• Transmission of medium to large
Dynamic ✓
data amounts. Information on the
max. amount of CPU data can
be found in the FAQ 18909487.
• It can be used flexibly with third-
party systems.
• Acknowledged

© Siemens AG 2017 All rights reserved

Data are transmitted as a data


stream, i.e. length and
information on start and end of a
frame are not transmitted. The
sender therefore has to define a
message structure that can be
interpreted by the receiver when
transmitting dynamic frame
length.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 5
1 Introduction

Protocol Frame length Programmed Note


connection
UDP Dynamic ✓ • Very fast data transmission rate
• Transmission of small to medium
data volumes. Information on the
max. amount of CPU data can
be found in the FAQ 18909487.
• It can be used flexibly with third-
party systems
• There is no guarantee that a
sent data package will arrive at
the receiver or that a sent data
package will only arrive once.
• The arrival sequence of the
packets at the receiver cannot
be predicted.
• Data packets with incorrect
checksum are rejected and not
newly requested.
• Package-oriented data
transmission, i.e. length and
information on start and end of a
frame are also transmitted.
© Siemens AG 2017 All rights reserved

Note The variants with the compact instructions for OUC (TSEND_C and TRECV_C)
are not dealt with in this series.
For more information, please refer to the following FAQ:
https://support.industry.siemens.com/cs/ww/en/view/67196808

For each variant the OUC has its own FB that is used as communication template.
All communication templates are summarized in the "LOpenUserComm" library.
This application example only relates to the variant “programmed connection with
ISO-on-TCP".

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 6
1 Introduction

1.2 Mode of Operation


Realization as state machine
The FB for controlling the OUC instructions (TCON, TSEND, TRCV and TDISCON)
is realized as state machine. The design model of a state machine is particularly
suitable for the modeling of complex asynchronous processes, for example, the
communication between partners that stretch over several cycles.
A certain state is cyclically run until a transition condition is fulfilled and the
machine switches to the next subsequent state. This does not only improve the
clarity in comparison to a conventional logic controller but also facilitates finding
possible errors in the program logic quicker.
A detailed description of the state machine can be found in Chapter 2.7.
© Siemens AG 2017 All rights reserved

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 7
1 Introduction

Status display in FB "LOpenUserComm_IsoOnTcp"


The figure below shows the states that are implemented in this FB.
Figure 1-1
Wait for
external
Trigger
STATE_IDLE

enable = true

K
O
=
N
O

establishment possible
C
IS
TD

no connection
Read TCP-
Parameter
[STATE_
PARAM]

Wait for
TDISCON = ok Error on disconnect
Error
o n es
Disable Error conn tablishin
ectio g
Connection Handling n
(STATE_ [STATE_
DISCONNECT) ERROR]
Reestablish or close Wait for
connection because of TCON = ok

communication partner
non correctable error Establish
© Siemens AG 2017 All rights reserved

Connection
disconnected
error on receiving data

[STATE_
CONNECT]

Wait for

K
O
Event

=
N
O
TC
enable = false

Error
Connection
established
o
n Se

[STATE_
CONNECTED] se
nd d

Received data nd
re q
processed ue
ata

st

TS
new data EN Wait for
D =O
Manage received Send TSEND = ok
K
received ndr = 1 Data
Data [STATE_
[STATE_ SEND]
RECEIVE]

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 8
1 Introduction

Description of the states


The following table describes the realized states and the possible transitions. More
information can be found in the documented code.
Table 1-2
State Description Transition condition
STATE_IDLE (1) In the "STATE_IDLE" idle The "STATE_IDLE" idle state is
state the FB has the following now left, if a connection is
characteristics: triggered via a parameter
• No connection is active. (enable).
• Status tags are reset.
STATE_PARAM (2) The ISO-on-TCP connection The FB goes straight to the
parameters are read and the "STATE_CONNECT" state
TCON instruction is assigned. without transition condition.
STATE_CONNECT The ISO-On-TCP connection The "STATE_CONNECT" state
(3) to the partner is established. is left when one of the following
conditions is fulfilled:
• If the connection is still not
established after the lapse
of the watchdog timer
(180s), the FB goes to
"STATE_ERROR" state.
• If the connection is
established, the FB goes to
© Siemens AG 2017 All rights reserved

"STATE_CONNECTED"
state.
STATE_ In the "STATE_CONNECTED" The “STATE_CONNECTED"
CONNECTED (7) state the FB performs the state is left when one of the
following actions: following conditions is fulfilled:
• It waits for the trigger of • If an error occurs when
the send job to send the receiving the data, the FB
data via the connection. goes to "STATE_ERROR"
• It monitors whether the state.
data has been received by • When the connection is to
the partner. be actively disconnected,
• It monitors the connection the FB goes to
to the partner. “STATE_DISCONNECT"
state.
• When data is to be sent, the
FB goes to "STATE_SEND"
state.
• When new data is to be
received, the FB goes to
"STATE_RECEIVE" state.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 9
1 Introduction

State Description Transition condition


STATE_SEND (5) In the "STATE_SEND" state, The "STATE_SEND" state is
the FB performs the following left, if one of the following
actions: conditions is fulfilled:
• It enables the parameters • When the send process is
of the "TSEND" OUC completed successfully, the
instruction. FB goes back to the
• It waits until the "TSEND" "STATE_CONNECTED"
OUC instruction is state.
completed successfully • If an error occurs during
(DONE=1) or with error sending, the FB goes to
(ERROR=1). "STATE_ERROR" state.
• It disables the "TRCV"
OUC instruction during
the running send process.
STATE_RECEIVE The "RECEIVE" state is used The FB goes straight back to the
(6) for an individual processing of “STATE_CONNECTED" state
the received data. without transition condition.
In this application example the
state is empty.
STATE_ In the following cases, the FB The "STATE_DISCONNECT"
DISCONNECT (4) disconnects the connection to state is left, if one of the
the partner in the following conditions is fulfilled:
"STATE_DISCONNECT" • When the connection was
state. disconnected without error,
© Siemens AG 2017 All rights reserved

• The disconnection is the FB goes to


triggered by the user “STATE_IDLE" state.
(enable). • If an error occurs when
• The disconnection is disconnecting the
triggered by the FB, if the connection, the FB goes to
connection has to be re- the "STATE_ERROR" state.
established or if an error
that cannot be removed
occurred.
ERROR (8) In the "STATE_ERROR" state, The "STATE_ERROR" state is
the FB performs the following left, if one of the following
actions: conditions is fulfilled
• It decides whether it • The FB goes to the
autonomously attempted "DISCONNECT" state if the
to remove an error within connection has to be re-
the FB by calling other established or if an error
states. that cannot be removed
• It supplies the output occurred.
parameters with error • If the connection is not
information established, the FB goes to
"STATE_IDLE" idle state.
• If the partner discontinues
the connection, the FB goes
to the
"STATE_CONNECTED"
state.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 10
1 Introduction

1.3 Components used


This application example was created with the following hardware and software
components:
Table 1-3
Component Numbe Article number Note
r
CPU 1513-1 PN 1 6ES7513-1AL01-0AB0 Alternatively, you can
use any other S7-1500
CPU, ET 200SP CPU,
ET 200pro CPU or the
following CPs and CMs:
• CP 1543-1 (article
number: 6GK7543-
1AX00-0XE0)
• CM 1542-1 (article
number: 6GK7542-
1AX00-0XE0)
• CP 1542SP-1
(article number:
6GK7542-6UX00-
0XE0)
• CP 1542SP-1 IRC
(article number:
© Siemens AG 2017 All rights reserved

6GK7542-6VX00-
0XE0)
• CP 1543SP-1
(Article number:
6GK7543-6WX00-
0XE0)
CPU 1214C DC/DC/DC 1 6ES7214-1AG40-0AB0 Alternatively, you can
use any S7-1200 CPU
as of firmware V4.0 or
following CPs as of
firmware: V2.1:
• CP 1243-1 (article
number: 6GK7243-
1BX30-0XE0)
• CP 1242-7 GPRS
(article number:
6GK7242-7KX31-
0XE0)
• CP 1243-7 LTE
(article number:
6GK7243-7KX30-
0XE0)
• CP 1243-8 IRC
(article number:
6GK7243-8RX30-
0XE06GK7243-
8RX30-0XE0)

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 11
1 Introduction

Component Numbe Article number Note


r
CPU 315-2 PN/DP 1 6ES7315-2EH14-0AB0 Alternatively, you can
use any S7-300 CPU
with integrated IE
interface as of firmware
V2.5.
Alternatively, you can
use the IM 151-8(F)
PN/DP and IM 154-8
(F/FX) PN/DP.
Alternatively, you can
use any S7-400 CPU
with integrated IE
interface and the
following CPs.
• 6GK7443-1EX20-
0XE0
• 6GK7443-1EX30-
0XE0
• 6GK7443-1EX40-
0XE0
• 6GK7443-1EX41-
0XE0
• 6GK7443-1GX20-
0XE0
© Siemens AG 2017 All rights reserved

• 6GK7443-1GX30-
0XE0
• 6GK7443-1UX00-
0XE0
STEP 7 V15 Update 4 1 Package:
6ES7822-1AA05-0YA5
Download:
6ES7822-1AE05-0YA5

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 12
2 Engineering

2 Engineering
2.1 Interface description for S7-1200 and S7-1500
Function description
The FB "LOpenUserComm_IsoOnTcp" implements a complete ISO-on-TCP
communication relationship to a partner. It encapsulates all OUC instructions in a
user-friendly shell to perform the following functions:
• Management of establishing connection and disconnection using the "enable"
input
• Sending user data of the length "sendLen" via the "sendData" input to the
partner as soon as the "sendRequest" input detects a positive edge.
• Receiving data from a partner and saving it in a storage area that is created on
the "rcvData" parameter.
Note:
If the received data is saved in an optimized data block, the "rcvLen" input
parameter has to include the value 0. For a standard data block this input
parameter has to contain the number of bytes that is to be received.
• Outputting state of the transmission and connection on the "status" output
parameter.

Block interface
© Siemens AG 2017 All rights reserved

Figure 2-1
LOpenUserComm:IsoOnTcp
connectionE
Bool enable Bool
stablished
sendReques
Bool ndr Bool
t
UInt rcvLen done Bool

UInt sendLen busy Bool


isoOnTcpCo
TCON_IP_RFC error Bool
nnParam
rcvdLen UDInt

statusID UInt

status Word
sendData
Variant Variant
rcvData
Variant Variant

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 13
2 Engineering

The following table shows the inputs and outputs of the


"LOpenUserComm_IsoOnTcp" function block for S7-1200 and S7-1500.
Table 2-1
Name P type Data type Comment
enable IN Bool Release signal for the establishing
the connection and the data
exchange
sendRequest IN Bool Trigger of a send job
rcvLen IN UInt Length of the receive data
If the receive data is saved in an
optimized DB, rcvLen = 0.
sendLen IN UInt Maximum number of bytes that are
sent with the job
isoOnTcpConnParam IN TCON_IP_RFC Connection parameters
connectionEstablished OUT Bool Status display:
Connection has been established
ndr OUT Bool Status display:
New data received
done OUT Bool Status display:
Send job successfully completed
busy OUT Bool FB in process
error OUT Bool Error display
© Siemens AG 2017 All rights reserved

rcvdLen OUT UDInt Length of received data (in byte)


statusID OUT UInt Parameter shows which OUC
instruction supplies the error
status OUT Word Status display of the OUC
instructions
sendData IN_OUT Variant Send data area
rcvData IN_OUT Variant Receive data area

Function charts
The following function chart shows how the most important output parameters are
set, depending on the input parameters.
Figure 2-2

activates / deactivates
enable
function block
function block
busy
is active
new data
ndr
received
one cycle
active request send data
sendRequest

send data done


done
one cycle
active

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 14
2 Engineering

2.2 Interface description for S7-300 and S7-400


Function description
The FB "LOpenUserComm_IsoOnTcp" implements a complete ISO-on-TCP
communication relationship to a partner. It encapsulates all OUC instructions in a
user-friendly shell to perform the following functions:
• Management of establishing connection and disconnection using the "enable"
input.
• Sending user data of the length "sendLen" via the "sendData" input to the
partner as soon as the "sendRequest" input detects a positive edge.
• Receiving data from a partner and saving it in a defined receive area. The
receive area is defined by the following two dimensions:
– Pointer at the beginning of the area
– Length of the area
• Outputting state of the transmission and connection on the "status" output
parameter.

Note For ISO-on-TCP the length of the area is either specified by the rcvLen
parameter (if rcvLen <> 0) or the length specification of the parameter "rcvData"
(rcvLen = 0).
© Siemens AG 2017 All rights reserved

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 15
2 Engineering

Block interface
Figure 2-3
LOpenUserComm_IsoOnTcp
connectionE
Bool enable Bool
stablished
sendReques
Bool ndr Bool
t
Int rcvLen done Bool

Int sendLen busy Bool


isoOnTcpCo
TCON_PAR error Bool
nnParam
rcvdLen Int

statusID Int

status Word
sendData
Any Any
rcvData
Any Any

The following table shows the inputs and outputs of the


"LOpenUserComm_IsoOnTcp" function block for S7-300 and S7-400.
© Siemens AG 2017 All rights reserved

Table 2-2
Name P type Data type Comment
enable IN Bool Release signal for the establishing the
connection and the data exchange
sendRequest IN Bool Trigger of a send job
rcvLen IN Int Length of the receive data
• rcvLen = 0 (recommended):
The length of the receive area is
specified by the length details of
the "rcvData" parameter.
• rcvLen <> 0:
The length of the receive area is
specified by the "rcvData"
parameter.
sendLen IN Int Maximum number of bytes that are
sent with the job
isoOnTcpConnParam IN TCON_PAR Connection parameters
connectionEstablished OUT Bool Status display:
Connection has been established
ndr OUT Bool Status display:
New data received
done OUT Bool Status display:
Send job successfully completed
busy OUT Bool FB in process
error OUT Bool Error display

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 16
2 Engineering

Name P type Data type Comment


rcvdLen OUT Int Length of received data (in byte)
statusID OUT Int Parameter shows which OUC
instruction supplies the error
status OUT Word Status display of the OUC instructions
sendData IN_OUT Any Send data area
rcvData IN_OUT Any Receive data area

Function charts
The following function chart shows how the most important output parameters are
set, depending on the input parameters.
Figure 2-4

activates / deactivates
enable
function block
function block
busy
is active
new data
ndr
received
one cycle
active request send data
sendRequest
© Siemens AG 2017 All rights reserved

send data done


done
one cycle
active

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 17
2 Engineering

2.3 Integration into the user project


2.3.1 Opening library in STEP 7 (TIA Portal)

Proceed according to the following instruction in order to open the


"LOpenUseComm" library in STEP 7 (TIA Portal).

Prerequisite
• STEP 7 (TIA Portal) is open.
• You have created a new project in STEP 7 (TIA Portal) or opened an already
existing project.

Instruction
1. Open the "Libraries" task card.
2. Click the "Open global library" button in the "Global libraries" palette. The
"Open global library" dialog box opens.
© Siemens AG 2017 All rights reserved

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 18
2 Engineering

3. Select the "LOpenUserComm.al14" library and click the "Open" button. The
"LOpenUserComm" library in "Global libraries" palette is opened.
© Siemens AG 2017 All rights reserved

4. The "LOpenUserComm_IsoOnTcp" function blocks can be found in the


"LOpenUserComm" library in "Types > ISO-on-TCP" > S7-300/S7-400 and in
"Types > ISO-on-TCP" > S7-1200/S7-1500.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 19
2 Engineering

5. Add the "LOpenUserComm_IsoOnTcp" function block from the library to the


"Program blocks" folder of your CPU, using drag-and-drop.

6. The "LOpenUserComm_IsoOnTcp" function block is shown in "Program


blocks" folder of your CPU.
7. Integrate the "LOpenUserComm_IsoOnTcp" function block into the user
program of your CPU to establish a communication connection to the partner
and to send and receive data (see Chapter 2.3.2).
© Siemens AG 2017 All rights reserved

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 20
2 Engineering

2.3.2 Integrating "LOpenUserComm_IsoOnTcp" function block into the user


program

Proceed in accordance with the following instruction in order to integrate the


"LOpenUserComm_IsoOnTcp" function block into the user program of your CPU.
Cyclically call the "LOpenUserComm_IsoOnTcp" function block in OB 1.
1. Double-click the "Main [OB1]" block in the project tree in the "Program blocks"
folder of the CPU. The OB 1 is opened in the workspace.
2. Select the "LOpenUserComm_IsoOnTcp" function block in the project tree in
the "Program blocks" folder of your CPU and add it into a network of the OB 1,
using drag-and-drop. The "Call options" dialog is opened automatically in order
to create the instance data block of the "LOpenUserComm_IsoOnTcp" function
block.
© Siemens AG 2017 All rights reserved

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 21
2 Engineering

3. Enter the name of the instance DB, for example,


"LOpenUserComm_InstIsoOnTcp". Select the "Automatic" option so that the
number of the instance DB is automatically assigned by STEP 7 (TIA Portal).
© Siemens AG 2017 All rights reserved

4. Assign the inputs and outputs of the "LOpenUserComm_IsoOnTcp" function


block with the appropriate variables.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 22
2 Engineering

2.4 Determining hardware identifier of the CPU or CP/CM


interface
In the "TCON_IP_V4" parameter data record you have to insert the correct
hardware identifier of the used interface. To determine the hardware identifier of
the interface, use the following guideline:
1. In the network view or device view select the CPU or CP/CM interface to
determine its hardware identifier.
2. The properties of the CPU or CP/CM interface are displayed in the inspector
window.
3. Open the "System constants” tab to display the hardware identifier of the
interface.
© Siemens AG 2017 All rights reserved

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 23
2 Engineering

2.5 Error handling S7-1200 and S7-1500


In FB "LOpenUser Comm_IsoOnTcp" some error states are caught as an example
and responses are programmed. However, you can also catch all error states that
are supplied by the OUC instructions and implement your own responses
according to this pattern depending on your requirements.

NOTE Because the values are output on the output parameters only for one cycle, the
values of "status" and "statusId" have to be saved if error=1.

2.5.1 Error while establishing the connection

Connection partner cannot be reached (network error)


The connection partner can, for example, not be reached, when the network cable
to the connection partner is not plugged in or broken.
When actively establishing a connection, the "TCON" instruction recognizes this
error and outputs status 80C6 (hex). In this case the output parameters of FB
"LOpenUserComm_IsoOnTcp" are set as follows for one cycle:
Table 2-3
Output Value Description Remedy
parameter
© Siemens AG 2017 All rights reserved

status 16#80C6 Status display of the Check the network cable between the
TCON instruction: communication partners: Plug in the
The connection network cable or replace it, if
partner cannot be required.
reached (network Retrigger the connection
error). establishment via the enable=1
parameter.
statusId 2 Error while
establishing the
connection with
TCON
error 1 Error display:
1: Error detected

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 24
2 Engineering

When passively establishing a connection, the "TCON" instruction does not


recognizes this error. In this case the watchdog timer is started. When the
watchdog timer has lapsed after 3 min, the output parameters of FB
"LOpenUserComm_IsoOnTcp" are set as follows for one cycle:
Table 2-4
Output Value Description Remedy
parameter
status 16#8102 Connection could not Check the network cable between the
be established communication partners: Plug in the
(watchdog timer network cable or replace it, if
lapsed (3 min)). required.
statusId 1 internal error in Retrigger the connection
function block establishment via the enable=1
parameter.
error 1 Error display:
1: Error detected

IP address of the remote end point of the connection invalid


If the IP address of the remote end point of the connection is invalid or it
corresponds to the IP address of the local end point of the connection, the output
parameters of FB "LOpenUserComm_IsoOnTcp" are set as follows for one cycle:
Table 2-5
Output Value Description Remedy
parameter
© Siemens AG 2017 All rights reserved

status 16#80A4 Status display of the Check the remote IP address in the
TCON instruction TCON_IP_RFC parameter data
record.
statusId 2 Error while
establishing the No broadcast and network addresses
connection with must be used.
TCON Retrigger the connection
establishment via the enable=1
error 1 Error display:
parameter.
1: Error detected

Among others, invalid remote IP addresses are:


• Broadcast addresses, for example, 192.168.0.255
• Network addresses, for example, 192.168.0.0

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 25
2 Engineering

Temporary communication error


The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle
as shown in Table 2-6, if one of the following temporary communication errors
occurs:
• The connection can currently not be established if, for example, the IP address
of the partner endpoint is not correctly entered in the "TCON_IP_RFC"
parameter data record in "RemoteAddress".
• The connection cannot be established because the firewalls on the connection
path are not released for the required ports.
• The interface is currently receiving new parameters.
• The configured connection is currently removed from a TDISCON instruction.
Table 2-6
Output Value Description Remedy
parameter
status 16#80C4 Status display of the Check the IP address of the partner
TCON instruction endpoint in the "TCON_IP_RFC"
statusId 2 Error while parameter data record.
establishing the Enter the IP address of the partner
connection with endpoint at RemoteAddress in the
TCON "TCON_IP_RFC" parameter data
record.
Error 1 Error display:
Retrigger the connection
© Siemens AG 2017 All rights reserved

1: Error detected establishment via the enable=1


parameter.

Connection partner denies connection establishment


Connection partner denies connection establishment if the following conditions
apply:
• Connection partner is passively involved in the connection establishment and
does not initiate the connection establishment.
• Configuration of TSelectors is not correct. The local TSelector in
communication partner A has to match the remote TSelector in communication
partner B and the remote TSelector in communication partner A has to match
the local TSelector in communication partner B.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 26
2 Engineering

The output parameters of FB "LOpenUserComm_IsoOnTcp" are set as follows for


one cycle.
Table 2-7
Output Value Description Remedy
parameter
status 16#80C5 Status display of the Check if the passive communication
TCON instruction partner initiates the connection
establishment.
statusId 2 Error while
establishing the Check the remote and local
connection with TSelector as well as the connection
TCON number in the "TCON_IP_RFC"
parameter data record.
error 1 Error display:
Use the same local and remote
1: Error detected TSelector.
The FB starts the connection
establishment again.

Length of the remote or local TSelector larger 32 bytes


The length of the local and remote TSelector must be a maximum of 32 bytes.
The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle
as in Table 2-8, if the following conditions apply:
• The local or remote TSelector that is specified at "TSel" has a length larger 32
bytes.
© Siemens AG 2017 All rights reserved

• A length larger 32 byte is specified at "TSelLength" of the local or remote


TSelector.
• In the "TCON_IP_RFC" parameter data record the IP address of the partner
endpoint is set to "0.0.0.0".
Table 2-8
Output Value Description Remedy
parameter
status 16#80B7 Status display of the Check the length of the remote and
TCON instruction local TSelector in the
"TCON_IP_RFC" parameter data
statusId 2 Error while
record.
establishing the
connection with Enter a length up to 32 bytes at
TCON "TSelLength" of the local or remote
TSelector.
error 1 Error display:
Use a local and remote TSelector
1: Error detected that has a length of up to 32 bytes at
"TSel".
Enter the IP address of the partner
endpoint at "RemoteAddress" in the
"TCON_IP_RFC" parameter data
record.
Retrigger the connection
establishment via the enable=1
parameter.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 27
2 Engineering

Hardware identifier in the connection parameters not correct


If the "InterfaceId" parameter of the "TCON_IP_RFC" parameter data record does
not reference a hardware identifier of a CPU or CM/CP interface or if it has the
value "0", the output parameters of FB "LOpenUserComm_IsoOnTcp" are set as
follows for one cycle:
Table 2-9
Output Value Description Remedy
parameters
status 16#809B Status display of the Enter the hardware identifier of the
TCON instruction local interface (value range: 0 to
65535) in the "TCON_IP_RFC"
statusId 2 Error while
parameter data record at
establishing the
connection with "InterfaceId".
TCON Detailed information on the
determination of the hardware
error 1 Error display: identifier can be found in chapter 2.4.
1: Error detected Retrigger the connection
establishment via the enable=1
parameter.

Connection number is outside the permitted range


If the "ID" parameter of the "TCON_IP_RFC" parameter data record is outside the
permitted range, the output parameters of FB "LOpenUserComm_IsoOnTcp" are
© Siemens AG 2017 All rights reserved

set as follows for one cycle:


Table 2-10
Output Value Description Remedy
parameters
status 16#8086 Status display of the Enter a value in the "TCON_IP_RFC"
TCON instruction parameter data record at "ID" that is
in the value range from 1 to 4095.
statusId 2 Error while
establishing the Retrigger the connection
connection with establishment via the enable=1
TCON parameter.

error 1 Error display:


1: Error detected

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 28
2 Engineering

Configuration error in "Connectiontype" parameter


If there is a configuration error in the "ConnectionType" parameter of the
"TCON_IP_RFC" parameter data record, the output parameters of
FB "LOpenUserComm_IsoOnTcp" are set as follows for one cycle:
Table 2-11
Output Value Description Remedy
parameters
status 16#80B6 Status display of the Enter the value 0x0C (hex) or
TCON instruction 0x12 (hex) in the "TCON_IP_RFC"
parameter data record at
statusId 2 Error while
"ConnectionType".
establishing the
connection with Retrigger the connection
TCON establishment via the enable=1
parameter.
Error 1 Error display:
1: Error detected

Communication error: "TDISCON" was executed before "TCON" was ended


If the "TCON" instruction finished the connection establishment with DONE=1 or
ERROR=1, a job for connection termination may be triggered.
If the connection establishment is cancelled prematurely by calling a "TDISCON”,
the output parameters of FB "LOpenUserComm_IsoOnTcp" are set as follows for
© Siemens AG 2017 All rights reserved

one cycle.
Table 2-12
Output Value Description Remedy
parameters
status 16#80A7 Status display of the The connection is disconnected by
TCON instruction the FB, since the connection
statusId 2 Error while establishment was prematurely
establishing the cancelled by calling a "TDISCON".
connection with Retrigger the connection
TCON establishment via the enable=1
parameter.
error 1 Error display:
1: Error detected

Job for establishing a connection is triggered during connection termination


If a job to establish a connection is triggered, whilst the disconnection of a
connection is running, the output parameters of FB "LOpenUserComm_IsoOnTcp"
are set as follows for one cycle.
Table 2-13
Output Value Description Remedy
parameters
status 16#80A3 Status display of the The connection is disconnected by
TCON instruction the FB, since the job for establishing
statusId 2 Error while a connection was triggered during a
establishing the running connection termination.
connection with Retrigger the connection
TCON establishment via the enable=1
parameter.
error 1 Error display:
1: Error detected

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 29
2 Engineering

2.5.2 Error when receiving data

Configured length of the receive data invalid


The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle
as in Table 2-14, if the following conditions apply:
• The configured length of the receive data is larger than the largest permitted
value.
• The parameters "rcvLen" and "rcvData" of FB "LOpenUseComm_IsoOnTcp"
have the value "0".
Table 2-14
Output Value Description Remedy
parameters
status 16#8085 Status display of the Specify the length of the data to be
TRCV instruction received on the "rcvLen" parameter.
statusId 3 Error when Specify the receive area on the
receiving data using "rcvData" parameter.
TRCV Detailed information regarding the
maximum number of user data that is
error 1 Error display:
to be transferred using ISO-on-TCP
1: Error detected can be found in the following FAQ
18909487.
Note
© Siemens AG 2017 All rights reserved

If you use a receive area with


optimized access on the "rcvData"
parameter, the "rcvLen" parameter
has to have the value 0.

Receive area incorrectly configured


The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle
as in Table 2-15, if the following conditions apply:
• Receive area too small
• Value on "rcvLen" parameter larger than the receive area that is specified on
the "rcvData" parameter
Table 2-15
Output Value Description Remedy
parameters
status 16#8088 Status display of the Value on "rcvLen" parameter must
TRCV instruction not be larger than the receive area
that is specified on the "rcvData"
statusId 3 Error when
receiving data using parameter.
TRCV If you use a receive area with
optimized access on the "rcvData"
error 1 Error display: parameter, the "rcvLen" parameter
1: Error detected has to have the value 0.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 30
2 Engineering

Length of the receive area smaller than the length of the sent data
If the length of the receive area is smaller than the length of the data that the
communication partner sends, the output parameters of FB
"LOpenUserComm_IsoOnTcp" are set as follows for one cycle:
Table 2-16
Output Value Description Remedy
parameters
status 16#80C9 Status display of the The receive area that you specify on
TRCV instruction the "rcvData" parameter has to have
at least the size of the length of the
statusId 3 Error when
receiving data using data that is sent by the
TRCV communication partner.
The length that is specified on the
Error 1 Error display: "rcvLen" parameter has to have at
1: Error detected least the size of the length of the data
that the communication partner
sends.
If you use a receive area with
optimized access on the "rcvData"
parameter, the "rcvLen" parameter
has to have the value 0.

Communication error
The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle
© Siemens AG 2017 All rights reserved

as shown in Table 2-17, if one of the following communication errors occurs:


• The specified connection has not been established yet.
• The specified connection is currently disconnected. Receive job not possible
via this connection
• The connection is currently reinitiated.
Table 2-17
Output Value Description Remedy
parameters
status 16#80A1 Status display of the Check the network cable between the
TRCV instruction communication partners: Plug in the
network cable or replace it, if
statusId 3 Error when
required.
receiving data using
TRCV Check if the communication partner
has disconnected the connection.
error 1 Error display:
If enable = 1, the connection is
1: Error detected automatically re-established by the
FB as soon as the communication
error is removed.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 31
2 Engineering

Temporary communication error


The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle
as shown in Table 2-18, if one of the following temporary communication errors
occurs:
• Connection to the partner can currently not be established.
• The interface receives new parameter settings, or the connection is
established.
Table 2-18
Output Value Description Remedy
parameters
status 16#80C4 Status display of the Check the network cable between the
TRCV instruction communication partners: Plug in the
Error when network cable or replace it, if
statusId 3
receiving data using required. Check if the communication
partner has disconnected the
TRCV
connection.
error 1 Error display: If enable = 1, the connection is
1: Error detected automatically re-established by the
FB as soon as the communication
error is removed.

2.5.3 Error when sending data


© Siemens AG 2017 All rights reserved

Configured length of the send data invalid


The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle
as in Table 2-19, if the following conditions apply:
• The configured length of the send data is larger than the largest permitted
value.
• The parameters "sendLen" and "sendData" of
FB "LOpenUseComm_IsoOnTcp" have the value "0".
Table 2-19
Output Value Description Remedy
parameters
status 16#8085 Status display of the Specify the length of the data to be
TSEND instruction sent on the "sendLen" parameter.
statusId 4 Error when sending Specify the send area on the
data using TSEND "sendData" parameter.
Detailed information regarding the
error 1 Error display:
maximum number of user data that is
1: Error detected to be transferred using ISO-on-TCP
can be found in the following FAQ
18909487.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 32
2 Engineering

Send area incorrectly configured


The output parameters of "LOpenUserComm_IsoOnTcp" function block are set for
one cycle as in Table 2-20, if the following conditions apply:
• Send area too small.
• Value on "sendLen" parameter larger than the send area that is specified on
the “sendData" parameter.
Table 2-20
Output Value Description Remedy
parameters
status 16#8088 Status display of the Value on "sendLen" parameter must
TSEND instruction not be larger than the send area that
is specified on the "sendData"
statusId 4 Error when sending
parameter.
data using TSEND
error 1 Error display:
1: Error detected

Communication error
The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle
as shown in Table 2-21, if one of the following communication errors applies:
• The specified connection has not been established yet.
© Siemens AG 2017 All rights reserved

• The specified connection is currently disconnected. Send job not possible via
this connection
• The connection is currently reinitiated.
Table 2-21
Output Value Description Remedy
parameters
status 16#80A1 Status display of the Check the network cable between the
TSEND instruction communication partners: Plug in the
Error when sending network cable or replace it, if
statusId 4
data using SEND required.
Check if the communication partner
error 1 Error display: has disconnected the connection.
1: Error detected If enable = 1, the connection is
automatically re-established by
FB "LOpenUserComm_IsoOnTcp" as
soon as the communication error is
removed.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 33
2 Engineering

Temporary communication error


The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle
as shown in Table 2-22, if one of the following temporary communication errors
applies:
• Connection to the partner can currently not be established.
• The interface receives new parameter settings, or the connection is
established.
Table 2-22
Output Value Description Remedy
parameters
status 16#80C4 Status display of the Check the network cable between the
TSEND instruction communication partners: Plug in the
Error when sending network cable or replace it, if
statusId 4
data using TSEND required.
Check if the communication partner
error 1 Error display: has disconnected the connection.
1: Error detected If enable = 1, the connection is
automatically re-established by the
FB as soon as the communication
error is removed.

2.5.4 Error while connection termination


© Siemens AG 2017 All rights reserved

Connection does not exist or is already disconnected


If the connection that is referenced via the "ID" parameter of the "TCON_IP_RFC"
parameter data record does not exist or is already disconnected, the output
parameters of FB "LOpenUserComm_IsoOnTcp" are set as follows for one cycle:
Table 2-23
Output Value Description Remedy
parameters
status 16#80A3 Status display of the Retrigger the connection
TDISCON establishment via the enable=1
instruction parameter.
statusId 5 Error while the
connection
termination using
TDISCON
error 1 Error display:
1: Error detected

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 34
2 Engineering

Connection number is outside the permitted range


If the "ID" parameter of the "TCON_IP_RFC" parameter data record is outside the
permitted range, the output parameters of FB "LOpenUserComm_IsoOnTcp" are
set as follows for one cycle:
Table 2-24
Output Value Description Remedy
parameters
status 16#8086 Status display of the Enter a value in the "TCON_IP_RFC"
TDISCON parameter data record at "ID" that is
instruction in the value range from 1 to 4095.
statusId 5 Error while the
connection
termination using
TDISCON
Error 1 Error display
1: Error detected

Temporary communication error


The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle
as shown in Table 2-25, if one of the following temporary communication errors
occurs:

© Siemens AG 2017 All rights reserved

Interface is reconfigured
• Connection currently being set up
Table 2-25
Output Value Description Remedy
parameter
status 16#80C4 Status display of the The FB tries to disconnect the
TDISCON instruction connection again.
statusId 5 Error while the
connection
termination using
TDISCON
Error 1 Error display:
1: Error detected

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 35
2 Engineering

2.6 Error handling S7-300 and S7-400


In FB "LOpenUser Comm_IsoOnTcp" some error states are caught as an example
and responses are programmed. However, you can also catch all error states that
are supplied by the OUC instructions and implement your own responses
according to this pattern depending on your requirements.

NOTE Because the values are output on the output parameters only for one cycle, the
values of "status" and "statusId" have to be saved if error=1.

2.6.1 Error while establishing the connection

Connection partner cannot be reached


The connection partner cannot be reached if, for example, the following conditions
apply:
• Network cable to connection partner not plugged in or broken
• The correct IP address of the partner endpoint was not entered in the
"TCON_PAR" parameter data record at "rem_staddr".
• Configuration of the local and remote TSAP-ID is not correct. The local TSAP-
ID in communication partner A has to match the remote TSAP-ID in
© Siemens AG 2017 All rights reserved

communication partner B and the remote TSAP-ID in communication partner A


has to match the local TSAP-ID in communication partner B.
• Connection partner is passively involved in the connection establishment and
does not initiate the connection establishment.
In this case the output parameters of FB "LOpenUserComm_IsoOnTcp" are set as
follows for one cycle:
Table 2-26
Output Value Description Remedy
parameter
status 16#8102 Connection could not • Check the network cable
be established between the communication
(watchdog timer partners: Plug in the network
lapsed (3 min)). cable or replace it, if required.
statusId 1 internal error in • Check the IP address of the
function block partner endpoint in the
"TCON_PAR" parameter data
error 1 Error display: record:
1: Error detected Enter the IP address of the
partner endpoint at rem_staddr
in the "TCON_PAR" parameter
data record.
• Check the remote and local
TSAP-ID in the "TCON_PAR"
parameter data record:
Use the same local and remote
TSAP-ID.
• Check if the passive
communication partner initiates
the connection establishment.
Retrigger the connection
establishment via the enable=1
parameter.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 36
2 Engineering

Temporary communication error


The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle
as shown in, if one of the following temporary communication errors occurs:
• The connection cannot be established because the firewalls on the connection
path are not released for the required ports.
• The interface is currently receiving new parameters.
• The configured connection is currently removed from a TDISCON instruction.
Table 2-27
Output Value Description Remedy
parameter
status 16#80C4 Status display of the Retrigger the connection
TCON instruction establishment via the enable=1
statusId 2 Error while parameter.
establishing the
connection with
TCON
Error 1 Error display:
1: Error detected

Length parameter in parameter data record "TCON_PAR" incorrectly configured


If the following length parameters are configured incorrectly, the local and remote
TSelector must be a max. of 32 bytes.
© Siemens AG 2017 All rights reserved

The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle,


if the following length parameters are incorrectly configured in the "TCON_PAR"
parameter data record:
• block_length: Length of the parameter data record "TCON_PAR": 64 bytes
(fixed)
• local_tsap_id_len: Length of the local TSAP-ID
• rem_subnet_id_len: Parameter is currently not used: B#16#00
• rem_staddr_len: Length of the address of the remote connection endpoint
– 0: unspecified, i.e. rem_staddr parameter is irrelevant
– 4: valid IP address in rem_staddr parameter
• rem_tsap_id_len: Length of the remote TSAP-ID
• next_staddr_len: used length of the next_staddr parameter

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 37
2 Engineering

Table 2-28
Output Value Description Remedy
parameter
status 16#80B7 Status display of the Check the length parameters in the
TCON instruction "TCON_PAR" parameter data record.
statusId 2 Error while Retrigger the connection
establishing the establishment via the enable=1
connection with parameter.
TCON
error 1 Error display:
1: Error detected

"local_device_id" does not match CPU


If the "local_device_id" that is specified in parameter data record "TCON_PAR"
does not match the CPU, the output parameters of the
FB "LOpenUserComm_IsoOnTcp" are set as follows for one cycle.
Table 2-29
Output Value Description Remedy
parameters
status 16#809B Status display of the Check whether the "local_device_id"
TCON instruction specified in the "TCON_PAR"
parameter data record, matches the
statusId 2 Error while
CPU.
© Siemens AG 2017 All rights reserved

establishing the
connection with Detailed information on the
TCON "local_device_id" parameter is
available in the following entry FAQ
error 1 Error display: 51339682.
1: Error detected Retrigger the connection
establishment via the enable=1
parameter.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 38
2 Engineering

Connection number is outside the permitted range


If the "id" parameter of the "TCON_PAR" parameter data record is outside the
permitted range, the output parameters of FB "LOpenUserComm_IsoOnTcp" are
set as follows for one cycle:
Table 2-30
Output Value Description Remedy
parameters
status 16#8086 Status display of the Enter a value in the "TCON_PAR"
TCON instruction parameter data record at "id" that is
in the value range from W#16#0001
statusId 2 Error while
to W#16#0FFF.
establishing the
connection with Retrigger the connection
TCON establishment via the enable=1
parameter.
error 1 Error display:
1: Error detected

Configuration error in "connection_type" parameter


If there is a configuration error in the "connection_type" parameter of the
"TCON_PAR" parameter data record, the output parameters of FB
"LOpenUserComm_IsoOnTcp" are set as follows for one cycle:
Table 2-31
© Siemens AG 2017 All rights reserved

Output Value Description Remedy


parameters
status 16#80B6 Status display of the Enter the value B#16#12 in the
TCON instruction "TCON_PAR" parameter data record
at "connection_type".
statusId 2 Error while
establishing the Retrigger the connection
connection with establishment via the enable=1
TCON parameter.

error 1 Error display:


1: Error detected

Communication error: "TDISCON" was executed before "TCON" was ended


If the "TCON" instruction ended the connection establishment with DONE=1 or
ERROR=1, a job for establishing a job may be triggered.
If the connection establishment is cancelled prematurely by calling a "TDISCON”,
the output parameters of FB "LOpenUserComm_IsoOnTcp" are set as follows for
one cycle.
Table 2-32
Output Value Description Remedy
parameters
status 16#80A7 Status display of the The connection is disconnected by
TCON instruction the FB, since the connection
establishment was prematurely
statusId 2 Error while
cancelled by calling a "TDISCON".
establishing the
connection with Retrigger the connection
TCON establishment via the enable=1
parameter.
error 1 Error display:
1: Error detected

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 39
2 Engineering

Attempt to establish a connection of an existing connection


If you are trying to re-establish an existing connection, the output parameters of FB
"LOpenUserComm_IsoOnTcp" are set as follows for one cycle.
Table 2-33
Output Value Description Remedy
parameters
status 16#80A3 Status display of the Since you are trying to re-establish
TCON instruction an existing connection, the
statusId 2 Error while connection is disconnected by the
establishing the FB.
connection with Retrigger the connection
TCON establishment via the enable=1
parameter.
error 1 Error display:
1: Error detected

2.6.2 Error when receiving data

Configured length of the receive data invalid


If the configured length of the receive data is larger than the largest permitted
value, the output parameters of FB "LOpenUserComm_IsoOnTcp" are set as
follows for one cycle.
© Siemens AG 2017 All rights reserved

Table 2-34
Output Value Description Remedy
parameters
status 16#8085 Status display of the Specify the length of the data to be
TRCV instruction received on the "rcvLen" parameter.
statusId 3 Error when Detailed information regarding the
receiving data using max. number of user data that is to
TRCV be transferred using ISO-on-TCP can
be found in the following FAQ
error 1 Error display: 18909487.
1: Error detected

Receive area incorrectly configured


The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle
as in Table 2-15, if the following conditions apply:
• Receive area too small
• Value on "rcvLen" parameter larger than the receive area that is specified on
the "rcvData" parameter
Table 2-35
Output Value Description Remedy
parameters
status 16#8088 Status display of the Value on "rcvLen" parameter must
TRCV instruction not be larger than the receive area
that is specified on the "rcvData"
statusId 3 Error when
parameter.
receiving data using
TRCV
error 1 Error display:
1: Error detected

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 40
2 Engineering

Communication error
The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle
as shown in Table 2-36, if one of the following communication errors occur:
• The specified connection has not been established yet.
• The specified connection is currently disconnected. Receive job not possible
via this connection
• The connection is currently reinitiated.
Table 2-36
Output Value Description Remedy
parameters
status 16#80A1 Status display of the Check the network cable between the
TRCV instruction communication partners: Plug in the
network cable or replace it, if
statusId 3 Error when
required.
receiving data using
TRCV Check if the communication partner
has disconnected the establishment.
error 1 Error display: If enable = 1, the connection is
1: Error detected automatically re-established by the
FB as soon as the communication
error is removed.

Temporary communication error


© Siemens AG 2017 All rights reserved

The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle


as shown in Table 2-37, if one of the following temporary communication errors
occurs:
• Connection to the partner can currently not be established.
• The interface receives new parameter settings or the connection is
established.
• Length of the receive area is smaller than the length of the data that the
communication partner sends

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 41
2 Engineering

Table 2-37
Output Value Description Remedy
parameters
status 16#80C4 Status display of the Check the network cable between the
TRCV instruction communication partners: Plug in the
network cable or replace it, if
statusId 3 Error when
required. Check if the communication
receiving data using
partner has disconnected the
TRCV
establishment.
error 1 Error display: The length of the receive area that
1: Error detected you specify on the "rcvData"
parameter has to have at least the
size of the length of the data that is
sent by the communication partner.
The length that is specified on the
"rcvData" parameter has to have at
least the size of the length of the data
that the communication partner
sends.
If enable = 1, the connection is
automatically re-established by the
FB as soon as the communication
error is removed.

2.6.3 Error when sending data


© Siemens AG 2017 All rights reserved

Configured length of the send data invalid


If the configured length of the send data is larger than the largest permitted value,
the output parameters of FB "LOpenUserComm_IsoOnTcp" are set as follows for
one cycle.
Table 2-38
Output Value Description Remedy
parameters
status 16#8085 Status display of the Specify the length of the data to be
TSEND instruction sent on the "sendLen" parameter.
statusId 4 Error when sending Detailed information regarding the
data using TSEND max. number of user data that is to
be transferred using ISO-on-TCP can
error 1 Error display: be found in the following FAQ:
1: Error detected 18909487.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 42
2 Engineering

Send area incorrectly configured


The output parameters of "LOpenUserComm_IsoOnTcp" function block are set for
one cycle as in Table 2-39, if the following conditions apply:
• Send area too small
• Value on "sendLen" parameter larger than the send area that is specified on
the “sendData" parameter
Table 2-39
Output Value Description Remedy
parameters
status 16#8088 Status display of the Value on "sendLen" parameter must
TSEND instruction not be larger than the send area that
is specified on the "sendData"
statusId 4 Error when sending
parameter
data using TSEND
error 1 Error display:
1: Error detected

Communication error
The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle
as shown in Table 2-40, if one of the following communication errors are the case:
• The specified connection has not been established yet.
© Siemens AG 2017 All rights reserved

• The specified connection is currently disconnected. Receive job not possible


via this connection
• The connection is currently reinitiated.
Table 2-40
Output Value Description Remedy
parameters
status 16#80A1 Status display of the Check the network cable between the
TSEND instruction communication partners: Plug in the
network cable or replace it, if
statusId 4 Error when sending
required.
data using TSEND
Check if the communication partner
error 1 Error display: has disconnected the establishment.
1: Error detected If enable = 1, the connection is
automatically re-established by FB
"LOpenUserComm_IsoOnTcp" as
soon as the communication error is
removed.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 43
2 Engineering

Temporary communication error


The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle
as shown in Table 2-41, if one of the following temporary communication errors is
the case:
• Connection to the partner can currently not be established.
• The interface receives new parameter settings, or the connection is
established.
Table 2-41
Output Value Description Remedy
parameters
status 16#80C4 Status display of the Check the network cable between the
TSEND instruction communication partners: Plug in the
network cable or replace it, if
statusId 4 Error when sending
required.
data using TSEND
Check if the communication partner
error 1 Error display has disconnected the establishment.
1: Error detected If enable = 1, the connection is
automatically re-established by the
FB as soon as the communication
error is removed.

2.6.4 Error while connection termination


© Siemens AG 2017 All rights reserved

Connection does not exist or is already disconnected


If the connection that is referenced via the "ID" parameter of the "TCON_IP_RFC"
parameter data record does not exist or is already disconnected, the output
parameters of FB "LOpenUserComm_IsoOnTcp" are set as follows for one cycle:
Table 2-42
Output Value Description Remedy
parameters
status 16#80A3 Status display of the Retrigger the connection
TDISCON establishment via the enable=1
instruction parameter.
statusId 5 Error while the
connection
termination using
TDISCON
error 1 Error display:
1: Error detected

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 44
2 Engineering

Connection number is outside the permitted range


If the "id" parameter of the "TCON_PAR" parameter data record is outside the
permitted range, the output parameters of FB "LOpenUserComm_IsoOnTcp" are
set as follows for one cycle:
Table 2-43
Output Value Description Remedy
parameters
status 16#8086 Status display of the Enter a value in the "TCON_PAR"
TDISCON parameter data record at "id" that is
instruction in the value range from W#16#0001
statusId 5 Error while the to W#16#0FFF.
connection
termination using
TDISCON
Error 1 Error display
1: Error detected

Temporary communication error


The output parameters of FB "LOpenUserComm_IsoOnTcp" are set for one cycle
as shown in Table 2-44, if one of the following temporary communication errors
occurs:

© Siemens AG 2017 All rights reserved

Interface is reconfigured
• Connection currently being set up
Table 2-44
Output Value Description Remedy
parameter
status 16#80C4 Status display of the The FB tries to disconnect the
TDISCON instruction connection again.
statusId 5 Error while the
connection
termination using
TDISCON
Error 1 Error display:
1: Error detected

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 45
2 Engineering

2.7 Explanation regarding the "stateMachine" region


The state machine includes the following states:
• STATE_IDLE
• STATE_PARAM
• STATE_CONNECT
• STATE_CONNECTED
• STATE_RECEIVE
• STATE_SEND

2.7.1 STATE_IDLE

In the "STATE_IDLE" idle state all parameters (static tags and outputs of the
FB "LOpenUserComm_IsoOnTcp") are reset.
The FB "LOpenUserComm_IsoOnTcp" waits in the "STATE_IDLE" state until it
detects a positive edge on the "enable" input parameter.

2.7.2 STATE_PARAM

The connection parameters are read.


The FB "LOpenUserComm_IsoOnTcp" changes to the "STATE_CONNECT" state
© Siemens AG 2017 All rights reserved

without transition conditions.

2.7.3 STATE_CONNECT

The job for establishing a connection is triggered if the connection is not


established.
If the connection is successfully established with "TCON", the
FB "LOpenUserComm_IsoOnTcp" goes to the "STATE_CONNECTED" state. The
connection remains established until "TDISCON" is disconnected the connection.
If an error occurs while establishing the connection, the following actions are
performed in FB "LOpenUserComm_IsoOnTcp":
• The error information is saved in the static "statStatus" tag of the "Word" data
type.
• The state in which the error occurred is saved in the static "statStatusId" tag of
the "UInt" data type.
• The FB changes into the "STATE_ERROR" state.
The values of the tags "statStatus" and "statStatusId" are transferred to the "status"
and "statusId" output parameters of the FB "LOpenUserComm_IsoOnTcp" in the
"STATE_ERROR" state.
Table 2-45 shows the values and meaning of the output parameters "status" and
"statusId".

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 46
2 Engineering

2.7.4 STATE_CONNECTED

The receipt of data using "TRCV" is released.


If new data is received using "TRCV", the following actions are performed in
FB "LOpenUserComm_IsoOnTcp":
• The output parameters "ndr" and "busy" are set to the following values for one
cycle:
– ndr = 1
– busy = 0
• The FB changes into the "STATE_RECEIVE" state.
If an error occurs while receiving data using "TRCV", the following actions are
performed in FB "LOpenUserComm_IsoOnTcp":
• The error information is saved in the static "statStatus" tag of the "Word" data
type.
• The state in which the error occurred is saved in the static "statStatusId" tag of
the "UInt" data type.
• The FB changes into the "STATE_ERROR" state.
The values of the tags "statStatus" and "statStatusId" are transferred to the "status"
and "statusId" output parameters of the FB "LOpenUserComm_IsoOnTcp" in the
"STATE_ERROR" state.
© Siemens AG 2017 All rights reserved

Table 2-45 shows the values and meaning of the output parameters "status" and
"statusId".

2.7.5 STATE_RECEIVE

The received data can be processed individually.


The FB "LOpenUserComm_IsoOnTcp" changes back to the
"STATE_CONNECTED" state without transition conditions.

2.7.6 STATE_SEND

A new send job is triggered, if the following conditions apply:


• positive edge on "sendRequest" input parameter
• no send job active
If a send job is active, the following actions are performed in
FB "LOpenUserComm_IsoOnTcp":
• The receipt of data using "TRCV" is disabled.
• The new send job cannot be triggered.
If a send job was successfully completed using "TSEND", the following actions are
performed in FB "LOpenUserComm_IsoOnTcp":
• The output parameters "done" and "busy" are set to the following values for
one cycle:
– done = 1
– busy = 0
• The FB changes back into the "STATE_CONNECTED" state.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 47
2 Engineering

If an error occurs while sending data using "TSEND", the following actions are
performed in FB "LOpenUserComm_IsoOnTcp":
• The error information is saved in the static "statStatus" tag of the "Word" data
type.
• The state in which the error occurred is saved in the static "statStatusId" tag of
the "UInt" data type.
• The FB changes into the "STATE_ERROR" state.
The values of the tags "statStatus" and "statStatusId" are transferred to the "status"
and "statusId" output parameters of the FB "LOpenUserComm_IsoOnTcp" in the
"STATE_ERROR" state.
Table 2-45 shows the values and meaning of the output parameters "status" and
"statusId".

2.7.7 STATE_DISCONNECT

The job for connection termination is triggered, if the connection is established or if


another attempt to establish the connection is to be initiated.
If the connection is successfully disconnected, the
FB "LOpenUserComm_IsoOnTcp" goes to the "STATE_IDLE" idle state.
If an error occurs while disconnecting the connection, the following actions are
performed in FB "LOpenUserComm_IsoOnTcp":
• The error information is saved in the static "statStatus" tag of the "Word" data
© Siemens AG 2017 All rights reserved

type.
• The state in which the error occurred is saved in the static "statStatusId" tag of
the "UInt" data type.
• The FB changes into the "STATE_ERROR" state.
The values of the tags "statStatus" and "statStatusId" are transferred to the "status"
and "statusId" output parameters of the FB "LOpenUserComm_IsoOnTcp" in the
"STATE_ERROR" state.
Table 2-45 shows the values and meaning of the output parameters "status" and
"statusId".

2.7.8 STATE_ERROR

The "ERROR" state evaluates the most important error information of the OUC
instructions ("TCON", "TDISCON", "TSEND" and "TRCV") and shows the user how
the can respond to this error information.
The user has the option to expand the "STATE_ERROR" state according to this
pattern:
• Analyze other OUC error messages and realize individual responses.
• Create your own user-specific error analyzes, for example, if the received data
does not correspond to what the program expects.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 48
2 Engineering

The following figure shows the general pattern according to which this state is
realized.
Figure 2-5

Start

From which
state does the
call take place

y Specifying
STATE_ Decision about
CONNECT off subsequent
response
state
n

y Specifying
off Decision about
STATE_ subsequent
DISCONNECT response
© Siemens AG 2017 All rights reserved

state
n

off y Specifying
STATE_
Decision about
subsequent
SEND response
state
n

off y Specifying
STATE_
Decision about
subsequent
SEND response
state

Start/Stop

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 49
2 Engineering

In the "Decision about response" program block it is defined how the


FB "LOpenUserComm_IsoOnTcp" will respond in the event of an error. The
response depends on the state in which the error occurred. In this example, the
following responses present themselves, depending on the cause of the error:
• If an error occurs while establishing the connection, the following responses
are realized in FB "LOpenUserComm_IsoOnTcp":
– In order to remove the error autonomously, the FB changes to the
"STATE_DISCONNECT" or "STATE_CONNECT" state.
If an established connection has to be disconnected first before the
establishment of a connection can be started again internally, the FB
changes to the "STATE_DISCONNECT" state.
If the connection partner refuses the establishment of a connection or has
actively disconnected the connection, the FB changes to the
"STATE_CONNECT" state, in order to internally restart the connection
establishment.
– If an error occurs that has to be removed by the user, the FB changes to
the "STATE_IDLE” idle state. This error occurs, for example, if the
connection configuration is incorrect or there is a network error so that the
connection partner cannot be reached. The user has to remove the error
and then retrigger establishing a connection via the "enable" parameter.
• If an error occurs while sending or receiving data, the following responses are
realized in FB "LOpenUserComm_IsoOnTcp":
– If the connection partner cannot be reached or there is a temporary
communication error, the FB changes to the "STATE_CONENCTED" state.
© Siemens AG 2017 All rights reserved

A temporary communication error occurs, for example, if the network cable


to the connection partner is not plugged in or broken.
– If an error occurs that has to be removed by the user, the FB changes to
the "STATE_DISCONNECT" state. This error occurs if the length is not
correctly specified on the input parameters "rcvLen" or "sendLen" or the
send or receive buffer on the input parameters "rcvData" or "sendData" are
not correctly specified. The connection is disconnected. The user has to
remove the error and then retrigger establishing a connection via the
"enable" parameter.
– If the connection was disconnected via the "enable" parameter, the FB
goes to the "STATE_IDLE" idle state.
• If an error occurs while disconnecting the connection, the following responses
are realized in FB "LOpenUserComm_IsoOnTcp":
– In order to start another attempt to disconnect the connection, the FB
changes to the "STATE_DISCONNECT" state. Once the connection has
been successfully disconnected, it is waited in the "STATE_IDLE" state
until a positive edge is detected on the "enable" input parameter.

Note If an error occurs, the "error" output parameter is set to the value "1" for one
cycle and the respective error information is output on the "status" output
parameter. Via the "statusId" output parameter you will receive information on
the state in which the error occurred.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 50
2 Engineering

The following table shows the values and meaning of the output parameters
"status" and "statusId" of the "LOpenUserComm_IsoOnTcp" function block.
Table 2-45
statusId Meaning status Comment
Value (dec) Value (hex)
1 internal error in 16#8101 Function block could not be
function block activated.
1 internal error in 16#8102 Connection could not be
function block established (watchdog timer
lapsed (3 min)).
2 Error on TCON - The "status" of TCON is output on
the "status" output parameter of
the "LOpenUserComm_IsoOnTcp"
function block.
3 Error on TRECV - The "status" of TRCV is output on
the "status" output parameter of
the "LOpenUserComm_IsoOnTcp"
function block.
4 Error on TSEND - The "status" of TSEND is output
on the "status" output parameter of
the "LOpenUserComm_IsoOnTcp"
function block.
5 Error on - The "status" of TDISCON is output
TDISCON on the "status" output parameter of
© Siemens AG 2017 All rights reserved

the "LOpenUserComm_IsoOnTcp"
function block.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 51
3 Valuable Information

3 Valuable Information
3.1 Basics
3.1.1 Basics on ISO-on-TCP Protocol

For more information on the ISO-on-TCP protocol, please refer to the following
FAQ:
https://support.industry.siemens.com/cs/ww/en/view/26171811

3.1.2 Configuration of the "TCON_IP_RFC" parameter data record

In order to configure the communication connections at ISO-on-TCP, a connection


description DB with a structure according to "TCON_IP_RFC" is used for the CPUs
of S7-1200 as of V4.0 and S7-1500. The fixed data structure of the
"TCON_IP_RFC" contains the parameters required to establish the connection.
The "isoOnTcpConnParam" connection parameter of the
FB "LOpenUserComm_IsoOnTcp" contains a reference to the data block used.
Table 3-1
Byte Parameter Data type Start Description
value
0 to 1 InterfaceId HM_ANY 64 Hardware identifier of the
© Siemens AG 2017 All rights reserved

local interface (value


range: 0 to 65535)
Detailed information on the
determination of the
hardware identifier can be
found in chapter 2.4.
2 to 3 ID CONN_OUC 1 Connection number
(values range: 1 to 4095)
4 ConnectionType BYTE 12 Connection type 12: ISO-
on-TCP (12 dec = 0x0C
hex)
5 ActiveEstablished BOOL False Identifier for the type of
connection establishment:
• False: passive
connection
establishment
• True: active
connection
establishment
8 to 11 RemoteAddress ARRAY [1..4] - IP address of the partner
of BYTE endpoint, for example, for
192.168.0.2
12 to RemoteTselector TSelector - TSelector of the remote
45 connection partner:
• TSelLength = value
range 0 to 32 as UINT
• TSel[1-32] = value
range each 0 to 255 in
byte

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 52
3 Valuable Information

Byte Parameter Data type Start Description


value
46 to LocalTselector TSelector - TSelector of the local
79 connection partner:
• TSelLength = value
range 0 to 32 as UINT
• TSel[1-32] = value
range each 0 to 255 in
byte

Note We recommend using the same TSelector for the local and remote connection
partner.

3.1.3 Configuration of the "TCCON_PAR" parameter data record

In order to configure the communication connections at ISO-on-TCP, create a DB


for the CPUs of S7-300 and S7-400 that contains the data structure from UDT 65
"TCON_PAR". This data structure contains the parameters you need to establish
the connection.
The "isoOnTcpConnParam" connection parameter of the
FB "LOpenUserComm_IsoOnTcp" contains a reference to the data block used.
Table 3-2
© Siemens AG 2017 All rights reserved

Byte Parameter Data type Start value Description


0 to 1 block_length WORD W#16#40 Length of UDT 65:
64 bytes (fixed)
2 to 3 id WORD W#16#0001 Connection number (value
range: W#16#0001 to
W#16#0FFF)
4 connection_type BYTE B#16#12 Protocol variant
B#16#12: ISO-on-TCP
5 active_est BOOL False Identifier for the type of
connection establishment:
• False: passive
connection
establishment
• True: active
connection
establishment
6 local_device_id BYTE B#16#02 Detailed information on
the "local_device_id"
parameter is available in
entry 51339682.
7 local_tsap_id_len BYTE B#16#02 Used length of the
"local_tsap_id" parameter
The following values are
possible at
"connection_type" =
B#16#12:
• 2 to 16
8 rem_subnet_id_len BYTE B#16#00 This parameter is
currently not used. You
have to assign it using
B#16#00.

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 53
3 Valuable Information

Byte Parameter Data type Start value Description


9 rem_staddr_len BYTE B#16#00 Length of the address of
the remote connection
endpoint:
• 0: unspecified, i.e.,
"rem_staddr"
parameter is
irrelevant
• 4: valid IP address in
"rem_staddr"
parameter
10 rem_tsap_id_len BYTE B#16#00 Used length of the
"rem_tsap_id" parameter
The following values are
possible at
"connection_type" =
B#16#12:
• Active page: 2 to 16
• Passive page: 0
(unspecified) or 2 to
16
11 next_staddr_len BYTE B#16#00 Used length of the
parameter (only relevant
for ISO-on-TCP)
12 to local_tsap_id ARRAY - Local TSAP-ID
© Siemens AG 2017 All rights reserved

27 [1..16] of Detailed information on


BYTE TSAP-ID can be found in
chapter "Length and
configuration of the local
and remote TSAP-ID"
28 to rem_subnet_id ARRAY B#16#00 This parameter is
33 [1..16] of currently not used. You
BYTE have to assign it using
B#16#00.
34 to rem_staddr ARRAY [1..6] - IP address of the remote
39 of BYTE connection endpoint, for
example, 192.168.0.1:
rem_staddr[1] = B#16#C0
rem_staddr[2] = B#16#A8
rem_staddr[3] = B#16#0
rem_staddr[4] = B#16#1
rem_staddr[5] = B#16#00
rem_staddr[6] = B#16#00
40 to rem_tsap_id ARRAY - Remote TSAP-ID
55 [1..16] of Detailed information on
BYTE TSAP-ID can be found in
chapter "Length and
configuration of the local
and remote TSAP-ID"

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 54
3 Valuable Information

Byte Parameter Data type Start value Description


56 to next_staddr ARRAY [1..6] - Depending on
61 of BYTE "local_device_id"
parameter
"local_device_id" =
B#16#00:
• next_staddr[1]:
Rack and slot of the
appropriate (local) CP
(bits 0 to 4: slot, bits 5
to 7: rack)
• next_staddr[2-6]:
B#16#00
"local_device_id" <>
B#16#00:
• next_staddr[1-6] =
B#16#00
62 to spare WORD W#16#0000 Reserve
63 Assign this parameter
using W#16#0000.

Length and configuration of the local and remote TSAP-ID


• Active connection establishment:
– Remote TSAP-ID:
© Siemens AG 2017 All rights reserved

Each string with a length of between 1 and 16 byte is permitted. Each


string can have a value between B#16#00 to B#16#FF.
– Local TSAP-ID:
For an integrated IE interface, each string with a length of between 1 and
16 byte is permitted. Each string can have a value between B#16#00 to
B#16#FF.
• Passive connection establishment:
– Remote TSAP-ID:
Each string with a length of between 1 and 16 byte is permitted. Each
string can have a value between B#16#00 to B#16#FF.
– Local TSAP ID: see Table 3-3
Table 3-3
loc_tsap_id_len local_tsap_id[1] local_tsap_id[2] local_tsap_id[3 to
16]
2 B#16#E0 0 (only for integrated Does not exist
(connection type T IE interface) or rack
connection) and slot of the
dedicated CPU (bits
0 to 4 slot, bits 5 to
7 rack number)
3 to 16 B#16#E0 0 (only for integrated TSAP expansion
(connection type T IE interface) or rack
connection) and slot of the
dedicated CPU (bits
0 to 4 slot, bits 5 to
7 rack number)
only for integrated irrelevant TSAP expansion
IE interface: a ASCII
string (B#16#20 to
B#16#7E)

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 55
3 Valuable Information

3.2 Details on the mode of operation


3.2.1 Structure of the program

The following figure shows the structure of FB "LOpenUserComm_IsoOnTcp". The


program consists of four regions.

Figure 3-1

Edge detection of the input parameters (enable,


edgeDetection
sendrequest)

Initializes the state machine depending on


initStates
the input parameters

stateMachine Includes the state machine

Cyclic call of the instructions for the Open


© Siemens AG 2017 All rights reserved

callOUCblocks User Communication (TCON, TDISCON,


TSEND, TRCV)

3.2.2 Explanation regarding the "edgeDetection" region

The "edgeDetection" region includes the edge evaluation of the following input
parameters:
• "enable": positive and negative edge is evaluated
• "sendRequest": positive edge is evaluated

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 56
3 Valuable Information

3.2.3 Explanation regarding the "initStates" region

If a positive edge is detected on the "enable" input parameter, the following actions
are performed in FB "LOpenUserComm_IsoOnTcp":
• "busy" output parameter is set to value "1".
• State machine is initiated using the "STATE_PARAM" state, in order to read
the connection parameters and to trigger a job to establish a connection.
• State machine is initialized using the "STATE_DISCONNECT" state in order to
establish a connection if it could not be successfully established within 3 min.
If a negative edge is detected on the "enable" input parameter, the state machine is
initialized using the "STATE_DISCONNECT" state in order to trigger a job to
establish a connection.
If a positive edge is detected on the "sendRequest" input parameter and the
connection is established, the state machine is initialized using the
"STATE_SEND" state in order to trigger a send job.

3.2.4 Explanation regarding the "stateMachine" region

Detailed information about the state machine you can find in Chapter 2.7.

3.2.5 Explanation regarding the "callOUCblocks" region


© Siemens AG 2017 All rights reserved

The following OUC instructions are called cyclically in the FB


"LOpenUserComm_IsoOnTcp":
• TCON, to establish the ISO-on-TCP connection
• TDISCON, to terminate the ISO-on-TCP connection
• TSEND, to send data to the communication partner via ISO-on-TCP
connection
• TRCV, to receive data from the communication partner via the ISO-on-TCP
connection

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 57
4 Annex

4 Annex
4.1 Service and support
Industry Online Support
Do you have any questions or need support?
Siemens Industry Online Support offers access to our entire service and support
know-how as well as to our services.
Siemens Industry Online Support is the central address for information on our
products, solutions and services.
Product information, manuals, downloads, FAQs and application examples – all
information is accessible with just a few mouse clicks at:
https://support.industry.siemens.com

Technical Support
Siemens Industry's Technical Support offers quick and competent support
regarding all technical queries with numerous tailor-made offers
– from basic support right up to individual support contracts.
Please address your requests to the Technical Support via the web form:
www.siemens.en/industry/supportrequest
© Siemens AG 2017 All rights reserved

SITRAIN – Training for Industry


With our globally available training courses for our products and solutions and
using innovative teaching methods, we help you achieve your goals.
More information on the training courses offered as well as on locations and dates
is available at:
www.siemens.de/sitrain

Service offer
Our service offer includes the following:
• Plant Data Services
• Spare Parts Services
• Repair Services
• On Site and Maintenance Services
• Retrofit and Modernization Services
• Service Programs and Agreements
Detailed information on our service offer is available in the Service Catalog:
https://support.industry.siemens.com/cs/sc

Industry Online Support app


Thanks to the "Siemens Industry Online Support" app, you will get optimum
support even when you are on the move. The app is available for Apple iOS,
Android and Windows Phone:
https://support.industry.siemens.com/cs/ww/en/sc/2067

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 58
4 Annex

4.2 Links and literature


Table 4-1
No. Topic
\1\ Siemens Industry Online Support
https://support.industry.siemens.com
\2\ Link to the entry page of the application example
https://support.industry.siemens.com/cs/ww/en/view/109747710
\3\ SIMATIC STEP 7 Basic/Professional V15 and SIMATIC WinCC V15
https://support.industry.siemens.com/cs/ww/en/view/109764516
\4\ SIMATIC STEP 7 Basic/Professional V15.1 and SIMATIC WinCC V15.1
https://support.industry.siemens.com/cs/ww/en/view/109755202

4.3 Change documentation


Table 4-2
Version Date Modifications
V1.0 06/2017 First version
V1.1 08/2017 Entry for S7-300, S7-400 and CPs/CMs expanded
• Chapter 2.6 and chapter 3.1.3 added
© Siemens AG 2017 All rights reserved

OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 59

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy