
2-2
Ladder Logic (LAD) for S7-300 and S7-400
C79000-G7076-C504-02
2.1 Structure of User Programs
A user program consists of logic blocks and data blocks. Logic blocks are
blocks with a code section such as organization blocks, function blocks, or
functions.
Organization blocks (OBs) form the interface between the operating system
and the user program. Different organization blocks have different functions.
To create the LAD user program for your S7 CPU, you select the
organization blocks necessary for your specific automation task. For the most
basic task you will require the following:
S Startup (OB100, OB101)
S Scan cycle (OB1)
S Error handling (OB80 to OB87, OB121, OB122), if you do not want your
CPU to switch to STOP when an error occurs.
There are also organization blocks available to handle interrupts in the CPU
or other interrupts from the process.
For detailed information about the functions of each organization block and
the startup information provided by the CPU operating system, refer to the
Reference Manual /235/.
You can program every organization block as a structured program by
creating functions (FCs) and function blocks (FBs) and calling them in the
code section. When the blocks are called, you supply the data required for
the declared parameters.
S A function block (FB) is a logic block with “memory”. This memory
takes the form of instance data blocks assigned to the FB. The instance
DBs store all the actual parameters and static data relating to the function
block.
S A function (FC) is a logic block without “memory”, in other words
without associated instance DBs. After an FC has been processed, the
output parameters contain the calculated function values. Once the
function has been called, the user decides how the actual parameters are
used and stored.
The operating system makes the following data available:
S Peripheral I/Os
S Process image input/output
S Bit memory
S Timers
S Counters
Logic Blocks and
Data Blocks
Organization
Blocks
Functions/
Function Blocks
Data
Introduction
Kommentare zu diesen Handbüchern