See an example I made for reading a safe area:
Declaration:
PROGRAM POU
VAR
bRead: BOOL;
fbDL_ReadNodeValue: DL_ReadNodeValue;
DataRead: CXA_Datalayer.DL_NodeValue;
strNodePath : STRING;
bExecute: BOOL;
bDone: BOOL;
bActive: BOOL;
bError: BOOL;
ErrorID: CXA_Datalayer.ERROR_CODE;
ErrorIdent: CXA_Datalayer.ERROR_STRUCT;
strName : STRING := 'Zone_1';
fbAreas_Read: CXA_MotionCore_fbs.motion_core_fbtypes_SysCfgSafeArea;
Read_CoordSys: STRING;
Read_Name: STRING;
Read_Type: CXA_MotionCore_fbs.motion_core_fbtypes_SafeAreaType;
Read_Boxes_length: UDINT;
Read_Boxes: POINTER TO CXA_MotionCore_fbs.motion_core_fbtypes_SysCfgSafeAreaBox;
Read_Boxes_Int: CXA_MotionCore_fbs.motion_core_fbtypes_SysCfgSafeAreaBox;
arRead_Active: ARRAY [0..2] OF BOOL;
arRead_Max:ARRAY [0..2] OF LREAL;
arRead_Min: ARRAY [0..2] OF LREAL;
arRead_Unit: ARRAY [0..2] OF STRING;
i: INT;
END_VAR
Implementation:
IF bRead THEN
bRead := FALSE;
strNodePath := CONCAT('motion/cfg/safe-areas/',strName);
bExecute := TRUE;
END_IF
IF fbDL_ReadNodeValue.Done THEN
fbAreas_Read.getRootAsSysCfgSafeArea(data:= DataRead.GetData(), size:= DataRead.GetSize());
Read_CoordSys := fbAreas_Read.getCoordSystem();
Read_Name := fbAreas_Read.getName();
Read_Type := fbAreas_Read.getType();
Read_Boxes_length := fbAreas_Read.getBoxLength();
FOR i := 0 TO TO_INT(Read_Boxes_length)-1 BY 1 DO
Read_Boxes := fbAreas_Read.getBox(i);
Read_Boxes_Int := Read_Boxes^;
arRead_Active[i] := Read_Boxes_Int.getActive();
arRead_Max[i] := Read_Boxes_Int.getMax();
arRead_Min[i] := Read_Boxes_Int.getMin();
arRead_Unit[i] := Read_Boxes_Int.getUnit();
END_FOR
bExecute := FALSE;
END_IF
fbDL_ReadNodeValue(
Execute:= bExecute,
Done=> bDone,
Active=> bActive,
Error=> bError,
ErrorID=> ErrorID,
ErrorIdent=> ErrorIdent,
ClientId:= ,
NodeName:= strNodePath,
NodeValue:= DataRead);
... View more