33 / 79Issued: 19.12.2012 Version: KST EthernetKRL 2.2 V1 en (PDF)
6 Programming
Sent data:
Direct sending of a binary data record with end string
Configured raw data:
Programming:
Sent data:
6.2.5 Reading out data
Description XML and binary data are treated differently when saved and read out:
XML data are extracted by the EKI and stored type-specifically in different
memories. It is possible to access each saved value individually.
All EKI_Get...() access functions can be used to read out XML data.
Binary data records are not interpreted by the EKI and stored together in
a memory.
The EKI_GetString() access function must be used to read a binary data
record out of a memory. Binary data records are read out of the memory
as strings.
Binary data records of fixed length must be divided into individual variables
again in the KRL program with CAST_FROM().
XML data
example
Saved XML structure for data reception:
Programming:
DECL EKI_STATUS RET
CHAR Bytes[10]
OFFSET=0
CAST_TO(Bytes[],OFFSET,91984754,913434.2,TRUE,"X")
RET=EKI_Send("Channel_1",Bytes[])
"r?{ ? _I X"
<RAW>
<ELEMENT Tag="Buffer" Type="STREAM" EOS="65,66" />
</RAW>
DECL EKI_STATUS RET
CHAR Bytes[64]
Bytes[]="Stream ends with:"
RET=EKI_Send("Channel_1",Bytes[])
"Stream ends with:AB"
In order to read out data, the corresponding KRL variables have to be
initialized, e.g. by the assignment of values.
Detailed information on the CAST_FROM() command can be found
in the CREAD/CWRITE documentation.
<Sensor>
<Message>Example message</Message>
<Status>
<IsActive>1</IsActive>
</Status>
</Sensor>