3BSE042835-600
85
Section 6 Program Code Issues
Program Code
Comments are not downloaded to the controller; hence it does not occupy any
controller memory space.
Structured Text shall be used for all program code in the library types. The only
exception is the use of SFC in template types, see
The most important general requirement on the code is that it should be efficient.
This means that it should use few local variables, execute fast and generate little
communication. However, although high performance may be the most important
factor in types (especially in those that will be invoked many times), the code should
still be possible to interpret, also for persons who have not written it. Therefore,
supply comments that clearly describe the different parts of the code. Do not forget
that the identifiers of variables and parameters should be descriptive as well.
In addition, logical indents of loops etc. should be used at all times. Follow up
copy/cut and paste operations carefully as these operations tend to undermine the
indentation patterns.
Although SFC might be used in templates, it shall not be used in other library types
since it is less efficient. An ordinary code block can be designed to behave as a
sequence if the code uses an integer variable, preferable named
PrgStep
, as a
sequence token. The integer variable value represents the step number of the code
and the code is divided into sections that represent steps. The program steps are
normally numbered in 100-steps. Conditional statements based on the token
variable determine the execution of the different code sections. The principle can be
seen in
Содержание AC 800M
Страница 1: ...Power and productivity for a better worldTM AC 800M Library Object Style Guide System Version 6 0...
Страница 2: ......
Страница 3: ...AC 800M Library Object Style Guide System Version 6 0...
Страница 12: ...Related Documentation About This User Manual 12 3BSE042835 600...
Страница 18: ...Naming Convention Section 1 Libraries 18 3BSE042835 600...
Страница 108: ...SIL Mark Restrictions Section 6 Program Code Issues 108 3BSE042835 600...
Страница 116: ...Standard Library Parameters Appendix A Names and Abbreviations 116 3BSE042835 600...
Страница 119: ......