hello, about how to read array of string type in the datalayer, I follow your example to read the data as below. I am planed to read the offset-xyz value and offset-xyz-units.it is works to read array of LREAL type, but the array of string is always empty, although the length is corrent. see my program code: Declaration: FUNCTION_BLOCK ReadSets
VAR_INPUT
strName : STRING;
END_VAR
VAR_OUTPUT
END_VAR
VAR
bRead : BOOL;
fbDL_ReadNodeValue: DL_ReadNodeValue;
DataRead: CXA_Datalayer.DL_NodeValue;
strNodePath : STRING;
fbSysCfgPcsSet_Read: motion_core_fbtypes_SysCfgPcsSet;
OffsetXYZ_length : UDINT;
Orientation_Length : UDINT;
OffsetAux_Length : UDINT;
OffsetXYZUnits_Length : UDINT;
pOffsetXYZ : POINTER TO LREAL;
pOrientation : POINTER TO LREAL;
pOffsetAux : POINTER TO LREAL;
pOffsetXYZUnits : POINTER TO STRING;
arOffsetXYZ: ARRAY [0..2] OF LREAL;
arOrientation: ARRAY [0..2] OF LREAL;
arOffsetAux: ARRAY [0..9] OF LREAL;
arOffsetXYZUnits: ARRAY [0..2] OF STRING;
i: UDINT;
END_VAR Implementation:
IF fbDL_ReadNodeValue.Done THEN
fbSysCfgPcsSet_Read.getRootAsSysCfgPcsSet(data:= DataRead.GetData(), size:= DataRead.GetSize());
OffsetXYZ_length := fbSysCfgPcsSet_Read.getOffsetXYZLength();
Orientation_Length := fbSysCfgPcsSet_Read.getOrientationLength();
OffsetAux_Length := fbSysCfgPcsSet_Read.getOffsetAuxLength();
OffsetXYZUnits_Length := fbSysCfgPcsSet_Read.getOffsetXYZUnitsLength();
//OffsetXYZ
FOR i := 0 TO TO_INT(OffsetXYZ_length)-1 BY 1 DO
pOffsetXYZ := fbSysCfgPcsSet_Read.getOffsetXYZ(i);
arOffsetXYZ[i] := pOffsetXYZ^;
END_FOR
//Offset Orientation
FOR i := 0 TO TO_INT(Orientation_Length)-1 BY 1 DO
pOrientation := fbSysCfgPcsSet_Read.getOrientation(i);
arOrientation[i] := pOrientation^;
END_FOR
//OffsetAux
FOR i := 0 TO TO_INT(OffsetAux_Length)-1 BY 1 DO
pOffsetAux := fbSysCfgPcsSet_Read.getOffsetAux(i);
arOffsetAux[i] := pOffsetAux^;
END_FOR
//OffsetXYZUnits example faild
FOR i := 0 TO OffsetXYZUnits_Length-1 BY 1 DO
pOffsetXYZUnits := fbSysCfgPcsSet_Read.getOffsetXYZUnits(i);
arOffsetXYZUnits[i] := pOffsetXYZUnits^;
END_FOR
bRead := FALSE;
END_IF
//motion/cfg/coord-systems/pcs/sets
strNodePath := CONCAT('motion/cfg/coord-systems/pcs/sets/',strName);
fbDL_ReadNodeValue(
Execute:= bRead,
NodeName:= strNodePath,
NodeValue:= DataRead);
... View more