How to write a sequence
You need to have TcoCore installed. If you don't here's how to do it link
I recommend to read more about it here.
- Create a Context
FUNCTION_BLOCK MainContext EXTENDS TcoCore.TcoContext
VAR
END_VAR
- Create a Sequence
FUNCTION_BLOCK AutomaticSequence EXTENDS TcoCore.TcoSequencer
VAR
END_VAR
- Create
Main
method inAutomaticSequence
and start writing your sequence withStep
METHOD PROTECTED Main : BOOL
---
IF Step(0, TRUE, 'First Step') THEN
StepCompleteWhen(TRUE);
END_IF
IF Step(10, TRUE, 'Second Step') THEN
StepCompleteWhen(TRUE);
END_IF
IF Step(20, TRUE, 'Third Step') THEN
StepCompleteWhen(TRUE);
END_IF
IF Step(30, TRUE, 'Last Step') THEN
CompleteSequence();
END_IF
- Create instance of
AutomaticSequence
inMainContext
FUNCTION_BLOCK MainContext EXTENDS TcoCore.TcoContext
VAR
AutomaticSeq : AutomaticSequence(THIS^, eRestoreMode.None);
END_VAR
- Run the
AutomaticSequence
inMainContext.Main
method
METHOD PROTECTED Main
---
AutomaticSeq.Run();
- Run the
MainContext
inPRG
PROGRAM MAIN
VAR
MainContext : MainContext;
END_VAR
---
MainContext.Run();