2851617310@qq.com
   
+86 18005007289
Hongfeida Automation
Introduction of Siemens S7-300 / 400 PLC ob-fb-fc-db block
Source: | Author:pmo89cafb | Published time: 2020-10-26 | 1792 Views | Share:
The PLC user program structure of Siemens S7-300 / 400 is obviously different from that of S7-200. The linear structure, function calling structure and structured programming can be used.
When using calling structure and structured programming, program appears in the form of organization block (OB), program block (FC), function block (FB), system program block (SFC), system function block (SFB), data block (DB). Among them, organization block (OB), program sequence block (FC), function block (FB) are collectively referred to as "logic block"; system block (SFC) and system function block (SFB) are collectively referred to as "system block".

Tissue block (OB)
Organization blocks (OB) provides the interface between the internal CPU operating system and the user program in PLC. It is a logic block directly called by the CPU operating system, which is used to manage the call and execution interruption of each component in PLC program. OB determines the structure of PLC user program and the calling order of blocks, and plays the role of "managing" user program.
Different CPU types of S7-300 / 400 can select and support different ob blocks. However, ob1 is the cycle control block of all PLC user programs, which is the prerequisite for running PLC user programs. Therefore, any PLC program and any CPU can not lack ob1.
The call condition of OB block is called "trigger event". According to the different "trigger event", OB block can be divided into several levels. Each level has different priority. The higher priority ob can interrupt the execution of low priority ob. If necessary, S7 Series PLC can use more than one ob block in addition to ob1.、


Sequence block (FC)
Function (FC) is a common logic block written by users and does not need special data block.
FC block can not be called repeatedly in the program. In most cases, FC block should be programmed directly with PLC's "absolute address" or "symbol address". However, some program variables can be defined according to needs.
Like S7-200 -, the "temporary variables" of FC block are also stored in the local variable data stack (L). This area is common to all program blocks, and can only be used to store the intermediate operation results used inside the FC block (these intermediate operation results cannot be used outside the FC block); after the program block is executed, the data in the local variable data stack will be required by other blocks replace. If you need to save the state that can be used for other logical blocks, use the PLC's internal flag register m or use "block DB".
In the block FC, there are some logic blocks which are provided by PLC manufacturers and integrated in the S7 CPU operating system, called system function (SFC). System block SFC is a part of PLC internal operating system. Users do not need to write or edit it, but they can be called directly according to their needs.

Function block (FB)
Function blocks (FB blocks) are commonly used logic blocks written by users and supported by instance data blocks (DI).
The function of FB block and FC block is basically the same, but in FB, in addition to using "absolute address" or "symbol address" for programming, the "program variable" must be used for programming in structured programming. Therefore, FB must be a supporting and independent data storage area - "instant data block Di". On the other hand, the function block FB can also return the required data to the logical block calling it through di.
Like FC, there are some function blocks in FB which are provided by PLC manufacturers and integrated in S7 CPU operating system, which are called system function blocks (SFB). System function block SFB is also a part of PLC internal operating system. Users don't need to write or edit it, but they can be called directly according to their needs.

 Data block (DB)
Data blocks (DB) is a data storage area used to store the data needed to execute user programs and the results of program execution. Its function is similar to flag register, but it has more numbers. According to different purposes, data block DB can be divided into two types: instant data blocks (DI) and general data blocks (DB).
The immediate data block (DI) is used to transfer the parameters of the function block and can only be accessed by the specified function block FB. When calling the function block FB, the immediate data block Di for the function block must be specified at the same time. The data in the real-time data block can be generated automatically, and they can be the data in the FB variable declaration table (excluding temporary variables).
General data block (DB) is used to store the global data of PLC. All FB, FC or ob can read and write the general data block. Therefore, it is also called shared data block. The data in the general data block is not deleted at the end of the user program.