8.2
Subroutines
The program can consist of one Main program that executes completely during each CPU
sweep.
Main
Program
Or a program can be divided into subroutines. The maximum size of a main program or
subroutine block is 64kB. The program can contain up to 255 subroutines.
Subroutines can simplify programming and reduce the overall amount of logic. Each
subroutine can be called as needed. The main program might serve primarily to sequence
the subroutine blocks.
Program
Subroutine
2
3
4
Subroutine
Subroutine
A subroutine block can be called many times as the program executes. Logic that should
be repeated can be placed in a subroutine block, reducing total program size.
Program
Subroutine
2
In addition to being called from the program, subroutine blocks can also be called by
other subroutine blocks. A subroutine block can even call itself.
Main
Program
Subroutine
2
3
4
Subroutine
Subroutine
The main program is level 1. The program can include up to eight additional nested call
levels.
8.2.1
Declaring a Subroutine
A subroutine must be declared through the block declaration editor of the programming
software.
104
GFK-1503E
VersaMax PLC User Manual
For public disclosure
Summary of Contents for VersaMax PLC
Page 16: ...Notes 16 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 38: ...Notes 38 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 50: ...Notes 50 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 92: ...Notes 92 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 112: ...Notes 112 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 224: ...Notes 224 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 292: ...Notes 292 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 316: ...Notes 316 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 317: ......