Access to AS-i parameters
The parameters of the KL6201/KL6211 AS-i master terminal can be accessed via the parameter data block. Write and read access are documented below, including examples.
Writing a parameter
The following sequence should be used for writing a parameter:
First check whether the previous access was fully completed. To do this, assess status byte 1: Bits 4 to 7 should be 0bin. If this is not the case, control bytes 0 and 1 should be set to 0, until bits 4 to 7 in status byte 1 are set to 0bin.
Write access (PLC->KL6201/KL6211): 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 | 01binA5A4 A3A2A1A0 | 0100bin A9A8A7A6 | P0...P7 | P8...P15 | P16...P23 | P24...P31 |
A0 to A9: bits of the parameter address
P0 to P31: bits of the parameter value
Response to write access (KL6201/KL6211->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 xxxxbin | 01F1 xxx1bin | Error code | Error code | Error code | Error code |
x: Bits can take on any value
F: Error bit.
F=0bin: Write access was successful.
F=1bin: Write access was not successful. Bytes 2 to 5 contain an error code providing information about the cause of the error.
The write sequence is completed by setting the control bytes to zero:
Conclusion of write access (PLC->KL6201/KL6211): 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 | 0000 0000bin | 0000 0000bin | x | x | x | x |
x: The parameter values are not evaluated if the control bytes are 0x00.
Example
The list of currently projected slaves (LPS) is to be written. The AS-i master is to communicate specifically with the AS-i 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 1110bin) is to be written to parameter 0xA8 (1010 1000bin).
Write access (PLC->KL6201/KL6211): 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 1000bin (0x68) | 0100 0010bin (0x42) | 0x1E | 0x10 | 0x03 | 0x40 |
The byte order 0x68 42 1E 10 03 40 has to be written to parameter data block for the KL6201/KL6211.
The terminal responds with the following data:
Response to write access (KL6201/KL6211->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 xxxxbin | 0101 xxx1bin | 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->KL6201/KL6211): 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 | 00bin A5A4 A3A2A1A0 | 0100bin A9A8A7A6 | x | x | x | x |
A0 to A9: bits of the parameter address
x: The parameter values are not evaluated
Response to read access (KL6201/KL6211->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 xxxxbin | 01F1 xxx0bin | P0...P7 | P8...P15 | P16...P23 | P24...P31 |
x: Bits can take on any value
F: Error bit.
F=0bin: Read access was successful. Bytes 2 to 5 contain the parameter value.
F=1bin: Read access was not successful. Bytes 2 to 5 contain an error code providing information about the cause of the error.
P0 to P31: bits of the parameter value or error code
The read sequence is completed by setting the control bytes to zero:
Conclusion of read access (PLC->KL6201/KL6211): 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 | 0000 0000bin | 0000 0000bin | x | x | x | x |
x: The parameter values are not evaluated if the control bytes are 0x00.
Example
The list of detected slaves (LDS) is to be determined. This requires the parameter 0xB0 (1011 0000bin) to be read.
Read access (PLC->KL6201/KL6211): 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 | 0011 0000bin (0x30) | 0100 0010bin (0x42) | 0x00 | 0x00 | 0x00 | 0x00 |
The byte order 0x30 42 00 00 00 00 has to be written to parameter data block for the KL6201/KL6211. The terminal responds with the following data:
Response to write access (KL6201/KL6211->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 xxxxbin | 0101 xxx0bin | 0x4C | 0x02 | 0x80 | 0x83 |
In this example, the AS-i master is assumed to have detected the slaves with the node numbers 2, 3, 6, 9, 23, 24, 25 and 31. It therefore responds with the parameter data 0x8380024C (1000 0011 1000 0000 0000 0010 0100 1100bin)
The read sequence is completed with the byte sequence 0x00 00 00 00 00 00.