Debug and Control
- Basics – Program working sequence
- Example Jump function blocks
Break - Manually
Break - Signal
Jump - Start
Jump - Destination
Basics – Program working sequence
As the function blocks in this library can be used to manipulate the program execution, a basic overview of the program working sequence will be given here.
The sequence of a program for executing function blocks is ordered by the function block number. Every function block with target system code has its own unique number. The numbers start with 1 and the function blocks will be executed in ascending order. The function blocks read the actual input values, perform their functionality and issue new values at the outputs. These output values are kept until they get renewed by the function block in the next program cycle.
The example in the following figure shows how the numbering sequence will influence the result of an operation.
The first subtraction (block number 2) calculates with one current value from the sinus generator as well as with one value from the last cycle, provided by the addition block (number 3), which will be updated only after the subtraction. The second subtraction always calculates with current values. Because of this working sequence the results differ.
With the jump function blocks from this library the program execution can be manipulated even further, to enable jumps within the program. The impact of these jumps also depend on the function block numbers (both the numbers of the jump blocks and the numbers of the other function blocks).
Example Jump function blocks
In the following example you can see how the jump function blocks can influence the working sequence.
The first figure shows the example without any active jumps. The function blocks work normally and provide the same result.
In the following figure the forward jump (A) is active. That is why the second addition (block number 4) is skipped. The other function blocks are working normally.
In the next figure the backward jump (B) is active. In the first program cycle the first three additions are executed. Then the jump point is reached and the jump back is executed. From this point onward only two additions (number 4 and 6) still operate.
The jump function block is set in a way that allows up to 1000 back jumps in one program cycle. If this number is reached, the program is interrupted and a new program cycle can operate. This new cycle will still start at the jump destination block.
In the following figure you can see that the jump start block (C) shows gray arrows. This indicates that this part of the program was never reached.
In the last figure the backward jump (C) is active. The program is executed exactly one time, until it reaches the jump point. After this the program only operates this one jump (block number 10 and 9). The program performs this endless loop and no other function block is executed anymore.