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