Chapter 5. Function Block Diagram (FBD)
234
PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual
GFK-2950C
5.1
Note on Reentrancy
When a function block is created using the FBD language, the wires are created as global variables,
not as members. This has two consequences. First, if there are multiple instances of that block in the
program, the wires will show the values from the last instance executed during the sweep, not the
values for the instance being viewed. This will give the appearance of incorrect operation while
actually working properly.
The second consequence is that function blocks written in FBD are not reentrant. If you have
multiple instances of a block, and one of them can be called by an interrupt, then it is possible for the
interrupt to trigger while one instance of the block is in process, change the values of the wires, and
then return control to the original block. This will result in improper operation.
There is a work-around for both of these symptoms, which is to create the wires as member
variables rather than global variables. This must be done manually by creating member variables of
the appropriate types. You can then right-click on each wire in the FBD diagram and use the
Replace
Variable
command to change the wire from a global variable to a member variable.
Caution
Blocks written in the FBD language are not reentrant.
Because of this, if the block is called directly, or
indirectly, from an interrupt, the block must not be
called anywhere else in the program, except when
steps are taken to explicitly make it reentrant (see
above). Doing so can lead to unexpected operation.
This applies to basic blocks, parameterized blocks, and
user-defined function blocks written in FBD.
Summary of Contents for PACSystems RX7i
Page 357: ......
Page 466: ...Chapter 9 Diagnostics GFK 2950C February 2018 451...