Chapter 2. Program Organization
GFK-2950C
February 2018
7
2.1.3
How Blocks Are Called
A block executes when called from the program logic in the
_MAIN block or another block. In this example, LD_BLK1 is always
called. Conditional logic can be used to control calling a block. For
LD_BLK2 to be called, input %I00500 and output %Q00100 must
be ON. For details on using the Call function, refer to Chapter 4
(LD programming), Chapter 5 (FBD programming) or Chapter 8
(ST programming).
2.1.4
Nested Calls
The CPU allows nested block calls as long as there is enough execution stack space to support the
call. If there is not enough stack space to support a given block call, an
Application Stack Overflow
fault is logged. In these circumstances, the CPU cannot execute the block. Instead, it sets all of the
block’s Boolean outputs to FALSE, and resumes execution at the point after the block call instruction.
Note:
To halt the CPU when there is not enough stack space to execute a block, there are two
choices. The best method is to add logic to detect the occurrence of any User Application
Fault by testing the diagnostic bit %SA38, and then call SVC_REQ 13 to halt the CPU. An
alternative method is to add logic that tests for a negative OK value coming out of the block
and then call SVC_REQ 13 to halt the CPU.
A call depth of eight levels or more can be expected, except in rare cases where several of the called
blocks have very large numbers of parameters. The actual call depth achieved depends on several
factors, including the amount of data (non-Boolean) flow used in the blocks, the particular functions
called by the blocks, and the number and types of parameters defined for the blocks. If blocks use
less than the maximum amount of stack resources, more than eight nested calls may be possible.
The call level nesting counts the _MAIN block as level 1.
Summary of Contents for PACSystems RSTi-EP
Page 357: ......
Page 466: ...Chapter 9 Diagnostics GFK 2950C February 2018 451 ...