Access from the user program
KL6224
50
Version: 2.0.0
Example
The list of currently projected slaves (LPS) is to be written. The IO-Link master is to communicate specifically
with the IO-Link slaves with node numbers 1, 2, 3, 4, 12, 16, 17 and 30. In other words, the value
0x4003101E (0100 0000 0000 0011 0001 0000 0001 1110
bin
) is to be written to parameter 0xA8
(1010 1000
bin
).
Write access (PLC->KL6224): parameter data block
Byte
Byte 0
Byte 1
Byte 2
Byte 3
Byte 4
Byte 5
Name
Control byte 0
Control byte 1
ParaOut0
ParaOut1
ParaOut2
ParaOut3
Value
0110 1000
bin
(0x68) 0100 0010
bin
(0x42)
0x1E
0x10
0x03
0x40
Therefore the byte sequence 0x68 42 1E 10 03 40 has to be written in the parameter data block for the
KL6224.
The terminal responds with the following data:
Response to write access (KL6224->PLC): parameter data block
Byte
Byte 0
Byte 1
Byte 2
Byte 3
Byte 4
Byte 5
Name
Status byte 0
Status byte 1
ParaIn0
ParaIn1
ParaIn2
ParaIn3
Value
xxxx xxxx
bin
0101 xxx1
bin
0
0
0
0
The write sequence is completed with this byte sequence: 0x00 00 00 00 00 00
Reading a parameter
The following sequence should be used for reading a parameter:
First check whether the previous access was fully completed. This requires status 1 to be evaluated - bits 4
to 7 should be 0. If this is not the case, control bytes 0 and 1 should be set to 0, until bits 4 to 7 in status 1
are set to 0.
Read access (PLC->KL6224): parameter data block
Byte
Byte 0
Byte 1
Byte 2
Byte 3
Byte 4
Byte 5
Name
Control byte 0
Control byte 1
ParaOut0
ParaOut1
ParaOut2
ParaOut3
Value
00
bin
A
5
A
4
A
3
A
2
A
1
A
0
0100
bin
A
9
A
8
A
7
A
6
x
x
x
x
A
0
to A
9
: bits of the parameter address
x: The parameter values are not evaluated
Response to read access (KL6224->PLC): parameter data block
Byte
Byte 0
Byte 1
Byte 2
Byte 3
Byte 4
Byte 5
Name
Status byte 0
Status byte 1
ParaIn0
ParaIn1
ParaIn2
ParaIn3
Value
xxxx xxxx
bin
01F1 xxx0
bin
P
0
...P
7
P
8
...P
15
P
16
...P
23
P
24
...P
31
x: Bits can take on any value
F: error bit.
F=0
bin
: Read access was successful. Bytes 2 to 5 contain the parameter value.
F=1
bin
: Read access was not successful. Bytes 2 to 5 contain an error code providing information about the
cause of the error.
P
0
to P
31
: bits of the parameter value or error code
The read sequence is completed by setting the control bytes to zero: