Sunteți pe pagina 1din 25

Block Architecture and Block Editor

OB 1 FB FB FC

FB FB FB

FB FC FC

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.1
Objectives

Upon completion of this chapter the participant will ...


... know the different types of S7 blocks
... understand the principle of "structured programming"
... know the meaning of the process images (PII, PIQ)
... be able to explain the principle of cyclic program execution
... know and be able to select the STEP7 programming languages -
LAD, FBD and STL
... be able to edit, save and download an S7 logic block into the CPU
using the LAD/STL/FBD Editor
... be able to carry out a simple program debugging with the "Monitor
Block" test function
... will be able to make customizations to the LAD/STL/FBD Editor

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.2
Types of Program Blocks

Operating System
DB DB

Cycle

Time OB
FC FB SFC
Organization
Process Blocks

Error FB FC SFB

Legend: Maximum nesting depth:


OB = Organization Block S7-300: 8 (16 for CPU 318)
FB = Function Block
FC = Function S7-400: 24
SFB = System Function Block
FB
SFC = System Function FB with (2 to 4 additional levels for Error OBs,
DB = Data Block instance DB for each priority class)

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.3
Program Structure

Linear Program Program Partitioned into Areas Structured Program

Recipe A
Pump
OB 1 OB 1 Recipe B OB 1

Mixer
Outlet

Outlet

All instructions are The instructions for the indi- Reusable functions are loaded
found in one block vidual functions are found in into individual blocks.
(usually in Organization individual blocks. OB 1 calls the OB 1 (or other blocks) call
Block OB 1) individual blocks one after the these blocks and pass on the
other. pertinent data.

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.4
Process Images

PII PIQ
User
Byte 0 Program Byte 0
Byte 1 Byte 1
Byte 2 1 Byte 2
: : :
: : : 1
: A I 2.0 :
= Q 4.3
:
:
:
:
CPU Memory Area CPU Memory Area

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.5
Cyclic Program Execution
Start-up block (OB 100)
Execution once after power ON, for example

Input
Start of the cycle monitoring time
Module

Reading the signal states from the modules


and saving the data in the process image (PII)
CPU Cycle

Execution of the program in OB1 Block


(cyclical execution) A I 0.1
OB 1 A I 0.2
Events (time-of-day interrupt, hardware interrupts etc.)
= Q8.0
call other OBs, FBs, FCs, etc.

Writing the process-image output table Output


(PIQ) to the output modules Module

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.6
Inserting an S7 Block

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.7
The LAD/STL/FBD Editor

Declaration Table

Code Section

Detail Window

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.8
The STEP7 Programming Languages

STL

A I 0.0
A I 0.1
= Q8.0
FBD

I 0.0 &
Q8.0
I 0.1 =

LAD

I 0.0 I 0.1 Q8.0

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.9
Selecting the Programming Language

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.10
Programming in LAD/FBD

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.11
Programming in STL

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.12
Saving a Block
Current project directory with block name

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.13
Calling a Block in OB1

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.14
Downloading Blocks into the PLC

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.15
Simple Program Debugging

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.16
Downloading and Saving Modified Blocks

Open offline

Save

Open online

Download

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.17
Exercise: Jog Motor (FC 16)

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.18
Exercise: Calling FC 16 in OB 1

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.19
Editor Customization: "General" Tab

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.20
Editor Customization: "View" Tab

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.21
Editor Customization: "STL" Tab

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.22
Editor Customization: "LAD/FBD" Tab

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.23
Editor Customization: "Block" Tab

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.24
Editor Cutomization: "Sources/Source Text" Tabs

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_07E.25

S-ar putea să vă placă și