Order of Execution
The
Logix Designer
programming application automatically determines the order of execution for the function blocks in a routine when you:- verify a function block routine
- verify a project that contains a function block routine
- download a project that contains a function block routine
You define execution order by wiring function blocks together and indicating the data flow of any feedback wires, if necessary.
If function blocks are not wired together, it does not matter which block executes first. There is no data flow between the blocks
If you wire the blocks sequentially, the execution order moves from input to output. The inputs of a block require data to be available before the controller can execute that block. For example, block 2 has to execute before block 3 because the outputs of block 2 feed the inputs of block 3.
Execution order is only relative to the blocks that are wired together. The following example is fine because the two groups of blocks are not wired together. The blocks within a specific group execute in the appropriate order in relation to the blocks in that group.
Resolve a Loop
To create a feedback loop around a block, wire an output pin of the block to an input pin of the same block. The following example is OK. The loop contains only a single block, so execution order does not matter.
If a group of blocks are in a loop, the controller cannot determine which block to execute first. In other words, it cannot resolve the loop.
To identify which block to execute first, mark the input wire that creates the loop (the feedback wire) with the
Assume Data Available
indicator. In the following example, block 1 uses the output from block 3 that was produced in the previous execution of the routine.The
Assume Data Available
indicator defines the data flow within the loop. The arrow indicates that the data serves as input to the first block in the loop.Do
not
mark all the wires of a loop with the Assume Data Available
indicator.Resolve Data Flow Between Two Blocks
If you use two or more wires to connect two blocks, use the same data flow indicators for all of the wires between the two blocks.
Create a One Scan Delay
To produce a one scan delay between blocks, use the Assume Data Available indicator. In the following example, block 1 executes first. It uses the output from block 2 that was produced in the previous scan of the routine.
Summary
In summary, a function block routine executes in this order:
- The controller latches all data values in IREFs.
- The controller executes the other function blocks in the order determined by how they are wired.
- The controller writes outputs in OREFs.
Provide Feedback