With some great help and explanation it is working. It is good to share it also here the result of the working program. Declaration: PROGRAM StartTimerOnDL
VAR
fbStartTimer : CXA_AutomationCore_fbs.common_scheduler_fbs_DurationTimer; // The type definition can be found in the references write type totally on the end.
fbBuilder: flatbuffers.FlatBufferBuilder; // Declare the flatbuffer builder
fbDL_WriteNodeValue : CXA_Datalayer.DL_WriteNodeValue; // Write the generated flatbuffer to the node
bExecute_write : BOOL := FALSE; // Only execute once
// By a complicated flatbuffer you must work with offset. Not necessary for this example.
//fbOffset: UDINT;
// Write node values
strNodePath: STRING(255); // Path in the DataLayer that you want to modify
bStart_write: BOOL; // Execute the function only once
// Some variable to see the progress
writeNodeValue: CXA_Datalayer.DL_NodeValue;
fbValueOut : CXA_Datalayer.DL_NodeValue;
bDone_write: BOOL;
bActive_write: BOOL;
ErrorID_write: CXA_Datalayer.ERROR_CODE;
bError_write: BOOL;
ErrorIdent_write: CXA_Datalayer.ERROR_STRUCT;
END_VAR
Implementation: IF bStart_write THEN
// Writing to the flatbuffer is started. The function is executed only once.
fbBuilder(forceDefaults:=TRUE); // Define the flatbuffer
//
// For writing always the same sequence must be executed
// - Start builder
// - Add data
// - Finish builder
// - Set data from builder to the node value that must be written
//fbOffset := fbStartTimer.createDurationTimer(fbBuilder, CXA_AutomationCore_fbs.common_scheduler_fbs_Timer.ALL);
fbStartTimer.startDurationTimer(fbBuilder);
fbStartTimer.addTimer(CXA_AutomationCore_fbs.common_scheduler_fbs_Timer.ALL);
fbBuilder.finish(fbStartTimer.endDurationTimer()); // Finish complete builder and closing the startDurationTimer
writeNodeValue.SetFlatbuffer(fbBuilder);
// NodePath to create
strNodePath := 'scheduler/tasks/ctrlXAutomation/info/duration/start';
bExecute_write := TRUE;
bStart_write := FALSE;
END_IF
fbDL_WriteNodeValue(
Execute:= bExecute_write,
Done=> bDone_write,
Active=> bActive_write,
Error=> bError_write,
ErrorID=> ErrorID_write,
ErrorIdent=> ErrorIdent_write,
ClientId:= ,
NodeName:= strNodePath,
NodeValueIn:= writeNodeValue,
NodeValueOut:= fbValueOut);
IF fbDL_WriteNodeValue.Done THEN
bExecute_write := FALSE;
END_IF
... View more