2

In addition to being called from the program, subroutine blocks can also be called by other subroutine blocks. A subroutine block may even call itself.

PROGRAM

a45663

SUBROUTINE 2

SUBROUTINE

4

SUBROUTINE 3

The PLC will only allow eight nested calls before an “Application Stack Overflow” fault is logged and the PLC transitions to STOP/Fault mode. The call level nesting counts the main program as level 1.

How Blocks Are Called

A subroutine block executes when called from the program logic in the program or from another block.

 

%I0004

%T0001

—— ————————————————————————————————————————————————˝—————————————————————( )—

 

______________

 

%I0006

 

—— —————

CALL ASTRO

(SUBROUTINE)

______________

 

 

 

%I0003

%I0010

%Q0010

—— —————

——————————————————————————————————————————˝———————————————————( )—

 

 

 

This example shows the subroutine CALL instruction as it will appear in the calling block.

Periodic Subroutines

Version 4.20 or later of the 340 and higher CPUs support periodic subroutines. Please note the following restrictions:

1.Timer (TMR, ONDTR, and OFDTR) function blocks will not execute properly within a periodic subroutine. A DOIO function block within a periodic subroutine whose reference range includes references assigned to a Smart I/O Module (HSC, Power Mate APM, Genius, etc.) will cause the CPU to lose communication with the module. The FST_SCN and LST_SCN contacts (%S1 and %S2) will have an indeterminate value during execution of the periodic subroutine. A periodic subroutine cannot call or be called by other subroutines.

2.The latency for the periodic subroutine (that is, the maximum interval between the time the periodic subroutine should have executed and the time it actually executes) can be around .35 milliseconds if there is no PCM, CMM, or ADC module in the main rack. If there is a PCM, CMM or ADC module in the main rack—even if it is not configured or used—the latency can be almost 2.25 milliseconds. For that reason, use of the periodic subroutine with PCM-based products is not recommended.

GFK-0467K

Chapter 2 System Operation

2-19

Page 39
Image 39
GE 90-30/20/Micro manual How Blocks Are Called