Using Blocks To Structure Your Program; Organization Block (Ob) - Siemens S7-1200 System Manual

Hide thumbs Also See for S7-1200:
Table of Contents
Programming concepts

6.3 Using blocks to structure your program

6.3
Using blocks to structure your program
By designing FBs and FCs to perform generic tasks, you create modular code blocks. You
then structure your program by having other code blocks call these reusable modules. The
calling block passes device-specific parameters to the called block.
When a code block calls another code block, the CPU executes the program code in the
called block. After execution of the called block is complete, the CPU resumes the execution
of the calling block. Processing continues with execution of the instruction that follows after
the block call.
You can nest the block calls for a more modular structure. In the following example, the
nesting depth is 3: the program cycle OB plus 3 layers of calls to code blocks.
6.3.1

Organization block (OB)

Organization blocks provide structure for your program. They serve as the interface between
the operating system and the user program. OBs are event driven. An event, such as a
diagnostic interrupt or a time interval, causes the CPU to execute an OB. Some OBs have
predefined start events and behavior.
172
A
Calling block
B
Called (or interrupting) block
Program execution
Instruction or event that initiates the execution of
another block
Program execution
Block end (returns to calling block)
System Manual, 03/2014, A5E02486680-AG
Start of cycle
Nesting depth
S7-1200 Programmable controller
Table of Contents
loading

Table of Contents