PLC Introduction | PLC Basics | PLC Programming | PLC-Exercises | PLC-Training | Translation
Path: PLC Basics » Code modules in Step7
Wrong translation? Help us!

Code modules in Step7

Code modules in Step7 correspond to the program organising units POE. It immensly varies from the module conception of the standard  EN 61131-3 and all PLC programmers should be familiar with them.

In Code modules the application program is included. The code module types include the organisational modules OB, the function modules FB and SFB as well as the functions FC and SFC. The data belonging to the code modules are stored in data modules .

The organisational modules, among others  OB1 in which the program or the program structure is included, are activated by the operating system. All other code modules are activated from the application program, particularly out of the OB1 . Of course it is possible to activate further code modules from a function or a function module. It all depends on the structure of the program.

In the graphic below you can see the schematic structure of an example program. Out of reasons for simplifying the matter we left out with the activation of the system functions SFC and the system function modules SFB. These can be activated like normal FC's and FB's .

The operating system starts OB1. If any particular events occur other OB's interrupt the process of the programm in OB1. In OB1 FC1 is activated first.

In FC1 again FC2 is activated and the program is processed. After this it is returned to FC1. As the next step again another module is activated in the FC1. This time it is FB1 with the coherent DB1. After the program has been processed in FB1 it is returned to FC1. As the processing in FC1 is also finished, the process goes on with OB1.

The next step is the activation in OB1 of the FB2 with the coherent DB2 . After fiishing the process of the program in FB2 it is returned to OB1. As the program is finished in OB1 the whole process starts all over again.

All code modules have access to global data modules. In our example FB1 and FB2 access the data of the global data modules.

Code blocks
Representation of a program structure with code blocks and data blocks