IsoOnTcp BaseComm V1 en
IsoOnTcp BaseComm V1 en
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
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.
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
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 5
1 Introduction
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
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 7
1 Introduction
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
"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
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 10
1 Introduction
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
• 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
statusID UInt
status Word
sendData
Variant Variant
rcvData
Variant Variant
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 13
2 Engineering
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
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 14
2 Engineering
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
statusID Int
status Word
sendData
Any Any
rcvData
Any Any
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
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
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 17
2 Engineering
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
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 19
2 Engineering
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 20
2 Engineering
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 21
2 Engineering
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 22
2 Engineering
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 23
2 Engineering
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.
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
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
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 25
2 Engineering
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 26
2 Engineering
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 27
2 Engineering
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 28
2 Engineering
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
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 29
2 Engineering
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
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 31
2 Engineering
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 32
2 Engineering
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
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 34
2 Engineering
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
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.
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 36
2 Engineering
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
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
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 39
2 Engineering
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
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.
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.
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 42
2 Engineering
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
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 43
2 Engineering
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 44
2 Engineering
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.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
2.7.3 STATE_CONNECT
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 46
2 Engineering
2.7.4 STATE_CONNECTED
Table 2-45 shows the values and meaning of the output parameters "status" and
"statusId".
2.7.5 STATE_RECEIVE
2.7.6 STATE_SEND
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
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
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
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 52
3 Valuable Information
Note We recommend using the same TSelector for the local and remote connection
partner.
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 53
3 Valuable Information
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 54
3 Valuable Information
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 55
3 Valuable Information
Figure 3-1
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
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.
Detailed information about the state machine you can find in Chapter 2.7.
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
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
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 58
4 Annex
OUC: ISO-on-TCP
Entry ID: 109747710, V1.1, 10/2017 59