Chapter 4. Ladder Diagram (LD) Programming
220
PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual
GFK-2950C
Parameterized block called from multiple blocks
When calling the parameterized block from multiple blocks, it is imperative to separate the timer
reference memory used by each call to the parameterized block. Follow these rules and guidelines:
1.
Call the parameterized block exactly one time per execution of each source block in which it
appears.
2.
Choose a %L reference or parameterized block formal parameter for the timer reference
memory. Do not use a %R, %P, %W, or symbolic memory reference.
Notes:
▪
The strongly recommended choice is a %L location, which is inherited from the parameterized
block’s source block. Each source block has its own %L memory space except the _MAIN block,
which has a %P memory area instead. When the _MAIN block calls another block, the %P
mappings from the _MAIN block are accessed by the called block as %L mappings.
▪
If you use a parameterized block formal parameter (word array passed-by-reference), the actual
parameter that corresponds to this formal parameter must be a %L, %R, %P, %W, or symbolic
reference. If the
actual parameter
is a %R, %P, %W, or symbolic reference, a unique reference
address must be used by each source block.
Recursion
If you use recursion (that is, if you have a block call itself either directly or indirectly) and your
parameterized block contains an OFDT, ONDTR, or TMR, you must follow two additional rules:
▪
Program the source block so that it invokes the parameterized block before making any recursive
calls to itself.
▪
Do not program the parameterized block to call itself directly.
Using OFDT, ONDTR and TMR in UDFBs
UDFBs are user-defined logic blocks that have parameters and instance data. For details on these
and other types of blocks, refer to Chapter 2.
When a timer function is present inside a UDFB, and a member variable is used for the control block
of a timer, the behavior of the timer may not match your expectations. If multiple instances of the
UDFB are called during a logic sweep, only the first-executed instance will update its timer. If a
different instance is then executed, its timer value will remain unchanged.
In the case of multiple calls to a UDFB during a logic scan, only the first call will add elapsed time to
its timer functions. This behavior matches the behavior of timers in a normal program block.
Example
A UDFB is defined that uses a member variable for a timer function block. Two instances of the
function block are created: timer_A and timer_B. During each logic scan, both timer_A and timer_B
are executed. However, only the member variable in timer_A is updated and the member variable in
timer_B always remains at 0.
Summary of Contents for PACSystems RSTi-EP
Page 357: ......
Page 466: ...Chapter 9 Diagnostics GFK 2950C February 2018 451 ...