Plc Concepts; Execution Of The User Program - Siemens S7-1200 System Manual

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

Advertisement

PLC concepts

4.1

Execution of the user program

The CPU supports the following types of code blocks that allow you to create an efficient
structure for your user program:
● Organization blocks (OBs) define the structure of the program. Some OBs have
● Functions (FCs) and function blocks (FBs) contain the program code that corresponds to
● Data blocks (DBs) store data that can be used by the program blocks.
Execution of the user program begins with one or more optional startup organization blocks
(OBs) which execute once upon entering RUN mode, followed by one or more program cycle
OBs that execute cyclically. You can also associate an OB with an interrupt event, which can
be either a standard event or an error event. These OBs execute whenever the
corresponding standard or error event occurs.
A function (FC) or a function block (FB) is a block of program code that can be called from
an OB or from another FC or FB, down to the following nesting depths:
● 16 from the program cycle or startup OB
● 6 from any interrupt event OB
FCs are not associated with any particular data block (DB). FBs are tied directly to a DB and
use the DB for passing parameters and storing interim values and results.
The size of the user program, data, and configuration is limited by the available load memory
and work memory in the CPU. There is no specific limit to the number of each individual OB,
FC, FB and DB block. However, the total number of blocks is limited to 1024.
Each cycle includes writing the outputs, reading the inputs, executing the user program
instructions, and performing background processing. The cycle is referred to as a scan cycle
or scan.
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
predefined behavior and start events, but you can also create OBs with custom start
events.
specific tasks or combinations of parameters. Each FC or FB provides a set of input and
output parameters for sharing data with the calling block. An FB also uses an associated
data block (called an instance DB) to maintain the data values for that instance of the FB
call. You can call an FB multiple times, each time with a unique instance DB. Calls to the
same FB with different instance DBs do not affect the data values in any of the other
instance DBs.
4
77

Advertisement

Table of Contents
loading

Table of Contents