12.6.5.4
Modify the Function Block
Secondly you need to modify the function block
FB_Trispector_Test
to parse the incoming
data correct. Open the function block and scroll down to the comment:
//********************START THE PARSING*********************
This is where the parsing of the string into different data types starts. Since the func‐
tion block expects four values (
string;real;int;char
) this parsing is divided into four sec‐
tions:
//1: String 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.StringValue := #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.RealValue := STRING_TO_REAL(#s_temp);
#s_temp := '';
#i := #i + 1;
//**********************************************************
//3: Int of unknown size
12
APPENDIX
96
O P E R A T I N G I N S T R U C T I O N S | TriSpector1000
8021808/12ID/2019-01 | SICK
Subject to change without notice