************************************************************
WHILE (BYTE_TO_CHAR(#arrData[#i]) <> ';' & #i <>
(#iReceivedLength-1)) DO
#s_temp := CONCAT(IN1 := #s_temp, IN2 :=
CHAR_TO_STRING(BYTE_TO_CHAR(#arrData[#i])));
#i := #i + 1;
END_WHILE;
#Data.IntValue := STRING_TO_INT(#s_temp);
#s_temp := '';
#i := #i + 1;
//**********************************************************
//4: Char of known size 1 byte
************************************************************
#Data.CharValue := BYTE_TO_CHAR(#arrData[#i]);
//**********************************************************
Those four sections are possible to copy and paste and combine in any way suited for
your needs to match your output string as long as the data types are strings, integers,
real values or characters. If you want to parse any other data types you need to figure it
out yourself but if you stick to those data types you can combine the sections to parse
any output string where the number of variables is known.
NOTE
If your output string contains an unknown number of variables, it might be depending
on how many blobs found for example, this approach will not work. You need to rewrite
the code block.
Since we now have a UDT with 3 real values followed by 2 string values this code need
to be modified to fit this. For the real values reuse section 2; Real of unknown size. For
the string values reuse section 1; String of unknown size.
Remove all of the code above and insert three section 2 snippets followed by two sec‐
tion 1 snippets. Finally you need to assign the parsed values to the correct name in the
UDT since this has changed (see the
Data
variables in the code below). The result
should look like this:
//1: Real of unknown size
************************************************************
WHILE (BYTE_TO_CHAR(#arrData[#i]) <> ';' & #i <>
(#iReceivedLength-1)) DO
#s_temp := CONCAT(IN1 := #s_temp, IN2 :=
CHAR_TO_STRING(BYTE_TO_CHAR(#arrData[#i])));
#i := #i + 1;
END_WHILE;
#Data."Point5.X" := STRING_TO_REAL(#s_temp);
#s_temp := '';
#i := #i + 1;
//**********************************************************
//2: Real of unknown size
************************************************************
WHILE (BYTE_TO_CHAR(#arrData[#i]) <> ';' & #i <>
(#iReceivedLength-1)) DO
#s_temp := CONCAT(IN1 := #s_temp, IN2 :=
CHAR_TO_STRING(BYTE_TO_CHAR(#arrData[#i])));
#i := #i + 1;
END_WHILE;
#Data."Point5.Y" := STRING_TO_REAL(#s_temp);
#s_temp := '';
APPENDIX
12
8021808/12ID/2019-01 | SICK
O P E R A T I N G I N S T R U C T I O N S | TriSpector1000
97
Subject to change without notice