Initial commit
This commit is contained in:
71
PLC/POUs/MAIN.TcPOU
Normal file
71
PLC/POUs/MAIN.TcPOU
Normal file
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<POU Name="MAIN" Id="{253d06d0-7abd-4394-b68c-5ffd2aaf348a}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[PROGRAM MAIN
|
||||
VAR
|
||||
_fbScheduler : FB_Scheduler;
|
||||
|
||||
_xInitDone : BOOL;
|
||||
|
||||
// Stations
|
||||
_fbInput : FB_Input;
|
||||
_fbEtcher : FB_Etcher;
|
||||
_fbHVTest : FB_HVTest;
|
||||
_fbOutput : FB_Output;
|
||||
_fbNIO : FB_NIO;
|
||||
|
||||
// Example recipe
|
||||
_stRecipeSimple : ST_Recipe;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[IF (NOT _xInitDone) THEN
|
||||
_xInitDone := TRUE;
|
||||
A_Init();
|
||||
END_IF
|
||||
|
||||
// Call all stations
|
||||
_fbInput();
|
||||
_fbEtcher();
|
||||
_fbHVTest();
|
||||
_fbOutput();
|
||||
_fbNIO();
|
||||
|
||||
// Call scheduler
|
||||
_fbScheduler();]]></ST>
|
||||
</Implementation>
|
||||
<Action Name="A_Init" Id="{203d4406-b6da-4e3d-8378-ac96a0e18ff2}">
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Register stations to scheduler
|
||||
_fbScheduler.M_ClearStations();
|
||||
|
||||
_fbScheduler.M_Register(_fbInput);
|
||||
_fbScheduler.M_Register(_fbEtcher);
|
||||
_fbScheduler.M_Register(_fbHVTest);
|
||||
_fbScheduler.M_Register(_fbOutput);
|
||||
_fbScheduler.M_Register(_fbNIO);
|
||||
|
||||
|
||||
// Create simple recipe
|
||||
_stRecipeSimple.uiRecipeID := 1;
|
||||
_stRecipeSimple.uiStartNode := 0;
|
||||
_stRecipeSimple.uiNodeCnt := 3;
|
||||
|
||||
// Process nodes
|
||||
_stRecipeSimple.astNodes[0].uiNodeID := 1;
|
||||
_stRecipeSimple.astNodes[0].dwReqCap := 16#0001;
|
||||
_stRecipeSimple.astNodes[0].uiTransCnt := 1;
|
||||
_stRecipeSimple.astNodes[0].astTransitions[0].eCondition := E_TransitCond.ALWAYS;
|
||||
_stRecipeSimple.astNodes[0].astTransitions[0].uiNextNodeID := 1;
|
||||
|
||||
_stRecipeSimple.astNodes[1].uiNodeID := 1;
|
||||
_stRecipeSimple.astNodes[1].dwReqCap := 16#0001;
|
||||
_stRecipeSimple.astNodes[1].uiTransCnt := 2;
|
||||
_stRecipeSimple.astNodes[1].astTransitions[0].eCondition := E_TransitCond.RESULT_OK;
|
||||
_stRecipeSimple.astNodes[1].astTransitions[0].uiNextNodeID := 3;
|
||||
_stRecipeSimple.astNodes[1].astTransitions[1].eCondition := E_TransitCond.RESULT_NIO;
|
||||
_stRecipeSimple.astNodes[1].astTransitions[1].uiNextNodeID := 4;]]></ST>
|
||||
</Implementation>
|
||||
</Action>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
Reference in New Issue
Block a user