Siemens Io-Link-Instruction For The First Steps
Siemens Io-Link-Instruction For The First Steps
Revision history
Disclaimer:
This Example / Application Note does not relieve you of the obligation to handle it safely during use, installa-
tion, operation and maintenance. Each user is responsible for the correct operation of his control system.
By using this program example / application note prepared by Weidmüller, you accept that Weidmüller can-
not be held liable for any damage to property and / or personal injury that may occur because of the use.
Note:
The application examples do not represent customer-specific solutions, they are simply intended to help for
typical tasks. The user is responsible for the proper operation of the described products. This application ex-
ample does not relieve you of the obligation of safe use, installation, operation and maintenance.
Application examples are not binding and do not claim to be complete in terms of configuration as well as
any contingencies.
By using this Application Example, you acknowledge that we cannot be held liable for any damages beyond
the described liability regime. We reserve the right to make changes to this sample application at any time
without notice.
In case of discrepancies between the proposals in the application example and other Weidmüller publica-
tions, like manuals, such contents always have more priority to the examples.
Security notes:
In order to protect equipment, systems, machines and networks against cyber threats, it is necessary to im-
plement (and maintain) a complete state-of-the-art industrial security concept. The customer is responsible
for preventing unauthorized access to his equipment, systems, machines and networks. Systems, machines
and components should only be connected to the corporate network or the Internet if necessary and appro-
priate safeguards (such as firewalls and network segmentation) have been taken.
Contact
Weidmüller Interface GmbH & Co. KG
Klingenbergstraße 16
32758 Detmold, Germany
T +49 5231 14-0
F +49 5231 14-292083
[email protected]
www.weidmueller.com
01/02.2017 2
Instruction for the first steps with IO-Link
Content
01/02.2017 3
Instruction for the first steps with IO-Link
IO-Link Device
Ifm KQ5101
01/02.2017 4
Instruction for the first steps with IO-Link
01/02.2017 5
Instruction for the first steps with IO-Link
01/02.2017 6
Instruction for the first steps with IO-Link
It is also possible to connect this sensor to a port class B (wire 2 and 5 are not used).
The IO-Link process data length is specified by the device. 0 to 32 bytes of input and out-
put process data is possible, but not all values and combinations of input and output data
length can be configured in the master. In case of no matching value choose the next
higher value. The necessary total bit length could be found in the IO device description of
the sensor:
KQ5101 Process Data Input Total Bit length = 16
• Choose in the hardware catalogue “Submodules”, “IOL- INPUT” and move the “IO-
Link 2 Byte Input” to the free slot.
01/02.2017 7
Instruction for the first steps with IO-Link
• Now port 1 is preconfigured for IO-Link communication. The address range of the
input process data is from input byte 68 up to 69.
KQ5101
PDV1 BDC1
15 8 7 4 na na na 0
IB68 IB69
01/02.2017 8
Instruction for the first steps with IO-Link
P1_IOL_Switch_State
For the status of the switch state the input bit 69.0 can be used from the process raw data.
P1_IOL_Process_Value
The process value has an offset of 4 bits.
Therefore it should be adjusted for further applications for example by the use of the
shift right (SHR) function:
The IO-Link library is no fixed part of the TIA portal or the SIMATIC Manager. A descrip-
tion how to integrate this library is found in chapter 1.2 of this application note.
01/02.2017 9
Instruction for the first steps with IO-Link
To communicate with IO-Link devices connected to the UR67 IO-Link master module use
the IO_LINK_DEVICE library block. This function supports the following tasks:
Depending on the used CPU type there are two different function blocks available:
S7-300/400
S7-1200/1500
For using the library block in the user program it must be copied to the project:
• Drag the required IO_LINK_DEVICE block via drag and drop to the user program.
• For a cyclic call open the “Main [OB1]” and drag the “IO_LINK_DEVICE” function
block into any network.
01/02.2017 10
Instruction for the first steps with IO-Link
• A request to enter the data block will pop up. Assign the values and confirm them
with the OK button.
01/02.2017 11
Instruction for the first steps with IO-Link
REQ
Data type: BOOL
Memory area: I, Q, M, D
ID
S7-300/400
Data type: DWORD
S7-1200/1500
Data type: HW_IO
Memory area: I, Q, M, D, L, const
01/02.2017 12
Instruction for the first steps with IO-Link
CAP
Data type: INT (S7-300/400)
DINT (S7-1200/1500)
Memory area: I, Q, M, D, L const
RD_WR
Data type: BOOL
Memory area: I, Q, M, D, L, const
PORT
Data type: INT
Memory area: I, Q, M, D, L, const
01/02.2017 13
Instruction for the first steps with IO-Link
IOL_INDEX
Data type: INT
Memory area: I, Q, M, D, L const
IOL_SUBINDEX
Data type: INT
Memory area: I, Q, M, D, L, const
LEN
Data type: INT
Memory area: I, Q, M, D, L, const
DONE_VALID
Data type: BOOL
Memory area: I, Q, M, D, L
BUSY
Data type: BOOL
Memory area: I, Q, M, D, L
ERROR
Data type: BOOL
Memory area: I, Q, M, D, L
STATUS
Data type: DWORD
Memory area: I, Q, M, D, L
Status output:
ERROR flag reset = status of the function
ERROR flag set = function error
01/02.2017 14
Instruction for the first steps with IO-Link
IOL_STATUS
Data type: DWORD
Memory area: I, Q, M, D, L
RD_LEN
Data type: INT
Memory area: I, Q, M, D, L const
RECORD_IOL_DATA
Data type: ARRAY [0...231] of BYTE
Memory area: I, Q, M, D, L
Source and target area for the IO-Link device data to be read or written:
01/02.2017 15
Instruction for the first steps with IO-Link
Direct control of the “IO_LINK_DEVICE” function block with a “Watch and force table”:
01/02.2017 16
Instruction for the first steps with IO-Link
BitOffset Rights
Firmware version 23 Sub 0 Max 16 Byte ro
Smart Sensor Profile 60 32Bit rw
Configuration of switch-
ing point in BCD1
Switching point 1 Sub 1 16 Bit 0 0 to 1645
Switching point 2 Sub 2 16 Bit 0 not used
Smart Sensor Profile 61 32Bit rw
Configuration of switch-
ing point in BCD1
Switching point logic Sub 1 8 Bit 0 (0) normally closed
(1) normally open
Switching point mode Sub 2 8 Bit 1 (1) single point
Switching point hysteresis Sub 3 16 Bit 18 0 to 1645
Step 1: For preparing the read process force the tags to the following values:
Step 2: Trigger the data transfer by modifying the value for the “IOL_REQ” to 1:
01/02.2017 17
Instruction for the first steps with IO-Link
Step 3: It will take some time for the data exchange. The “IOL-BUSY” flag is true during
the function block is operating:
Step 4: If the data exchange was valid the “IOL_DONEVALID” flag is true:
The valid net data with a length of 17 Bytes (see ”IOL_RDLEN”) is found in the data block
“IO_LINK_DEVICE_DATA”:
01/02.2017 18