Chapter 2. Program OrganizationGFK-2950C February 2018 72.1.3 How Blocks Are CalledA block executes when called from the program logic in the_MAIN block or another block. In this example, LD_BLK1 is alwayscalled. Conditional logic can be used to control calling a block. ForLD_BLK2 to be called, input %I00500 and output %Q00100 mustbe 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 CallsThe CPU allows nested block calls as long as there is enough execution stack space to support thecall. If there is not enough stack space to support a given block call, an Application Stack Overflowfault is logged. In these circumstances, the CPU cannot execute the block. Instead, it sets all of theblock’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 twochoices. The best method is to add logic to detect the occurrence of any User ApplicationFault by testing the diagnostic bit %SA38, and then call SVC_REQ 13 to halt the CPU. Analternative method is to add logic that tests for a negative OK value coming out of the blockand 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 calledblocks have very large numbers of parameters. The actual call depth achieved depends on severalfactors, including the amount of data (non-Boolean) flow used in the blocks, the particular functionscalled by the blocks, and the number and types of parameters defined for the blocks. If blocks useless 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.