Вы находитесь на странице: 1из 26

Block Architecture and Block Editor

OB 1

FB

FB

FC

FB

FB

FB

FB

SIMATIC S7
Siemens AG 2002. All rights reserved.

FC

FC

Date:
File:

25.06.2006
PRO1_05E.1

SITRAIN Training for


Automation and Drives

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
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.2

SITRAIN Training for


Automation and Drives

Types of Program Blocks


Operating System

DB

DB

FC

FB

SFC

FB

FC

SFB

Cycle
Time
Process

OB
Organization
Blocks

Error

Legend:
OB
FB
FC
SFB
SFC
DB

= Organization Block
= Function Block
= Function
= System Function Block
= System Function
= Data Block

SIMATIC S7
Siemens AG 2002. All rights reserved.

Maximum nesting depth:


S7-300:
8
(16 for CPU 318)
S7-400:

FB

(2 to 4 additional levels for Error OBs,


for each priority class)

FB with
instance DB

Date:
File:

24

25.06.2006
PRO1_05E.3

SITRAIN Training for


Automation and Drives

Program Structure

Linear Program

Program Partitioned into Areas

Structured Program

Recipe A

OB 1

OB 1

Recipe B
Mixer

OB 1

Pump

Outlet

Outlet

All instructions are


found in one block
(usually in Organization
Block OB 1)

SIMATIC S7
Siemens AG 2002. All rights reserved.

The instructions for the individual functions are found in


individual blocks. OB 1 calls the
individual blocks one after the
other.

Date:
File:

25.06.2006
PRO1_05E.4

Reusable functions are loaded


into individual blocks.
OB 1 (or other blocks) call
these blocks and pass on the
pertinent data.

SITRAIN Training for


Automation and Drives

Process Images

PII

PIQ
User
Program

Byte 0
Byte 1
Byte 2
:
:
:

1
:
:
A
=

I
Q
:
:
:
:

2.0
4.3

CPU Memory Area

SIMATIC S7
Siemens AG 2002. All rights reserved.

Byte 0
Byte 1
Byte 2
:
:
:

CPU Memory Area

Date:
File:

25.06.2006
PRO1_05E.5

SITRAIN Training for


Automation and Drives

Cyclic Program Execution


Start-up block (OB 100)
Execution once after power ON, for example

Start of the cycle monitoring time

Input
Module

CPU Cycle

Reading the signal states from the modules


and saving the data in the process image (PII)

Execution of the program in OB1


Block
(cyclical execution)
OB 1
Events (time-of-day interrupt, hardware interrupts etc.)
call other OBs, FBs, FCs, etc.

Writing the process-image output table


(PIQ) to the output modules

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.6

A I 0.1
A I 0.2
= Q8.0

Output
Module

SITRAIN Training for


Automation and Drives

Inserting an S7 Block

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.7

SITRAIN Training for


Automation and Drives

Starting the LAD/STL/FBD Editor

2x

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.8

SITRAIN Training for


Automation and Drives

Components of the LAD/STL/FBD Editor

Declaration
Table

Code Section

Browser

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.9

SITRAIN Training for


Automation and Drives

The STEP7 Programming Languages


STL
A
A
=

FBD

I 0.0

I 0.0
I 0.1
Q8.0

&
Q8.0

I 0.1

LAD
I 0.0

I 0.1

SIMATIC S7
Siemens AG 2002. All rights reserved.

Q8.0

Date:
File:

25.06.2006
PRO1_05E.10

SITRAIN Training for


Automation and Drives

Selecting the Programming Language

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.11

SITRAIN Training for


Automation and Drives

Programming in LAD/FBD

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.12

SITRAIN Training for


Automation and Drives

Programming in STL

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.13

SITRAIN Training for


Automation and Drives

Saving a Block
Current project directory with block name

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.14

SITRAIN Training for


Automation and Drives

Calling a Block in OB1

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.15

SITRAIN Training for


Automation and Drives

Downloading Blocks into the PLC

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.16

SITRAIN Training for


Automation and Drives

Simple Program Debugging

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.17

SITRAIN Training for


Automation and Drives

Downloading and Saving Modified Blocks

Open offline

Save

Open online

Download

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.18

SITRAIN Training for


Automation and Drives

Exercise: Jog Motor (FC 16)

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.19

SITRAIN Training for


Automation and Drives

Exercise: Calling FC 16 in OB 1

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.20

SITRAIN Training for


Automation and Drives

Editor Customization: "Editor" Tab

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.21

SITRAIN Training for


Automation and Drives

Editor Customization: "STL" Tab

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.22

SITRAIN Training for


Automation and Drives

Editor Customization: "LAD/FBD" Tab

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.23

SITRAIN Training for


Automation and Drives

Editor Customization: "Create Block" Tab

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.24

SITRAIN Training for


Automation and Drives

Editor Customization: "Sources" Tab

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.25

SITRAIN Training for


Automation and Drives

Editor Customization: "Symbol Selection" Tab

SIMATIC S7
Siemens AG 2002. All rights reserved.

Date:
File:

25.06.2006
PRO1_05E.26

SITRAIN Training for


Automation and Drives

Вам также может понравиться