library description 04/2015 acyclic reading and writing ... · library description 04/2015 acyclic...

23
https://support.industry.siemens.com/cs/ww/en/view/82981502 Library Description 04/2015 Acyclic Reading and Writing with the "IO-Link Library" SIMATIC S7-300/400/1200/1500

Upload: dinhthuy

Post on 05-Jun-2018

272 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

https://support.industry.siemens.com/cs/ww/en/view/82981502

Library Description 04/2015

Acyclic Reading and Writing with the "IO-Link Library" SIMATIC S7-300/400/1200/1500

Page 2: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

Warranty and Liability

IO-Link Entry ID: 82981502, V2.0, 04/2015 2

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

Warranty and Liability

Note The Application Examples are not binding and do not claim to be complete with regard to configuration, equipment or any contingencies. The Application Examples do not represent customer-specific solutions. They are only intended to provide support for typical applications. You are responsible for the correct operation of the described products. These Application Examples do not relieve you of the responsibility of safely and professionally using, installing, operating and servicing equipment. When using these Application Examples, you recognize that we cannot be made liable for any damage/claims beyond the liability clause described. We reserve the right to make changes to these Application Examples at any time and without prior notice. If there are any deviations between the recommendations provided in this Application Example and other Siemens publications – e.g. Catalogs – the contents of the other documents shall have priority.

We do not accept any liability for the information contained in this document.

Any claims against us – based on whatever legal reason – resulting from the use of the examples, information, programs, engineering and performance data etc., described in this Application Example shall be excluded. Such an exclusion shall not apply in the case of mandatory liability, e.g. under the German Product Liability Act (“Produkthaftungsgesetz”), in case of intent, gross negligence, or injury of life, body or health, guarantee for the quality of a product, fraudulent concealment of a deficiency or breach of fundamental contractual obligations (“wesentliche Vertragspflichten”). The compensation for damages due to a breach of a fundamental contractual obligation is, however, limited to the foreseeable damage, typical for the type of contract, except in the event of intent or gross negligence or injury to life, body or health. The above provisions do not imply a change of the burden of proof to your detriment.

Any form of duplication or distribution of these Application Examples or excerpts hereof is prohibited without the expressed consent of Siemens AG.

Security informa-

tion

Siemens provides products and solutions with industrial security functions that support the secure operation of plants, solutions, machines, equipment and/or networks. They are important components in a holistic industrial security concept. With this in mind, Siemens’ products and solutions undergo continuous development. Siemens recommends strongly that you regularly check for product updates.

For the secure operation of Siemens products and solutions, it is necessary to take suitable preventive action (e.g. cell protection concept) and integrate each component into a holistic, state-of-the-art industrial security concept. Third-party products that may be in use should also be considered. For more information about industrial security, visit http://www.siemens.com/industrialsecurity.

To stay informed about product updates as they occur, sign up for a product-specific newsletter. For more information, visit http://support.industry.siemens.com.

Page 3: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

Table of Contents

IO-Link Entry ID: 82981502, V2.0, 04/2015 3

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

Table of Contents Warranty and Liability ................................................................................................. 2

1 Library Overview ................................................................................................ 4

1.1 User Scenarios ..................................................................................... 5

2 Blocks of the Library ......................................................................................... 6

2.1 Block list ............................................................................................... 6 2.2 Explanation of block IO_LINK_MASTER ............................................. 7 2.2.1 Description ........................................................................................... 7 2.2.2 Interface and parameter ....................................................................... 7 2.2.3 Mode of operation ................................................................................ 9 2.2.4 Status and error displays...................................................................... 9 2.3 Explanation for block IO_LINK_DEVICE ............................................ 11 2.3.1 Description ......................................................................................... 11 2.3.2 Interface and parameter ..................................................................... 12 2.3.3 Mode of operation .............................................................................. 14 2.3.4 Status and error displays.................................................................... 15

3 Working with the Library in STEP 7 V5.5 ...................................................... 17

3.1 Integrating the library .......................................................................... 17 3.2 Using library blocks ............................................................................ 18

4 Working with the Library in STEP 7 V13 ....................................................... 20

4.1 Integrating the library .......................................................................... 20 4.2 Using library blocks ............................................................................ 21

5 References ....................................................................................................... 23

6 History............................................................................................................... 23

Page 4: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

1 Library Overview

1.1 User scenarios

IO-Link Entry ID: 82981502, V2.0, 04/2015 4

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

1 Library Overview

What will I get?

The present document describes the block libraries

IO_LINK_Library_V13_SP1 and

IO_LINK_Library_V55.

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 realized through these blocks.

Validity of the library

This description is valid for the use of the IO Link block library “IO_LINK_Library_V13_SP1” and “IO_LINK_Library_V55” with the following SIMATIC controllers and the respective configuration software:

Table 1-1

Library Engineering software

S7-300 S7-400 S7-1200 S7-1500

IO_LINK_Library_V55 STEP 7 V5.5 X X

IO_LINK_Library_V13_SP1 STEP 7 V13 SP1

X X X X

Page 5: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

1 Library Overview

1.1 User scenarios

IO-Link Entry ID: 82981502, V2.0, 04/2015 5

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

1.1 User scenarios

Possible application of the IO-Link libraries

The product portfolio for IO-Link is continuously expanded; this is why the existing block library (IO_LINK_CALL) has been completely adjusted to these new requirements for SIMATIC S7.

Currently there are several IO-Link communication modules in very different designs 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.

Table 1-2

IO-Link block Functionality

IO-Link master 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) with the help of the “IO_LINK_MASTER” function block via the S7 program.

IO-Link device With the help of this “IO_LINK_DEVICE” function block you can write device parameters to an IO-Link device acyclically via the S7 program or read parameters, measured values and diagnostics data of an IO-Link device.

Note:

This block replaces the main function of the previously available “IO_LINK_CALL” block.

Page 6: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

2 Blocks of the Library

2.1 Block list

IO-Link Entry ID: 82981502, V2.0, 04/2015 6

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

2 Blocks of the Library

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 can find all the blocks that belong to the IO-Link library.

Table 2-1

Blocks STEP 7 V13 SP1

Blocks STEP 7 5.5

Symbol

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)

Page 7: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

2 Blocks of the Library

2.2 Explanation of block IO_LINK_MASTER

IO-Link Entry ID: 82981502, V2.0, 04/2015 7

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

2.2 Explanation of block IO_LINK_MASTER

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

2.2.1 Description

You can backup or restore the device parameters and settings of an IO-Link communication module (e.g. ET 200SP CM 4xIO-Link) with the help of this block via the S7 program.

This block works with the following IO-Link communication modules:

Table 2-2

IO-Link communication module Article number

ET 200S 4SI IO-Link 6ES7138-4GA50-0AB0

ET 200S 4SI SIRIUS 3RK1005-0LB00-0AA0

ET 200SP CM 4xIO-Link 6ES7137-6BD00-0BA0

ET 200AL CM 4xIO-Link 6ES7147-5JD00-0BA0

ET 200ecoPN IO-Link Master 6ES7148-6JA00-0AB0

S7-1200 SM 1278 IO-Link 6ES7278-4BD32-0XB0

Note IO-Link communication modules of third-party suppliers are not supported by this library!

2.2.2 Interface and parameter

Interface

Figure 2-1 STEP 7 V13 SP1

Figure 2-2 STEP 7 V5.5

Page 8: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

2 Blocks of the Library

2.2 Explanation of block IO_LINK_MASTER

IO-Link Entry ID: 82981502, V2.0, 04/2015 8

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

Input parameters

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)

RD_WR BOOL I, Q, M, D, L, const Read or write access

0: read

1: write

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 being processed

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

Error flag reset = 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

RD_LEN INT I, Q, M, D, L Length of the read data (net data)

Input/output parameters

Table 2-5

Parameter Data type Memory area Description

RECORD_DATA ARRAY [0..231] of BYTE

I, Q, M, D, L Source/target area for the data to be read/written.

Page 9: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

2 Blocks of the Library

2.2 Explanation of block IO_LINK_MASTER

IO-Link Entry ID: 82981502, V2.0, 04/2015 9

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

2.2.3 Mode of operation

Start the date transfer with a positive edge on 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.

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

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 output parameter SF_STATUS (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.

Page 10: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

2 Blocks of the Library

2.2 Explanation of block IO_LINK_MASTER

IO-Link Entry ID: 82981502, V2.0, 04/2015 10

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

STATUS error parameter

The STATUS output parameter contains information of 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 Note:

only IO-Link communication modules (master) of Siemens AG are permitted.

DW#16#0001 0xyz Data backup Function reads the mater parameters. If ERROR = 1, the SF_STATUS is evaluated (status parameters of the RDREC).

DW#16#0002 0xyz Data recovery Function writes the master parameters. If ERROR = 1, the SF_STATUS is evaluated (status parameters of the WRREC).

DW#16#000a 1xyz

(a = 1 or 2)

Backup/Restore Only S7-300/400: Copy error, please evaluate

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, no read nor write.

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.

SF_STATUS error parameter

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.

Page 11: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

2 Blocks of the Library

2.3 Explanation for block IO_LINK_DEVICE

IO-Link Entry ID: 82981502, V2.0, 04/2015 11

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

2.3 Explanation for block IO_LINK_DEVICE

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 parameter 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

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 of 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 “RDREC” and “WRREC” SIMATIC system functions.

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 interface of the DP master to “DPV1”.

Page 12: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

2 Blocks of the Library

2.3 Explanation for block IO_LINK_DEVICE

IO-Link Entry ID: 82981502, V2.0, 04/2015 12

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

2.3.2 Interface and parameter

Interface

Figure 2-3 STEP 7 V13 SP1

Figure 2-4 STEP 7 V5.5

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 (S7-1200/ 1500)

I, Q, M, D, L, const Access point of the IO_LINK_DEVICE function (Siemens AG = 227 decimal)

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 operated.

Possible values: 0..63

IOL_INDEX INT I, Q, M, D, L, const Parameter index

Possible values: 0..32767

Page 13: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

2 Blocks of the Library

2.3 Explanation for block IO_LINK_DEVICE

IO-Link Entry ID: 82981502, V2.0, 04/2015 13

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

Parameter Data type Memory area Description

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

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 being processed

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

Error flag reset = 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:

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_DATA

ARRAY [0..231] of BYTE

I, Q, M, D, L Source/target area for the data to be read/written.

Page 14: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

2 Blocks of the Library

2.3 Explanation for block IO_LINK_DEVICE

IO-Link Entry ID: 82981502, V2.0, 04/2015 14

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

2.3.3 Mode of operation

Address assignment

With the “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.

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.

Page 15: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

2 Blocks of the Library

2.3 Explanation for block IO_LINK_DEVICE

IO-Link Entry ID: 82981502, V2.0, 04/2015 15

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

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.

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, an 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 data type DWORD. The coding can be found in the respective IO-Link device documentation.

Error codes by 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

Example for IOL_STATUS

DW#16#80520000 = error message of communication module (IO-Link master)

DW#16#00008011 = error message of device (sensor, etc.)

Page 16: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

2 Blocks of the Library

2.3 Explanation for block IO_LINK_DEVICE

IO-Link Entry ID: 82981502, V2.0, 04/2015 16

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

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

IO-Link Master Error_Code

Meaning Explanation

16#0000 No error No error has occurred

16#0001 No call Function ready for new job

16#0002 IO_LINK_CALL write Function is in send state (SEND_REQUEST)

16#0003 IO_LINK_CALL read Function is in poll 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 present

16#7003 .. 7FFF - Reserved

16#8000 Timeout Timeout. Job could not be performed within the timeout time

16#8001 Wrong port address Port address smaller than 0 or larger 63

16#8002 Wrong index Index smaller than 0 or larger 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, smaller than 1 or larger 232

16#8006 Wrong LEN Invalid length when reading, smaller than 0 or larger 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 acknowledge

Internal error in IO-Link technology (unexpected status during an IO-Link request)

16#8055 Port function failed Only relevant for port functions

16#8056 .. FFFF - Reserved

Page 17: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

3 Working with the Library in STEP 7 V5.5

3.1 Integrating the library

IO-Link Entry ID: 82981502, V2.0, 04/2015 17

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

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_V2.zip” file includes the STEP 7 V5.5 as well as the STEP 7 V13 SP1 library.

1. First of all extract the “82981502_IO_LINK_Library_V2.zip” file on your hard 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

Page 18: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

3 Working with the Library in STEP 7 V5.5

3.2 Using library blocks

IO-Link Entry ID: 82981502, V2.0, 04/2015 18

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

3.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 V5.5 project.

2. Open the “IO_LINK_Library_V55” library.

Figure 3-2

3. Copy the required blocks to your project.

4. Check the consistency of your user program via right mouse click on the block folder and select “Check Block Consistency”.

Figure 3-3

When no enumerations appear when clicking “Dependency tree: Only conflicts” , the block calls are consistent and you have added all required blocks.

Figure 3-4

Page 19: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

3 Working with the Library in STEP 7 V5.5

3.2 Using library blocks

IO-Link Entry ID: 82981502, V2.0, 04/2015 19

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

5. Create the 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

6. 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

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

Page 20: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

4 Working with the Library in STEP 7 V13

4.1 Integrating the library

IO-Link Entry ID: 82981502, V2.0, 04/2015 20

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

4 Working with the Library in STEP 7 V13

What will you learn here?

This chapter includes instructions on how to integrate the IO-Link libraries into you STEP 7 V13 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. The “82981502_IO_LINK_Library_V2.zip” file includes the STEP 7 V5.5 as well as the STEP 7 V13 SP1 library.

1. First of all extract the “82981502_IO_LINK_Library_V2.zip” file on your hard disk. The Library for TIA Portal V13 SP1 is called “IO_LINK_Library_V13_SP1.zal13.”

2. Open the TIA Portal V13 SP1 and retrieve the STEP 7 “IO_LINK_Library_V13_SP1” library. Open the project view and go to the “Libraries” tab. Right click “Retrieve library” in “Global libraries". Select the archived library file “IO_LINK_Library_V13_SP1.zal13” and follow the further instructions. Figure 4-1

Page 21: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

4 Working with the Library in STEP 7 V13

4.2 Using library blocks

IO-Link Entry ID: 82981502, V2.0, 04/2015 21

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

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

Figure 4-2

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 V13 project.

2. Open the “IO_LINK_Library_V13_SP1” library.

Figure 4-3

Page 22: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

4 Working with the Library in STEP 7 V13

4.2 Using library blocks

IO-Link Entry ID: 82981502, V2.0, 04/2015 22

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

3. Copy the blocks required by you into your project. Example: You want to use the IO_LINK_MASTER block for the S7-1200. Drag the required “IO_LINK_MASTER” block via drag & drop to your user program from the “Types” folder and the subfolder for the “S7-1200/1500”.

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

5. Open the OB “Main”. Now drag the desired function block via drag & drop into any network.

Figure 4-4

6. Enter the data block with the number of the instance data block that you would like 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.

Page 23: Library Description 04/2015 Acyclic Reading and Writing ... · Library Description 04/2015 Acyclic Reading and Writing ... IO-Link master You can backup or restore the device parameters

5 References

IO-Link Entry ID: 82981502, V2.0, 04/2015 23

S

iem

en

s A

G 2

01

5 A

ll ri

gh

ts r

ese

rve

d

5 References Table 5-1

Topic Title

\1\ Siemens Industry Online Support

http://support.automation.siemens.com

\2\ Download page of the entry

https://support.industry.siemens.com/cs/ww/en/view/82981502

6 History

Table 6-1

Version Date Modifications

V1.0 04.11.2013 First version

V2.0 30.03.2015 Complete revision and update of STEP 7 V13 SP1 Remove copy protection

21.08.2015 Changed limits of parameter PORT at FB IO_LINK_DEVICE.