Block Architecture and the LAD / STL / FBD Editor OB 1 FB FB FC FB FB FB FB FC FC File: PRO1_06E.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 LAD, FBD and STL programming languages... be able to edit, save and download a block with the LAD/STL/FBD Editor... be able to carry out a simple program debugging with the "Monitor Block" test function... as an option, be able to make customizations to the LAD/FBD/STL Editor File: PRO1_06E.2
Types of Program Blocks Operating System Cycle DB DB Time Process OB Organization Blocks FC FB SFC Error FB FC SFB Legend: OB = Organization Block FB = Function Block FC = Function SFB = System Function Block SFC = System Function DB = Data Block FB FB with Instance DB Maximum nesting depth: S7-300: 8 (16 for CPU 318) S7-400: 24 (for each priority class, 2 to 4 additional levels for Error OBs) File: PRO1_06E.3
Program Structuring Possibilities Linear Program Program Partitioned into Areas Structured Program Recipe A OB 1 OB 1 RecipeB OB 1 Pump Mixer Outlet Outlet All instructions are found in one block (usually in Organization Block OB 1) The instructions for the individual functions are found in individual blocks. OB 1 calls the individual blocks one after the other. Reusable functions are loaded into individual blocks. OB 1 (or other blocks) call these blocks and pass on the pertinent data. File: PRO1_06E.4
Process Images S 1 K 1 I 2.0 Q 4.3 PII PIQ Byte 0 Byte 1 Byte 2 : : : 1 CPU Memory Area 1 1 2 User Program : : A I 2.0 = Q 4.3 : : A I 6.4 = Q 4.3 : Byte 0 Byte 1 Byte 2 : : : 1 CPU Memory Area File: PRO1_06E.5
CPU Cycle Cyclic Program Execution Before October 1998 Startup program: Call and execution of OB 100 (once, after Power ON, for example) Transfer PIQ to the digital output modules Start of the cycle monitoring time digital input module Reading the input states from the digital input modules and saving the states in the process image (PII) Call and execution of OB1 (possible interruption by call of other OBs for events such as time-of-day interrupt, hardware interrupts etc. ) Writing the process-image output table (PIQ) in the digital output modules digital output module File: PRO1_06E.6
CPU Cycle Cyclic Program Execution After October 1998 Startup block (OB 100) Execution once after Power ON, for example Start of the cycle monitoring time Output module Writing the process-image output table (PIQ) to the output modules Reading the signal states from the modules and saving the data in the process image (PII) Input module Execution of the program in OB1 (cyclic execution) Events (time-of-day interrupt, hardware interrupts etc.) call other OBs, FBs, FCs, etc. Communications File: PRO1_06E.7
Inserting an S7 Block File: PRO1_06E.8
The LAD / STL / FBD Editor Declaration Table Code Section Detail Window File: PRO1_06E.9
Function Block Diagram The STEP 7 Programming Languages Ladder Diagram Statement List File: PRO1_06E.10
Selecting the Programming Language File: PRO1_06E.11
Programming in LAD and FBD Insert / Cp File: PRO1_06E.12
Programming in STL File: PRO1_06E.13
Saving a Block Current project directory with block name File: PRO1_06E.14
Calling a Block in OB1 File: PRO1_06E.15
Downloading Blocks into the PLC File: PRO1_06E.16
Simple Program Debugging File: PRO1_06E.17
Downloading and Saving Modified Blocks Öffnen Open offline Speichern Save Öffnen Open online Download Laden File: PRO1_06E.18
Exercise 1: Jogging the Conveyor Motor (FC 16) File: PRO1_06E.19
Exercise 2: Calling FC 16 in OB 1 File: PRO1_06E.20
If You Want to Know More File: PRO1_06E.21
Editor Customization: "General" Tab File: PRO1_06E.22
Editor Customization: "View " Tab File: PRO1_06E.23
Editor Customization: "STL" Tab File: PRO1_06E.24
Editor Customization: "LAD/FBD" Tab File: PRO1_06E.25
Editor Customization: "Block" Tab File: PRO1_06E.26
Editor Customization: "Sources/Source Text" Tab File: PRO1_06E.27