You are on page 1of 27

Acyclic Reading and

Writing using the


“IO-Link Library”
Siemens
SIMATIC S7-300/400/1200/1500 Industry
Online
https://support.industry.siemens.com/cs/ww/en/view/82981502 Support
Table of contents

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 for eseeable
damage typical of the type of agreement, unless liability arises from intent or gross negligence or
 Siemens AG 2018 All rights reserved

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.

IO-Link
Entry ID: 82981502, V5.1, 01/2018 2
Table of contents

Table of contents
Legal information ..................................................................................................... 2
1 Library Overview ............................................................................................ 4
1.1 User scenarios .................................................................................. 5
2 Library Blocks ................................................................................................ 6
2.1 Block list ............................................................................................ 6
2.2 Explanation of IO_LINK_MASTER block ............................................ 7
2.2.1 Description ........................................................................................ 7
2.2.2 Interface and parameter..................................................................... 8
2.2.3 Mode of operation............................................................................ 10
2.2.4 Status and error displays ................................................................. 11
2.3 Explanation for the IO_LINK_DEVICE block .................................... 12
2.3.1 Description ...................................................................................... 12
2.3.2 Interface and parameter................................................................... 13
2.3.3 Mode of operation............................................................................ 16
2.3.4 Status and error displays ................................................................. 17
3 Working with the Library in STEP 7 V5.5..................................................... 19
3.1 Integrating the library ....................................................................... 19
3.2 Using library blocks.......................................................................... 20
4 Working with the Library in STEP 7 V14 ...................................................... 22
 Siemens AG 2018 All rights reserved

4.1 Integrating the library ....................................................................... 22


4.2 Using library blocks.......................................................................... 24
4.3 Configuring the ET200ecoPN IO-Link master (6ES7148-6JD00-
0AB0) .............................................................................................. 25
5 Appendix....................................................................................................... 26
5.1 Service and Support ........................................................................ 26
5.2 Links and literature .......................................................................... 27
5.3 Change documentation .................................................................... 27

IO-Link
Entry ID: 82981502, V5.1, 01/2018 3
1 Library Overview
1.1 User scenarios

1 Library Overview
What will I get?
The present document describes the block libraries for STEP 7 V14 SP1 and
STEP 7 V5.5 SP4 Hotfix 11.
You will receive a tested code with clearly defined interfaces together with these
block libraries. They can be used as a basis for the task you want to implement.
The main focus of this document is to describe
 all blocks belonging to the block library.
 the functionality implemented through these blocks.

Scope of validity of the library


This description is valid for using the IO-Link block libraries “IO_LINK_Library_V14”
and “IO_LINK_Library_V55” with the following SIMATIC controllers and the
respective configuration software:

Table 1-1
Library Engineering S7-300 S7-400 S7-1200 S7-1500
software
 Siemens AG 2018 All rights reserved

IO_LINK_Library_V55 STEP 7 V5.5 X X


Library version: V5.1 SP4
IO_LINK_Library_V14 STEP 7 X X X X
Library version: V5.1 Professional V14
SP1
STEP 7 Basic X
V14 SP1

Overview of the current block versions

Table 1-2
S7-CPU family IO_LINK_MASTER IO_LINK_DEVICE
V14 SP1 V5.5 V14 SP1 V5.5
S7-1200 V2.0.1 V3.0.3
S7-1500 V3.0.0 V3.0.2
S7-300/400 V3.0.0 V3.0 V3.0.1 V3.1

IO-Link
Entry ID: 82981502, V5.1, 01/2018 4
1 Library Overview
1.1 User scenarios

1.1 User scenarios


Possible application of the IO-LINK libraries
The product portfolio for IO-Link is continuously growing. This is why the known
block library (IO_LINK_CALL) for SIMATIC S7 has been completely adjusted to
these new requirements.
Currently, several IO-Link communication modules in very different designs are
available for SIMATIC:
 ET 200S 4SI IO-Link
 ET 200S 4SI SIRIUS
 ET 200SP CM 4xIO-Link
 ET 200AL CM 4xIO-Link
 ET 200ecoPN IO-Link Master
 S7-1200 SM 1278 IO-Link

Based on the different designs and the new requirements, there are now generally
two blocks for processing device parameters and data records.
 Siemens AG 2018 All rights reserved

Table 1-3
IO-Link block Functionality
IO-Link master Using the "IO_LINK_MASTER" function block, you can backup or
restore the device parameters and settings of an IO-Link
communication module/IO-Link master (e.g. ET 200SP CM 4xIO-
Link) using the S7 program.
IO-Link device Using this “IO_LINK_DEVICE” function block, you can write device
parameters acyclically to an IO-Link device via the S7 program, or
read parameters, measured values and diagnostic data of an IO-Link
device.
Note:
This block replaces the main function of the previously available
“IO_LINK_CALL” block.

IO-Link
Entry ID: 82981502, V5.1, 01/2018 5
2 Library Blocks
2.1 Block list

2 Library Blocks
What will you learn here?
In this chapter all blocks of the IO-Link library that are essentially involved in the
implementation of the functionality are explained.

2.1 Block list


In the table below, you will find all the blocks belonging to the IO-Link library.

Table 2-1
Blocks Blocks STEP 7 Icon
STEP 7 V14 SP1 5.5 SP4
FB 50000 FB 5000 IO_LINK_MASTER
FB 50001 FB 5001 IO_LINK_DEVICE
SFB52 RDREC (system function)
SFB53 WRREC (system function)
SFB3 TP (IEC function)
SFB4 TON (IEC function)
 Siemens AG 2018 All rights reserved

IO-Link
Entry ID: 82981502, V5.1, 01/2018 6
2 Library Blocks
2.2 Explanation of IO_LINK_MASTER block

2.2 Explanation of IO_LINK_MASTER block


For the communication with the IO-Link communication modules (so-called IO-Link
masters), the “IO_LINK_MASTER” function block is available.

2.2.1 Description

By means of this block, you can backup or restore the device parameters and
settings of an IO-Link communication module (e.g. ET 200SP CM 4xIO-Link) via
the S7 program.
This block works in the current version of the library with the following IO-Link
communication modules:
Table 2-2
IO-Link communication module FW Article number
ET 200SP CM 4xIO-Link As of 6ES7137-6BD00-0BA0
V2.2
ET 200AL CM 4xIO-Link As of 6ES7147-5JD00-0BA0
V1.1
ET 200pro 4 IO-LINK HF As of 6ES7147-4JD0-0AB0
V1.0
ET 200ecoPN IO-Link Master As of 6ES7148-6JD00-0AB0
 Siemens AG 2018 All rights reserved

V1.0

Note Please observe that the “Master Backup” function is only available for IO-Link
devices which are specified for the IO-Link standard as of V1.1.
IO-Link communication modules of third-party suppliers are not supported by this
library!

IO-Link
Entry ID: 82981502, V5.1, 01/2018 7
2 Library Blocks
2.2 Explanation of IO_LINK_MASTER block

2.2.2 Interface and parameter

Interface

Figure 2-1 STEP 7 V14 Figure 2-2 STEP 7 V5.5

Input parameters
 Siemens AG 2018 All rights reserved

Table 2-3
Parameter Data type Memory area Description
REQ BOOL I, Q, M, D Positive edge: Triggers data transfer
ID HW_IO I, Q, M, D, L, const For S7-1200/1500
Hardware identifier of the IO-Link communication
module
(for ET200ecoPN the
HW_ID of the IO-Link submodule is to be used)
DWORD For S7-300/400
Logic address of the IO-Link communication
module (module or submodule)
Note: If you are using the IO-Link master
ET200ecoPN IO-Link (6ES7148-6JD00-0AB0),
the diagnostics address of the master has to be
specified here (see chapter 4.3).
RD_WR BOOL I, Q, M, D, L, const Read or write access
0: read
1: write

IO-Link
Entry ID: 82981502, V5.1, 01/2018 8
2 Library Blocks
2.2 Explanation of IO_LINK_MASTER block

Output parameters
Table 2-4
Parameter Data type Memory area Description
DONE_VALID BOOL I, Q, M, D, L Validity:
0: Data not valid
1: Data valid
BUSY BOOL I, Q, M, D, L Job in progress:
0: Job completed (valid or error)
1: Job in process
ERROR BOOL I, Q, M, D, L Error status:
0: no error
1: Abort with error
STATUS DWORD I, Q, M, D, L Status output:
ERROR flag set = function error
Rest error flag = status of the function
DW#16#000x0000
(x: Process step 0..3)
SF_STATUS DWORD I, Q, M, D, L System error status:
ERROR flag set = Specification to which system
function the status belongs
Error flag reset = DW#16#00000000
 Siemens AG 2018 All rights reserved

LENGTH DINT I, Q, M, D, L Length of the read/written data (net data)

Input/output parameters
Table 2-5
Parameter Data type Memory area Description
RECORD_DATA ARRAY I, Q, M, D, L Source/target area for the data to be
[0..10239] of read/written.
BYTE

IO-Link
Entry ID: 82981502, V5.1, 01/2018 9
2 Library Blocks
2.2 Explanation of IO_LINK_MASTER block

2.2.3 Mode of operation

Start the data transfer with a positive edge at the REQ input.
The “IO_LINK_MASTER” block works asynchronously, i.e. processing takes place
over several PLC cycles. The block generally uses a sequence of acyclic read/write
accesses that are represented by the “RDREC” and “WRREC” S7 system
functions.

As long as no valid response data has arrived, this is signaled via the BUSY =
TRUE parameter.
In this period the STATUS output parameter shows what step (status) the function
is currently in.
The value TRUE of the DONE_VALID output parameter shows that the transfer
was performed successfully and the data is now consistently available on the
RECORD_DATA parameter.

Note The data transfer is in the form of raw date (ARRAY of byte), i.e. the data cannot
be interpreted and must not be changed or manipulated.
Before a data record can be written, it has to be saved first.
 Siemens AG 2018 All rights reserved

If the data has been read successfully, the LENGTH parameter shows the length of
the received or written data. As long as input REQ = TRUE, the output parameters
maintain their value. If input REQ = FALSE before processing of the FB has been
completed, the values of the output parameters are only held for one cycle after
processing the job.

Note If a DPV1 slave is configured via a GSD file (GSD as of rev. 3) and the DP
interface of the DP master is set to “S7 compatible”, the “IO_LINK_MASTER”
block will not function correctly.
Remedy: Reset the interface of the DP master to “DPV1”.

IO-Link
Entry ID: 82981502, V5.1, 01/2018 10
2 Library Blocks
2.2 Explanation of IO_LINK_MASTER block

2.2.4 Status and error displays

Response in the event of an error


If an error occurs when executing the function, this is signaled via the ERROR
output parameter.
On the STATUS output parameter it can be detected at what function call an error
occurred in the event of an error.
In addition, in the event of a system error, the respective S7 system function
(WRREC or RDREC as well as BLKMOV (only S7-300/400)) is passed on to the
SF_STATUS output parameter (status of the system function). The description of
the SF_STATUS in this case can be found in the help of the respective S7 system
function.

STATUS error parameter


The STATUS output parameter contains information on the current status of the
function.

Table 2-6
Status Meaning Explanation
DW#16#0000 0000 No error Function is ready for a new job
DW#16#0000 0230 Type test Function checks module type
 Siemens AG 2018 All rights reserved

Note:
Only IO-Link communication modules (master)
of Siemens AG are permitted.
DW#16#00FF 0000 Reset Functional reset of the backup/restore process.
If output ERROR = 1, you are evaluating the
SF_STATUS parameter (status parameter of
WRREC).
DW#16#0001 0xyz Backup Function reads the master parameters.
If ERROR = 1, you are evaluating the
SF_STATUS parameter (status parameter of
RDREC).
Details for the variants xyz:
00010230 = function reads data record ID 230
00010220 = function reads data record ID 220
00010222 = function reads data record ID 222
000100FF = function BACKUP is running (NEW)
DW#16#0002 0xyz Restore Function writes the master parameters.
If ERROR = 1, you are evaluating the
SF_STATUS parameter (status parameter of
WRREC).
Details for the xyz variants:
00020230 = function writes data record ID 230
00020220 = function writes data record ID 220
00020222 = function writes data record ID 222
000200FF = function RESTORE is running(new)
DW#16#000a 1xyz Backup/Restore Only S7-300/400: Copy error, please evaluate
(a = 1 or 2) SF_STATUS (evaluate status information of the
BLKMOV system function).
DW#16#0003 0000 Type test Unknown module type, please evaluate
SF_STATUS (status parameters of the RDREC).
DW#16#0003 0001 Type test Unknown job, not read nor write.

IO-Link
Entry ID: 82981502, V5.1, 01/2018 11
2 Library Blocks
2.3 Explanation for the IO_LINK_DEVICE block

Status Meaning Explanation


DW#16#0003 00FF Type test Unknown job, not read nor write (new).
DW#16#0003 0002 Type test Data record contains no valid write data (no
BACKUP available).
DW#16#0003 0012 Type test Consistency check resulted in incorrect length,
no IO-Link master module or not from Siemens.
DW#16#0003 0220 Type test Data record for expected port configuration not
available.
DW#16#0003 0222 Type test Data record for IO mapping not available.
DW#16#FFFF FFxy Type test These status values are only relevant for the
ET200ecoPN IO-Link master 6ES7148-6JD00-
0AB0.
Details for the xy variants:
FFFFFF01 = restore ongoing
FFFFFF02 = activation ongoing
FFFFFF03 = activation done
FFFFFF04 = CRC check failed
FFFFFF05 = blob data invalid

SF_STATUS error parameter


 Siemens AG 2018 All rights reserved

The SF_STATUS output parameter contains additional error information of the


system functions used
 RDREC
 WRREC
 BLKMOV (only S7-300/400)

Please observe the notes on the STATUS parameter and read the respective error
information in the help of the respective system function.

2.3 Explanation for the IO_LINK_DEVICE block


In order to communicate with the IO-Link peripheral devices (sensors, SIRIUS
switching devices etc.) connected to the IO-Link communication module, we
provide you with the IO_LINK_DEVICE function block.

2.3.1 Description

The reading and writing of acyclic data enables you to write the device parameters
to an IO-Link device or read parameters, measured values and diagnostics data of
an IO-Link device.
The function block supports you with the following tasks:
 (Re)configuration of an IO-Link device
 Diagnostics of an IO-Link device
 Executing of IO-Link port functions
 Saving/recovering of IO-Link device parameters

IO-Link
Entry ID: 82981502, V5.1, 01/2018 12
2 Library Blocks
2.3 Explanation for the IO_LINK_DEVICE block

The data on an IO-Link device can be uniquely addressed with index and
subindex. In addition, port functions can also be executed with the
“IO_LINK_DEVICE” function block (e. g. switching the port to the DI mode).

Note The structure of the data objects and the port functions can be found in the
respective documentation of the IO-Link device and the IO-Link master.

The “IO_LINK_DEVICE” function block is based on a standardized protocol


(PROFIBUS DP/PROFINET IO) which ensures access to data of an IO-Link device
behind IO-Link masters. Generally, a sequence of acyclic read/write accesses is
used which is represented by the SIMATIC system functions “RDREC” and
“WRREC”.
The “IO_LINK_DEVICE” block works asynchronously, i.e. processing always takes
place over several PLC cycles.

Note If a DPV1 slave is configured via a GSD file (GSD as of rev. 3) and the DP
interface of the DP master is set to “S7 compatible”, the block will not function
correctly.
Remedy: Reset the interface of the DP master to “DPV1”.
 Siemens AG 2018 All rights reserved

2.3.2 Interface and parameter

Interface
Figure 2-3 STEP 7 V13 SP1 Figure 2-4 STEP 7 V5.5

IO-Link
Entry ID: 82981502, V5.1, 01/2018 13
2 Library Blocks
2.3 Explanation for the IO_LINK_DEVICE block

Input parameters
Table 2-7
Parameter Data type Memory area Description
REQ BOOL I, Q, M, D Positive edge: Triggers data transfer
ID HW_IO I, Q, M, D, L, const For S7-1200/1500
Hardware identifier of the IO-Link communication
module
(for ET200ecoPN the
HW_ID of the IO-Link submodule is to be used)
DWORD For S7-300/400
Logic address of the IO-Link communication
module (module or submodule)
CAP DINT I, Q, M, D, L, const Access point of the IO_LINK_DEVICE function
(S7- (Siemens AG = 227 decimal)
1200/1500)
INT
(S7-300/400)
RD_WR BOOL I, Q, M, D, L, const Read or write access
0: read
1: write
PORT INT I, Q, M, D, L, const Port number at which the IO-Link device is
 Siemens AG 2018 All rights reserved

operated.
Possible values: 0..63
IOL_INDEX INT I, Q, M, D, L, const Parameter index
Possible values: 0..32767

IOL_SUBINDEX INT I, Q, M, D, L, const Parameter subindex


0: total record
1..255: Parameter from record
LEN INT I, Q, M, D, L, const Length of the data to be written (net data)
Read: 0..232 (not relevant)
Write: 1..232

IO-Link
Entry ID: 82981502, V5.1, 01/2018 14
2 Library Blocks
2.3 Explanation for the IO_LINK_DEVICE block

Output parameters
Table 2-8
Parameter Data type Memory area Description
DONE_VALID BOOL I, Q, M, D, L Validity:
0: Data not valid
1: Data valid
BUSY BOOL I, Q, M, D, L Job in progress:
0: Job completed (valid or error)
1: Job in process
ERROR BOOL I, Q, M, D, L Error status:
0: no error
1: Abort with error
STATUS DWORD I, Q, M, D, L Status output:
ERROR flag set = function error
Rest error flag = status of the function
DW#16#000x0000
(x: Process step 0..3)
IOL_STATUS DWORD I, Q, M, D, L IO-Link error status:
ERROR flag set and IO-Link error:
See error information
ERROR flag set and communication error:
 Siemens AG 2018 All rights reserved

Specification to which SFB the status belongs


Error flag reset: DW#16#00000000
RD_LEN INT I, Q, M, D, L Length of the read data (net data)

Input/output parameters
Table 2-9
Parameter Data type Memory area Description
RECORD_IOL_ ARRAY I, Q, M, D, L Source/target area for the data to be read/written
DATA [0..231] of
BYTE

IO-Link
Entry ID: 82981502, V5.1, 01/2018 15
2 Library Blocks
2.3 Explanation for the IO_LINK_DEVICE block

2.3.3 Mode of operation

Address assignment
With “IO_LINK_DEVICE”, you read or write (parameter: RD_WR) the data of the
IO-Link peripheral devices which are connected to a port (parameter: PORT) of an
IO-Link communication module (parameter: ID).
The data is uniquely addressed with index/subindex (parameter:
INDEX/SUBINDEX). If data is read, the RD_LEN parameter specifies the length of
the received data in bytes which is located in the target area (parameter:
RECORD_IOL_DATA). In that case the target area also has to be at least RD_LEN
bytes.
When writing data, a (parameter: LEN) specified data volume is transferred to the
IO-Link device.
The source area (parameter: RECORD_IOL_DATA) has to be at least LEN bytes
long. The access point to the IO-Link master is defined via the client access point
(parameter CAP).
As long as no other instructions are made in the manual of the IO-Link master, the
value 227 (valid for all IO-Link communication modules by Siemens AG) can be
used here.

Chronological sequence of a transmission


Start the transmission by means of calling the function with REQ = TRUE.
 Siemens AG 2018 All rights reserved

As long as no valid response data has arrived, this is signaled via the BUSY =
TRUE parameter.
In this period the IOL_STATUS output parameter shows in what step (status) the
function is currently in. If this period exceeds the runtime of the IO-Link
communication module or if it takes more than 20s, processing is aborted with a
timeout error (IOL_STATUS).
The value TRUE of the DONE_VALID output parameter shows that the transfer
was performed successfully and the data is now consistently available on the
RECORD_DATA parameter.

Note The data transfer is in the form of raw date (ARRAY of byte), i.e. the data cannot
be interpreted in this form.
It is up to the user, whether to format the data according to the specifications of
the device manufacturer (copy to a data structure or data type).

If data was read, the length of the received data is displayed on the RD_LEN
parameter. As long as REQ = TRUE, the output parameters maintain their value. If
REQ = FALSE, before the processing of the function was completed, the values of
the output parameters are only held for one PLC cycle after processing the job.

IO-Link
Entry ID: 82981502, V5.1, 01/2018 16
2 Library Blocks
2.3 Explanation for the IO_LINK_DEVICE block

2.3.4 Status and error displays

Response in the event of an error


If an error occurs when executing the function, this is signaled via the ERROR
output parameter.
If there is a communication error, the status of RDREC or WRREC is passed on to
the STATUS output parameter.
In addition, it can be detected on the IOL_STATUS output parameter, at which S7
system function the error occurred. The description of the status in this case can be
found in the online help of the respective S7 system function (RDREC or WRREC).
If there is a specific IO-Link error, this is displayed on the IOL_STATUS output
parameter (in this case, the status parameter has the value DW#16#00000000).

STATUS error parameter


The STATUS output parameters contains error information of the system functions
used
- RDREC (SFB52)
- WRREC (SFB53)
Please observe the notes on the STATUS parameter and read the respective error
information in the help of the respective system function.
 Siemens AG 2018 All rights reserved

IOL_STATUS error parameter


In the event of a correct completion of the “IO_LINK_DEVICE” block, the
IOL_STATUS tag is set to DW#16#00000000.
In the case of aborting the block, error signaling is performed on the respective
IOL_STATUS output tag.
The IO-Link error codes (device error code) are directly passed on to the
IOL_STATUS output tag of the DWORD data type. The coding can be found in the
respective IO-Link device documentation.
Error codes by the IO-Link master (IOL-M Error_Code) are also mapped in the
IOL_STATUS tag.

Table 2-10
IOL_STATUS = DW#16#00000000
IOL-M Error Code Device Error Code (device specific)
W#16#0000 W#16#0000
B#16#00 B#16#00 B#16#00 B#16#00

IO-Link
Entry ID: 82981502, V5.1, 01/2018 17
2 Library Blocks
2.3 Explanation for the IO_LINK_DEVICE block

Example for IOL_STATUS


DW#16#80520000 = error message of communication module (IO-Link master)
DW#16#00008011 = error alarm from the device (sensor, etc.)

Table 2-11 Coding of IOL-M Error_Code within IOL_STATUS


IO-Link Master Meaning Explanation
Error_Code
16#0000 No error No error pending
16#0001 No call Function ready for new job
16#0002 IO_LINK_CALL write Function in send state (SEND_REQUEST)
16#0003 IO_LINK_CALL read Function in polling state
(WAIT_ON_RESPONSE)
16#0004 .. 06FF - Reserved
16#7000 IO_LINK_CALL conflict Send and response data inconsistent
16#7001 Wrong IO_LINK_CALL Decoding error
16#7002 Port blocked Port occupied by another job or not existing
16#7003 .. 7FFF - Reserved
16#8000 Timeout Timeout. Job could not be performed within the
timeout period
 Siemens AG 2018 All rights reserved

16#8001 Wrong port address Port address smaller than 0 or larger than 63
16#8002 Wrong index Index smaller than 0 or larger than 32767
16#8003 Wrong subindex Subindex smaller than 0 or larger 255
16#8004 No Device No device connected (however port still in IO-
Link mode)
16#8005 Wrong LEN Invalid length when writing, less than 1 or over
232
16#8006 Wrong LEN Invalid length when reading, less than 0 or over
232
16#8007 DI/DO mode Port in DI or DO mode
16#8008 No SPDU Device in IO-Link mode does not support SPDU
16#8009 - An upload is not possible, since the function is
disabled (data storage).
16#8010 .. 8051 - Reserved
16#8052 RDREC Fault Error occurred when calling RDREC, see
STATUS
16#8053 WRREC Fault Error occurred when calling WRREC, see
STATUS
16#8054 Unexpected Internal error in IO-Link technology (unexpected
acknowledge status during an IO-Link request)
16#8055 Port function failed Only relevant for port functions
16#8056 .. FFFF - Reserved

IO-Link
Entry ID: 82981502, V5.1, 01/2018 18
3 Working with the Library in STEP 7 V5.5
3.1 Integrating the library

3 Working with the Library in STEP 7 V5.5


What will you learn here?
This chapter consists of instructions for integrating the IO-Link library
IO_LINK_Library_V55 into your STEP 7 V5.5 project and instructions for using the
library blocks.

3.1 Integrating the library


In order to be able to use the previously described library functions, they must first
be integrated into the configuration software. The required steps can be found in
the following tables.

Note In the following section, it is assumed that a STEP 7 project has been created.

The library is available on the HTML page from which you downloaded this
document. The "82981502_IO_LINK_Library_V5.1.zip” file includes the
STEP 7 V5.5 as well as the STEP 7 V14 SP1 libraries.

1. First of all, extract the "82981502_IO_LINK_Library_V5.1.zip” file on your hard


 Siemens AG 2018 All rights reserved

disk.

2. Open the SIMATIC Manager and retrieve the "IO_LINK_Library_V55” STEP 7


library with "File > Retrieve…”.

3. The library is now available in "Libraries” when opening the library.

Figure 3-1

IO-Link
Entry ID: 82981502, V5.1, 01/2018 19
3 Working with the Library in STEP 7 V5.5
3.2 Using library blocks

3.2 Using library blocks


In order to use the library blocks in your user program, proceed as follows:

4. Open an already existing STEP 7 V5.5 project.

5. Open the "IO_LINK_Library_V55” library.

Figure 3-2

6. Copy the required blocks into your project.


 Siemens AG 2018 All rights reserved

7. Check the consistency of your user program by right-clicking the block folder
and selecting "Check Block Consistency”.

Figure 3-3

If no enumerations appear when clicking "Dependency tree: Only conflicts” , the


block calls are consistent and you have added all required blocks.

Figure 3-4

IO-Link
Entry ID: 82981502, V5.1, 01/2018 20
3 Working with the Library in STEP 7 V5.5
3.2 Using library blocks

8. Create organization block 1 (OB1) and open it. Drag the function block
IO_LINK_MASTER or IO_LINK_DEVICE via drag & drop into any network.

Figure 3-5

9. Enter the data block with the number of the instance data block that you would
like to use. Generate the instance data block if it does not exist.

Figure 3-6
 Siemens AG 2018 All rights reserved

10. Assign values of your choice to all formal parameters. The values can be, for
example, stored in any data block.
Save organization block 1 (OB1) and load the STEP 7 project.

IO-Link
Entry ID: 82981502, V5.1, 01/2018 21
4 Working with the Library in STEP 7 V14
4.1 Integrating the library

4 Working with the Library in STEP 7 V14


What will you learn here?
This chapter includes instructions on how to integrate the IO-Link libraries
into your STEP 7 V14 project and instructions on how to use the library blocks.

4.1 Integrating the library


In order to be able to use the previously described library functions, they must first
be integrated into the configuration software. The required steps can be found in
the following tables.

Note In the following section it is assumed that a STEP 7 project has been created.

The library is available on the HTML page from which you downloaded this
document.
1. First of all, unzip the "82981502_IO_LINK_Library_V5.1.zip" file on your hard
disk. The library for TIA Portal V14 has the file name
"IO_LINK_Library_V14.zal14".
 Siemens AG 2018 All rights reserved

2. Now, open the project view and go to the “Libraries” tab.


Right-click “Retrieve library” in “Global libraries". Now, select the
“IO_LINK_Library_V14.zal14” library file and follow further instructions of
STEP 7 V14.

Figure 4-1

Note Since the library does not only include the blocks for S7-1200 (STEP 7 Basic
V14 license is sufficient) but also assumes STEP 7 Professional V14 for S7-
1500/300/400, you will get the information that you are working with a STEP 7
Basic V14 license when you import the library.

IO-Link
Entry ID: 82981502, V5.1, 01/2018 22
4 Working with the Library in STEP 7 V14
4.1 Integrating the library

Confirm this dialog box with “OK”.


 Siemens AG 2018 All rights reserved

3. The library is then available in “Global libraries”.

Figure 4-2

IO-Link
Entry ID: 82981502, V5.1, 01/2018 23
4 Working with the Library in STEP 7 V14
4.2 Using library blocks

4.2 Using library blocks


In order to use the library blocks in your user program, proceed as follows:
1. Open an already existing STEP 7 V14 project.

2. Open the “IO_LINK_Library_V14” library.

Figure 4-3
 Siemens AG 2018 All rights reserved

3. Copy the blocks you need into your project.

Example: You want to use the IO_LINK_MASTER block for the S7-1500.
Drag the required “IO_LINK_MASTER” block using drag-and-drop to your user
program from the “Types” folder and the subfolder for the "S7-1500
Professional".

4. Compile the block (shortcut: Ctrl+B).

5. Open the “Main” OB. Now drag the desired function block using drag-and-drop
into any network.

Figure 4-4

IO-Link
Entry ID: 82981502, V5.1, 01/2018 24
4 Working with the Library in STEP 7 V14
4.3 Configuring the ET200ecoPN IO-Link master (6ES7148-6JD00-0AB0)

6. Enter the data block with the number of the instance data block you want to
use.

Figure 4-5

7. Assign values of your choice to all formal parameters. The values can be, for
example, stored in any data block.
Save the OB1 organization block and load the STEP 7 project into your S7-
CPU.
 Siemens AG 2018 All rights reserved

4.3 Configuring the ET200ecoPN IO-Link master (6ES7148-


6JD00-0AB0)

If you want to use the ET200ecoPN IO-Link master with article no. 6ES7148-
6JD00-0AB0 together with an S7-300, you have to configure the parameter ID of
the IO_LINK _MASTER block with the diagnostics address of the IO-Link master.
To do this, go to the “Device view” and select the ET200ecoPN IO-Link master.
Refer to the “Device overview” or to the “Properties” to find the corresponding
diagnostics address (in this example: 8182).
Figure 4-6

IO-Link
Entry ID: 82981502, V5.1, 01/2018 25
5 Appendix

5 Appendix
5.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:
 Siemens AG 2018 All rights reserved

https://support.industry.siemens.com/My/ww/en/requests

SITRAIN – Training for Industry


With our globally available training courses for our products and solutions, we
support you with innovative learning methods.
More information on the training and courses as well as their location and dates
can be found at:
www.siemens.en/sitrain

Service offer
Our service offer comprises the following services:
 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

IO-Link
Entry ID: 82981502, V5.1, 01/2018 26
5 Appendix

5.2 Links and literature


Table 5-1
No. Topic
\1\ Siemens Industry Online Support
https://support.industry.siemens.com
\2\ Link to this entry
https://support.industry.siemens.com/cs/ww/en/view/82981502

5.3 Change documentation


Table 5-2
Version Date Modification
V1.0 04.11.2013 First version
V2.0 30.03.2015 Complete revision and update of STEP 7 V13 SP1
Copy protection removed
21.08.2015 Limits for port number for IO_LINK_DEVICE changed
V3.0 27.10.2016 Expansion by the “Master Backup” function in the
 Siemens AG 2018 All rights reserved

IO_LINK_MASTER block for the ET200ecoPN IO-Link


master (6ES7148-6JD00-0AB0).
V3.1 16.03.2017 Extension of the library by the STEP 7 V14 Basic variant
V5.0 16.11.2017 Integrating the new master function for new IO-Link master
for STEP 7 V14 SP1.
V5.1 10.01.2018 Adding library for STEP 7 V5.5 SP4 Hotfix 11

IO-Link
Entry ID: 82981502, V5.1, 01/2018 27

You might also like