December 2001 Program Creation 7 – 47
7.5.3 Program Structure
To make it easier to maintain and expand your PLC program, you should give
it a modular structure. Modular means that you write a separate program
module for each function. You can then call the individual modules from the
main program. (See “PLC Program Example” on page 7 – 50.) You should
interrogate improper functioning of the machine in the PLC program and
indicate such malfunctions on the screen with plain-language error messages.
Module 9019:Size of the processing stack
To debug functions you can use Module 9019 to interrogate the contents of
the processing stack. The function answers with the number of bytes that lie
on the processing stack of the PLC at the moment. If the processing stack is
empty, the TNC returns the value zero. A byte, word or double word occupies
four bytes on the stack; a marker, input, output, timer or counter occupies two
bytes.
Call:
CM 9019
PL B/W/D <Number bytes on processing stack>