Choosing the type of structure for your user program
Based on the requirements of your application, you can choose either a linear structure or a
modular structure for creating your user program:
● A linear program executes all of the instructions for your automation tasks in sequence,
● A modular program calls specific code blocks that perform specific tasks. To create a
Linear structure:
By creating generic code blocks that can be reused within the user program, you can simplify
the design and implementation of the user program. Using generic code blocks has a
number of benefits:
● You can create reusable blocks of code for standard tasks, such as for controlling a pump
● When you structure the user program into modular components that relate to functional
● Creating modular components simplifies the debugging of your program. By structuring
● Creating modular components that relate to specific technological functions can help to
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
one after the other. Typically, the linear program puts all of the program instructions into
the OB for the cyclic execution of the program (OB 1).
modular structure, you divide the complex automation task into smaller subordinate tasks
that correspond to the technological functions of the process. Each code block provides
the program segment for each subordinate task. You structure your program by calling
one of the code blocks from another block.
or a motor. You can also store these generic code blocks in a library that can be used by
different applications or solutions.
tasks, the design of your program can be easier to understand and to manage. The
modular components not only help to standardize the program design, but can also help
to make updating or modifying the program code quicker and easier.
the complete program as a set of modular program segments, you can test the
functionality of each code block as it is developed.
simplify and reduce the time involved with commissioning the completed application.
Modular structure:
Programming concepts
6.2 Structuring your user program
171