while: the commands are repeated while the condition cond is true. If cond already is false at the moment that the control program gets this instruction, it does not execute the commands, neither even one time:
while (cond)
{
commands
}
Obs.: for implementation of this loop, the compiler of the LCE generates in the IL labels of the form ENQX, where X represents a sequential number, and the instructions LDN V_0 and JMP ENQ1 for purposes of the repetition of the loop while cond is true, as long as V_0, with status of reserved word, there isn't utilized in any other place of the source program, remainning always false.
repeat: the commands are repeated while the condition cond is true. If cond already is false at the moment that the control program gets this instruction, it execute the commands only one time:
repeat
{
commands
}
while (cond)
Obs.: for implementation of this loop, the compiler of the LCE generates in the IL labels of the form REPX, where X represents a sequential number. loop for: if the condition cond is true, the commands are repeated as the variable Var goes, from one in one, from first value Var_or_Cte1to the second value Var_or_Cte2, that is, what is between the for and the end_for respective will be executed repeatedly by (Var_or_Cte1 - Var_or_Cte2 + 1) times:
if (cond)
{
forVarfromVar_or_Cte1toVar_or_Cte2 commands end_for }
goto: if the condition cond is true, it transfers the execution of the scan cycle to other point, determined by the Deviation:
...
if (cond) { gotoDeviation; }
...
destinationDeviation:
...
subroutine: defines the source code of a subroutine (similar to the mathematical concept of function):
subroutinename (idVar1, idVar2)
code
end_subroutine
To return conditionally from a subroutine, utilize the command
if (condition) {
return;
}
The subroutine will be conditionally called, in the source program, by the name accompanied of the parameters:
if (condition) {
name (idVar1, idVar2);
}
Obs. 1: recursive calls to subroutines are not permitted, yet.
Obs. 2: the definitions of all subroutines of the control must be made at the end of the source program, before of the codes handle of interruptions, if there are ones. Obs. 3: at the end of the subroutine there is an implicit unconditional return instruction.
sequence: creates a sequence inside of the control, to temporization modulating of the program, facilitating application of the SFC (Sequential Function Chart) or GRAFCET (Graphe Fonctionnel de Commande Etape/Trasition) technics:
sequenceS1
...
circuit
...
end_circuit_sequence
networkN1// Remarks1
if (cond) transfer_sequenceS2
networkN2// Remarks2
end_sequence;
networkother// Remarks ...
...
In the example above, the instructions inside of the sequence S1 (between the clauses sequence and end_sequence) only will be executed when the variable S1 is turned on. If S1 is activated, only it will transfer the control to the other sequence S2 when the condition cond on command transfer_sequence is true (what will turn off the variable S1and will turn onS2).
finish_scan: if the condition cond is true, it finishes the scan cycle where it is and starts a new cycle, from beginning:
if (cond) { finish_scan; }
stop: if the condition cond is true, it stops the execution of the control program and backs to the stop mode: