IOL_CALL (FB)

FUNCTION_BLOCK IOL_CALL

This Function Block enables access to access IO-Link data or initiate port functions using PN-IO mechanisms.

Client applications could use it to parameterize a Device with (IO-Link-) AL_Write or read out data like the SerialNumber with the help of an (IO-Link-) AL_Read.

In order to address the required IO-Link data, IOL_CALL uses PROFINET access points ("record index") and the Master port number in addition to the IO-Link Indices and Subindices as well as the transfer direction.

For details see:

PI Specification, IO-Link Integration, Part 1, Version 1.0, December 2007, Order No. 2.812

PI Specification, IO-Link Integration - Edition 2, Version 1.0, June 2017, Order No. 2.812

Example

PROGRAM PLC_PRG
VAR
    al_read : ProfinetCommon.IOL_CALL;
    err : ProfinetCommon.IOL_Error;
    productText : STRING(64);
END_VAR

//start the execution by setting REQ = TRUE !
al_read.ID := al1100.GetID(0, 1, 2);        // ID of IO-Link Master
al_read.CAP := 16#B400;                     // Fix for Ed. 2 devices. For legacy devices get value from vendor's documentation or use CommFB.RDREC for reading out IOL-M directory data (RDREC.Index = 0xB063)
al_read.Port := 1;                          // IO-Link device is plugged in Port 1
al_read.RD_WR := FALSE;                     // Read data
al_read.IOL_Index := 20;                    // IOL-Index = 20 means 'Product Text', this will result in something like 'Laser Sensor'
al_read.IOL_Subindex := 0;                  // 0 = read complete data-item
al_read.LEN := TO_INT(SIZEOF(productText) - 1);
al_read.IOL_Data := ADR(productText);       // an ARRAY[] OF BYTE will be returned

al_read();
IF(al_read.ERROR) THEN
    IF(al_read.STATUS <> 0) THEN
        // Profinet Communication-Error
        // e.g. DF80A100 (= PNIORW, application: write error) will be returned if a wrong 'ID' / submodule identifier is used as target
    ELSE
        // get IO-Link related error:
        err := ProfinetCommon.DECODE_IOL_STATUS(al_read.IOL_STATUS);
    END_IF
ELSIF(al_read.DONE_VALID) THEN
    ;// --> the variable 'productText' will contain some text
END_IF
al_read.REQ := al_read.BUSY;        //reset REQ, we need just one execution
InOut:

Scope

Name

Type

Comment

Input

REQ

BOOL

Request function

ID

DWORD

Addresses the IOLD proxy (Submodule) and thus the Device

CAP

INT

fix 0xB400 for Ed. 2 devices, vendor specific for legacy devices

PORT

INT

Port address the function shall be performed at. Supported range: 0 to 255

RD_WR

BOOL

Indicates whether the On-request Data (OD) shall be read (RD = FALSE) or written (WR = TRUE)

IOL_INDEX

INT

Index of the On-request Data or Port Function Indicator respectively

IOL_SUBINDEX

INT

Subindex of the On-request Data or Port Function Command Code

LEN

INT

Actual data length of an IOL data record (read or write) specified in input IOL_DATA

IOL_DATA

POINTER TO BYTE

On-request Data to be written to, or to be read from the Device

Output

DONE_VALID

BOOL

Flag indicating the successful completion of the function (and in case of a read function the validity of received data);

BUSY

BOOL

Flag indicating the function is still performing its task. The function block is not ready to perform a new task.

ERROR

BOOL

Flag indicating the abortion of the function with an error

STATUS

DWORD

Completion or bus error code. Busy =0xFFFFFFFF

IOL_STATUS

DWORD

Completion or IOL-M and IOL-D error code. See function TO_IOL_Error

RD_LEN

INT

Actual Length of data that has been read.