776
Предисловие Краткий обзор содержания книги Краткий обзор содержания дискеты с примерами программ Автоматизация с применением STEP 7: схемы применения Содержание Введение Базовые функции Функции для обработки чисел Управление выполнением программы Выполнение программы Обработка переменных Структурированный язык управления SCL Приложения Предметный указатель Сокращения Демонстрационные программы для STEP 7 Ганс Бергер Автоматизация посредством STEP 7 с использованием STL и SCL и программируемых контроллеров SIMATIC S7- 300/400 Издание 2001

Berger Step7-STLSCL r

  • Upload
    -

  • View
    579

  • Download
    2

Embed Size (px)

Citation preview

STEP 7:

STEP 7 STL SCL SIMATIC S7300/400

SCL STEP 7

2001

, , . , :

! ! !

, , , .

, , .

, .

, , .

, .

. , , , .

:

!

, , , Siemens. , , , , .

SIMATIC, SIMATIC HMI SIMATIC NET - SIEMENS AG. , , ; , . Copyright Siemens AG 2001 , . . , , , . Siemens AG \ 4848, D- 90327, . , . , , , . . Siemens AG 2001 Technical data subject to change.

Siemens Aktiengesellschaft

SIMATIC "" . , (SIMATIC S7), (SIMATIC M7) (SIMATIC C7). . S7-200 ("-PLC"), S7300 S7-400 . STEP 7, STEP 5, SIMATIC. Windows 95/98 Microsoft Windows NT Microsoft , STEP 7 ( , ""). STEP 7 , DIN EN 6.1131-3: STL ("statement list" - , Assembler- ), LAD ("ladder diagram" - " ", ), FBD ("function block diagram" - " ", -) SCL ("Structured Control Language" " ", Pascal ). , : S7-GRAPH ( SIMATIC ), S7-HiGraph ( SIMATIC ) CFC ("continuous function chart" - ; CFC FBD). .II Automating with STEP 7 in STL and SCL STEP 7 STL SCL

, , STEP 7. STL S7-300/400. S7-300/400 STEP 7. STEP 7 , STEP 7 . STL , . , , . STL, ( ) . , , , , . SCL. SCL , SCL . STEP 7 SIMATIC S7- , . STEP 5 STEP 7, STL SCL. STEP 7 5.1, S7-SCL 5.1. Erlangen, 2001 (Hans Berger)

Automating with STEP 7 in STL and SCL STEP STL SCL

III

S7-300/400 1 SIMATIC S7-300/400 PLC ( S7-300/400); ; (PROFIBUS DP); (); ; 2 STEP 7 ; ; ; Symbol Editor ( ); STL/ SCL; ; 3 S7- ; ; STL/ SCL; DB; ; ; () PLC 4 AND (), OR (), Exclusive OR ( ); 5 , ; ; 6 Load Transfer; 7 SIMATIC ; IEC- 8 SIMATIC-; / ; /; IEC- , 9 INT, DINT REAL , 15 "" , "" ; EN/ENO

10 INT, DINT REAL; ; / 11 ; Arc-; ; 12 ; 13 14 Word AND (), OR (), Exclusive OR ( )

16 , , RLO, BR, "" ; 17 (MCR) MCR, MCR-, MCR-

18 , ; 19 ; ;

IV

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

20 ; ; ( , ; ); ; ; SFC SFB 21 ; ; ; ; , 22 STL "", "" ; STOP, HOLD, ; 23 ; ;

, 24 ; ; UDT

SCL SCL 27 ,

S5/S7 , 32 S5/S7

, , , ; S5-; 28 IF, CASE, FOR, WHILE, REPEAT, CONTINUE, EXIT, GOTO, RETURN

25 ; DB; ANY; ( );

29 SCL SCL; ; ; EN/ENO

33 ; ; IEC- ; S5-S7 ; TI-S7 ; -; 34 STL ; ; 35 SCL ; ; ;

26 ; ; ; "" ANY;

30 SCL- ; ; ; ; 28 ; STRING-; Date/TOD-;

Automating with STEP 7 in STL and SCL STEP STL SCL

V

, STL SCL. , . STL_BOOK SCL_BOOK. 2,7 1,6 ( PG). STL_BOOK , STL- . , (: [Conveyor Example]), ( [Message Frame Example]). . STL_BOOK STL- FB 104 4: FB 105 5: FB 106 6: FB 107 7: FB 108 8: (Digital) STL- FB 109 9: FB 110 10: FB 111 11: FB 112 12: FB 113 13: FB 114 14: Word STL- FB 115 15: FB 116 16: FB 117 17: FB 118 18: FB 119 19: ( 3) UDT 51 , UDT 52 , FB 51 FB 52 FC 61 FC 62 FC 63 SFC FB 120 20: FB 121 21: FB 122 22: FB 123 23: FB 124 24: FB 125 25: FB 126 26: FB 101 FB 102 FB 103 FC 11 FC 12 FB 20 FB 21 FB 22 FC 41 FC 42 FC 43 FC 44 DOUBLE WORD FC 45 S5 REAL S7 FC 46 REAL S7 S5 FC 47 ( ANY) Automating with STEP 7 in STL and SCL STEP 7 STL SCL

VI

SCL_BOOK SCL SCL-. , STL- : " " [Conveyor Example] [Message Frame Example], SCL_BOOK SCL-. "General Examples" (" ") SCL- , SCL STL SCL-. SCL_BOOK SL- ( 27) FC 271 OB 1 FB 271 , , FB 272 SL- ( 28) FB 281 IF FB 282 CASE FB 283 FOR FB 284 WHILE FB 285 REPEAT SCL- SL- ( 29) F 291 FC F 292 FC FB 291 FB FB 292 FC FB F 293 FC EN/ENO FB 293 FB EN/ENO FB 294 EN/ENO FC 11 FC 12 FB 20 FB 21 FB 22 SCL- SL- ( 30) FB 301 FB 302 FB 303 FB 304 FB 305 SL- ( 31) FB 311 FB 312 FB 313 String FB 314 Date/TOD FB 315 FC 61 DT_TO_STRING FC 62 DT_TO_DATE FC 63 DT_TO_TOD FB 61 FB 62 FB 63 FB 64 FIFO STL SCL UDT 51 , UDT 52 , FB 51 FB 52 FC 61

, , , , , . -, . STEP 7 STEP 7Mini, -, - STEP 7 (. ).

Automating with STEP 7 in STL and SCL STEP STL SCL

VII

STEP 7: , , () STEP 7. SIMATIC Manager, . . , ( Windows) , CPU. . . , , . . . : (), ; () , ( ) . , SIMATIC Manager.

VIII

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

SIMATIC Manager

?

Hardware

(,CPU)

Proect

CPU c DP Master (CPU with DP Master): PROFIBUS, DP-

Hardware

( )

CPU

(Master) DP , , (Slave) DP-

System Data [ ]

Automating with STEP 7 in STL and SCL STEP STL SCL

IX

""

,

CP

(UDT) DB

" "

FC FB, DB OB

System Data [ ]

Blocks []

X

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

(online)

,

CPU PG

Automating with STEP 7 in STL and SCL STEP STL SCL

XI

1 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5 1.5.1 1.5.2 1.5.3 SIMATIC S7-300/400 S7-300 S7-400 CPU I/O (/) DP- DP- (DP Master) DP- (DP Slaves) PROFIBUS-PA AS- (communications) (communications services) (connections) ( )

1-11-3 1-3 1-3 1-4 1-6 1-8 1-10 1-10 1-11 1-12 1-13 1-13 1-15 1-16 1-18 1-18 1-18 1-20 1-24 1-25 1-26 1-26 1-27 1-27 1-28 1-29 1-29 1-29 1-31 1-32

XII

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.2 2.2.3 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.6 2.6.1 2.6.2 2.6.3 2.6.4

STEP 7 STEP 7 (STEP 7 Basic Package) SIMATIC Manager (Project(s) Library(ies)) (Online Help ) , (Project Versions) MPI Monitor () Modify () (Network) (Network View) DP- Network Configuration (Connections) (Network Transitions) (Loading the Connection Data) S7- (Symbol Table) STL- (STL Program Editor) SCL- (SCL Program Editor) (Rewiring) (Address Priority) (Reference Data) (Online Mode) PLC CPU (CPU Information) CPU

2-1 2-1 2-1 2-2 2-2 2-6 2-7 2-8 2-8 2-10 2-11 2-13 2-15 2-15 2-16 2-17 2-18 2-18 2-20 2-21 2-22 2-27 2-28 2-29 2-29 2-30 2-32 2-37 2-40 2-41 2-42 2-44 2-46 2-46 2-47 2-49 2-49

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

XIII

2.6.5 2.7 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3 3.1 3.1.1 3.1.2 3.1.3 3.2 3.2.1 3.2.2 3.2.3 3.2.4 3.3 3.3.1 3.3.2 3.3.3 3.4 3.4.1 3.4.2 3.4.3 3.5 3.5.1 3.5.2 3.6 3.6.1 3.6.2

(Block Handling) STOP (Monitoring and Modifying Variables) (Forcing Variables) ( Enable peripheral outputs) "Program Status" (" ") STL SCL- SIMATIC S7- (Block Types) (Block Structure) (Block Properties) (Block Interface) (Addressing Variables) STL STL- STL STL, SCL SCL- SCL- ,

2-50 2-52 2-53 2-53 2-54 2-56 2-59 2-60 2-62 3-1 3-1 3-1 3-3 3-4 3-5 3-6 3-8 3-8 3-13 3-15 3-16 3-18 3-18 3-20 3-20 3-21 3-24 3-28 3-28 3-30 3-35 3-35 3-37

XIV

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

3.7 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5

3-39 3-39 3-41 3-41 3-42 3-45

4 4.1 4.2 4.2.1 4.2.2 4.2.3 4.2.4 4.3 4.4 4.4.1 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 5 5.1 5.2 5.3 5.3.1 5.3.2 5.3.3 5.4 5.4.1 AND () OR () Exclusive OR ( ) , ( ) AND- () OR () OR () Exclusive OR ( ) AND () AND () Exclusive OR ( ) OR () Exclusive OR ( ) (memory functions) Assign () Set ( ) Reset ( ) RS Flipflop (RS-) Reset ( ) Set ( ) Edge Evaluation ( )

4-14-3 4-3 4-7 4-8 4-10 4-10 4-11 4-13 4-14 4-14 4-16 4-17 4-18 4-18 4-19 5-1 5-1 5-3 5-4 5-4 5-5 5-5 5-7 5-8

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

XV

5.4.2 5.4.3 5.4.4 5.4.5 5.5 6 6.1 6.2 6.2.1 6.2.2 6.2.3 6.3 6.3.1 6.3.2 6.4 6.4.1 6.5 6.6 6.6.1 6.6.2 6.6.3 6.6.4 7 7.1 7.1.1 7.1.2 7.1.3 7.1.4 7.1.5 7.1.6 7.1.7 7.2 7.3 7.4 7.5 7.6XVI

(Binary Scaler) (move functions) Load ( ) Load Transfer ( ) Transfer (Accumulator Functions) accumulator 1 STRING (timer functions) (Resetting a timer) (Enabling a timer) () (Checking a timer) ( ) (Pulse timer) (Extended pulse timer) (On-delay timer) (Retentive On-delay timer) (Off-delay timer)

5-10 5-10 5-12 5-12 5-14 6-1 6-1 6-4 6-4 6-6 6-7 6-7 6-7 6-8 6-9 6-10 6-12 6-12 6-13 6-14 6-15 6-16 7-1 7-2 7-2 7-2 7-4 7-5 7-5 7-7 7-8 7-8 7-12 7-15 7-19 7-23

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

7.7 7.7.1 7.7.2 7.7.3 8 8.1 8.2 8.3 8.4 8.5 8.6 8.6.1 8.6.2 8.6.3 8.7

IEC- (IEC Timer Functions) SFB 3 TP SFB 4 TON SFB 5 TOF (ounter functions) (Counting) () (Checking a Counter) (Enabling a counter) IEC- (IEC Counter Functions) SFB 0 CTU SFB 1 CTD SFB 2 CTUD

7-26 7-28 7-28 7-29 8-1 8-2 8-3 8-4 8-5 8-8 8-9 8-10 8-11 8-11 8-12

9 9.1 9.2 9.3 10 10.1 10.2 10.3 10.4 10.5 10.6 10.7 11 11.1 11.2 11.3 11.4 INT DINT REAL Accumulator 1 (Arc-)

9-19-3 9-4 9-5 9-8 10-1 10-2 10-3 10-5 10-6 10-8 10-10 10-11 11-1 11-1 11-2 11-3 11-4

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

XVII

12 12.1 12.2 12.3 12.4 12.5 13 13.1 13.2 13.3 14 14.1 14.2

INT DINT BCD REAL (Word Logic)

12-1 12-2 12-3 12-4 12-5 12-7 13-1 13-2 13-4 13-7 14-1 14-1 14-4

15 15.1 15.2 15.3 15.4 16 16.1 16.2 16.3 16.4 16.5 16.6 16.7 17 17.1 17.2 17.3 17.4 (Status Bits) ( BR) RLO BR CC0 CC1 OV OS (Jump Distributor) (Loop Jump) MCR MCR- (MCR Dependency) MCR- (MCR Area) MCR- (MCR Zone) (I/O )

15-115-3 15-3 15-7 15-10 15-12 16-1 16-2 16-3 16-3 16-5 16-8 16-9 16-10 17-1 17-2 17-3 17-4 17-6

XVIII

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

18 18.1

(Block Functions)

18-1 18-1 18-2 18-3 18-4 18-6 18-6 18-10 18-14 18-15 18-16 18-19 18-20 18-21 18-21 18-24 18-25 18-25 18-25 18-26 18-26 18-26 19-1 19-1 19-1 19-1 19-2 19-5 19-6 19-6 19-11 19-16 19-17 19-17 19-19 19-20

18.1.1 : 18.1.2 CALL 18.1.3 UC CC 18.1.4 (Block End Functions) 18.1.5 18.1.6 18.2 18.2.1 18.2.2 18.2.3 18.2.4 18.2.5 18.2.6 , 18.3 18.3.1 18.3.2 18.3.3 18.4 Null- (-) 18.4.1 NOP 18.4.2 BLD 19 19-1 :

19-1.1 19-1.2 19-1.3 (declaration) 19-1.4 (declaration) 19-1.5 (Initialization) 19-2 19-3 19-4 19-5 ("Pass On")

19.5.1 : 19.5.2 : 19.5.3 :

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

XIX

20 20.1 (main program)

20-120-3 20-3 20-3 20-5 20-8 20-8 20-10 20-12 20-14 20-15 20-17 20-17 20-18 20-19 20-20 20-21 20-21 20-24 20-30 20-45 20-49 20-49 20-53 20-56 20-57 20-57 20-59 20-61 20-63 20-67 20-67 20-70 20-73

20.1.1 20.1.2 20.2 20.2.1 20.2.2 20.2.3 ("background scanning") 20.2.4 ("Response Time") 20.2.5 ("Start Information") 20.3 (Program Functions) 20.3.1 (Real-Time Clock) 20.3.2 (System Clock) 20.3.3 (Run-Time Meter) 20.3.4 CPU (Compressing CPU Memory) 20.3.5 20.3.6 20.4 20.4.1 (I/O) 20.4.2 (I/O) 20.4.3 (I/O) 20.5 20.5.1 20.5.2 GD- 20.5.3 GD- 20.6 SFC- 20.6.1 (Station-Internal) SFC- 20.6.2 20.6.3 (Station-External) SFC- 20.6.4 ("" SFC) 20.7 SFB- 20.7.1 20.7.2 (Two-way Data Exchange) 20.7.3 (One-way Data Exchange)

(ommunications) I/O 20-22

XX

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

20.7.4 (Print Data) 20.7.5 (Control Functions) 20.7.6 (Monitoring Functions) 21 21.1 21.2 (Hardware Interrupts)

20-74 20-75 20-77 21-1 21-1 21-4 21-4 21-5 21-6 21-6 21-7 21-9 21-10 21-10 21-12 21-13 21-15 21-15 21-17 21-17 21-19 21-21 22-1 22-1 22-1 22-2 22-3 22-4 22-5 22-5 22-6 22-6

21.2.1 21.2.2 21.2.3 STEP 7 21.3 (watchdog Interrupts) 21.3.1 (watchdog Interrupts) 21.3.2 (watchdog Interrupts) STEP 7 21.4. (time-of-day interrupts) 21.4.1 (time-of-day interrupts) 21.4.2 (time-of-day interrupts) STEP 7 21.4.3 (time-of-day interrupts) 21.5. c (time-delay interrupts) 21.5.1 c (time-delay interrupts) 21.5.2 c (time-delay interrupts) STEP 7 21.5.3 c (time-delay interrupts) 21.6 21.7 22 22.1

22.1.1 22.1.2 HOLD () 22.1.3 (disable) 22.1.4 22.2 (Power-Up) 22.2.1 STOP () 22.2.2 (Memory Reset) 22.2.3 (Retentivity)

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

XXI

22.2.4 22.3 22.3.1 (START-UP) 22.3.2 "" (Cold Restart) 22.3.3 "" (Complete Restart) 22.3.4 "" (Warm Restart) 22.4 22.5 23 23.1 23.2

22-7 22-8 22-8 22-9 22-11 22-12 22-13 22-15 23-1 23-2 23-3 23-3 23-6 23-6 23-7 23-7 23-8 23-12 23-12 23-13 23-14 23-15

23.2.1 23.2.2 23.2.3 23.2.4 23.2.5 "" ( - Substitute Value) 23.3 23.4

23.4.1 23.4.2 23.4.3 23.4.4

24 24.1

24-124-3 24-3 24-3 24-4 24-6 24-9 24-11 24-12 24-13 24-15 24-17 24-20

24.1.1 24.1.2 BOOL, BYTE, WORD, DWORD, CHAR 24.1.3 24.1.4 24.2 24.2.1 DATA_AND_TIME 24.2.2 STRING 24.2.3 ARRAY 24.2.4 STRUCT 24.3

XXII

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

24.3.1 , (UDT)

24-20

24.3.2 UDT 24-21 25 25.1 25-1 25-1 25-2 25-2 25-4 25-5 25-6 25-7 25-8 25-10 25-11 25-12 25-13 25-14 25-15 25-15 25-16 25-18 25-18 25-18 25-20 26-1 26-1 26-4 26-4 26-6 26-6 26-8 26-8 26-11 26-13

25.1.1 (area pointers) 25.1.2 DB (DB pointers) 25.1.3 ANY- (ANY pointer) 25.2 STL 25.2.1 25.2.2 (Indirect Addresses) 25.2.3 (memory-indirect addressing) 25.2.4 (Register-Indirect Area-Internal Addressing) 25.2.5 (Register-Indirect Area-Crossing Addressing) 25.2.6 25.3 25.3.1 25.3.2 25.3.3 25.3.4 25.4 25.4.1 AR1 25.4.2 AR2 25.4.3 26 26.1 26.2

26.2.1 26.2.2 26.2.3 26.3 26.3.1 26.3.2 26.3.3 "" ANY- (ANY-pointer)

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

XXIII

26.4

"Message Frame Example" ( )

26-16

SCL27 27.1 . SIMATIC

27-127-3 27-3 27-3 27-4 27-4 27-5 27-7 27-7 27-7 27-8 27-10 27-12 27-12 27-13 27-13 27-15 27-16 27-17 27-17 27-19 27-20 27-20 27-20 27-21 27-21 28.1 28.1 28.3 28.4 28.5 28.6 28.7 28.8

27.1.1 () 27.1.2 27.1.3 SCL- 27.1.4 (Symbol Table) 27.1.5 SCL- 27.1.6 SCL- 27.1.7 SCL- 27.1.8 27.1.9 (Data Type Veiws) 27.2 27.2.1 27.2.2 27.2.3 SCL 27.3 27.4

27.4.1 27.4.2 27.4.3 27.5 27.5.1 27.5.2 DT STRING 27.5.3 27.5.4 28 28.1 28.2 28.3 28.4 28.5 28.6 28.7 (Control Statements) IF CASE FOR WHILE REPEAT CONTINUE EXIT

XXIV

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

28.8 28.9 29 29.1 29.2

RETURN GOTO SCL- SCL-: SCL-

28.8 28.9 29-1 29-1 29-2 29-3 29-3 29-4 29-5 29-7 29-8 29-9 29-10 29-11 29-11 29-12 29-13 29-14 29-15 29-15 29-16 29-17 30-1 30-1 30-2 30-4 30-5 30-6 30-7 30-8 30-8 30-13 30-15 30-15 30-16 30-16XXV

29.2.1 FC 29.2.2 FC 29.2.3 FB 29.2.4 29.2.5 29.2.6 29.2.7 29.3 SCL- 29.3.1 FC 29.3.2 FC 29.3.3 29.3.4 29.3.5 29.4 EN/ENO 29.4.1 - 29.4.2 ENO (ENO output) 29.4.3 EN (EN input) 30. 30.1 30.2 30.3 30.4 30.5 SCL- (Shifting) (Rotating) (Conversion Functions)

30.5.1 (Implicit Conversion Functions) 30.5.2 (Explicit Conversion Functions) 30.6 30.7 30.8 SCL STL SCL

30.8.1 "Conveyor" ("") 30.8.2 30.8.3 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

31 31.1 31.2 31.3 31.4 31.5

IEC- (Conversion Functions) (Comparison Functions) STRING (STRING Functions) Date/Time-of-Day (Date/Time-of-Day Functions) (Numerical Functions)

31-1 31-2 31-4 31-8 31-11 31-14

32 32.1 32.2 S5/S7-

32-132-3 32-3 32-5 32-5 32-6 32-8 32-10 32-11 32-11 32-13 32-13 32-14 32-17 32-17 32-18 32-19 32-19 32-21 32-21 32-23 32-23 32-23 33-1 33-1 33-3 33-9 33-11 33-15Automating with STEP 7 in STL and SCL STEP 7 STL SCL

32.2.1 (PLC) 32.2.2 32.2.3 32.2.4 32.3 32.3.1 32.3.2 32.3.3 32.3.4 32.4 32.4.1 STEP 7 32.4.2 32.4.3 32.4.4 32.4.5 " " 32.4.6 32.4.7 32.4.8 32.4.9 33 33.1 33.2 33.3 33.4 33.5XXVI

() (SFB) IEC- S5-S7- TI-S7-

33.6 33.7 34 34.1

- STL-

33-16 33-16 34-1 34-2 34-2 34-3 34-3 34-4 34-5 34-5 34-5 34-5 34-6 34-6 34-7 34-7 34-8 34-8 34-9 34-9 34-10 35-1 35-1 35-2 35-2 35-3 35-3 35-4 35-5 35-6 35-7 36-1 37-1 38-1

34.1.1 34.1.2 34.1.3 34.1.4 34.1.5 34.2 34.2.1 34.2.2 34.2.3 34.2.4 34.2.5 34.2.6 34.3 34.3.1 34.3.2 MCR 34.3.3 34.4 35 35.1 35.2 35.3 35.4 SCL- CSL

35.4.1 35.4.2 35.4.3 35.4.4 35.4.5 STEP 7

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

XXVII

SIMATIC S7300/400. SIMATIC S7-300/400 . , , ( CPU) . SIMATIC S7 / (I/O) . CPU, , . (load memory) : , ( ), (work memory), , . STEP 7 S7-300/400. , SIMATIC Manager. SIMATIC Manager , Windows 95/98/NT , . SIMATIC Manager , , , . , STEP 7. SIMATIC S7 , , , , . . STEP 7 , (BOOL), (INT REAL) , ( ).

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1- 1

S7-300/400. STEP 7 . STEP 7 5.1. 3 " SIMATIC S7" S7- STL SCL. STL SCL . .

1

SIMATIC S7-300/400 ; (I/O); ; ; . STEP 7 SIMATIC Manager; ; ; ; ( , ); ; . SIMATIC S7 ; ; ; STL SCL; ; ( ).

2

3

1- 2

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1. SIMATIC S7-300/400

1 SIMATIC S7-300/400

1.1 1.1.1 SIMATIC S7-300/400 :

(Rack): . (PS "power supply"): . (CPU "central processing unit"): . (IM "interface module"): . (SM "signal module"): , , . (FM "function module"): CPU, . (CP "communication processor"): . : . ( ) , . , CPU I/O ( SM, FM CP) . I/O I/O , , (. . 1). / (. 1.2, " I/O").

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1- 3

1. SIMATIC S7-300/400

: / (I/O P-) ( K-). I/O- , . CPU (MPI) .

1.1.2 S7-300 S7-300 8 / . , CPU 314 : , ( IM 365 ); , 4 , .. , 3 ( IM 360 IM 361 ). . , 1.2 ( CPU 312 IFM 0.8 ). , P- K-. FM 356 M7-300. FM-356 "" , " " . , . SIMATIC SIMATIC S7-300 . : (-25+60), , IEC 68 2-6; , IEC 721-3-3 Class 3 K5, / EN 50155 ( ). .1- 4 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1. SIMATIC S7-300/400

S7-300

: IM 460-1 IM 460-0 IM 460-3 IM 463-2 5 ; : 1.5 (IM 461-1) 5 ; : 3 (IM 461-0) 5 ; : 100 (IM 461-3) S5; : 600 (IM 314)

S7-400

. 1.1 S7-300/400Automating with STEP 7 in STL and SCL STEP 7 STL SCL 1- 5

1. SIMATIC S7-300/400

1.1.3 S7-400 S7-400 : 18 9 ( UR1 UR2), CPU, ( ). IM 460-1 IM 461-1 5- 1.5 . , IM 460-0 IM 461-0 4 3 . , IM 460-3 IM 461-3 4 100 . 21 . . P- K-. ER1 ER2 ( 18 9 ) "" , , 24- P-, K. K- UR1, UR2 CR2 , 1 6. CR2. CR2 . CPU , P- , K-. S7-400 ( ) CPU. CPU ( ). 20.3.6 " " 21.6 " ".

1- 6

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1. SIMATIC S7-300/400

SIMATIC S5 IM 463-2 S7-400 SIMATIC S5 (EG 183U, EG 185U, EG 186U, ER 701-2 ER 701-3), . IM 314 SIMATIC S5 . , . S7-400 IM 463-2; IM 463-2, , S5 . SIMATIC S7-300/400, , . " ", , . , , "" . , , . / (I/O) (ET 200M IM 1533 PROFIBUS-DP). () ("Software Redundancy"). SIMATIC S7-400H SIMATIC S7-400H , , H CPU . " "; . / (, ) ( ET 200M). . , ; . () "S7-400H".Automating with STEP 7 in STL and SCL STEP 7 STL SCL 1- 7

1. SIMATIC S7-300/400

1.1.4 CPU 1.2 CPU, . , (load memory) (work memory). (load memory) CPU . , , (load memory) . (work memory) CPU RAM-. : . "" , , , . (offline) (offline) (CPU) ( ) ( ) () CPU S7-400 () I/O

. 1.2 CPU1- 8 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1. SIMATIC S7-300/400

, , (load memory). CPU "" (. ) (work memory). CPU, (load memory) (work memory) ( . 2.6.4 " CPU" 2.6.5 " "). (load memory) RAM-, , CPU. (load memory) EEPROM- EPROM -, CPU . (load memory) CPU 3xxIFM RAM EEPROM . RAM- , EEPROM-, . (load memory) CPU S7-300 ( CPU 318) RAM-, . EPROM - , . CPU S7-300 ( ) (, , ) . . RAM- CPU S7-400 . , (load memory), RAM- . EPROM - . CPU S7-400 (work memory) . STEP 7 V5.1, CPU S7-400, (load memory) CPU (. 2.2.2 ", ").

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1- 9

1. SIMATIC S7-300/400

1.1.5 : RAM- EPROM -. (load memory), RAM- (, CPU S7-400). RAM- . , RAM- . - , , EPROM -. , EPROM - . CPU , EPROM - CPU.

1.1.6 (), . ( ), , CPU, . , , , , , () . CPU : (I): " " . (Q): " " . (M): , . (): , . (): .1- 10 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1. SIMATIC S7-300/400

(L) . L-, CPU . , , , . . ( ). , , S7-400 .

1.2 I/O (/) PROFIBUS-DP " " . " " " DP" (DP-master), " DP-" (DP-slave). / (I/O) , PROFIBUS-DP PROFIBUS. PROFIBUS-DP EN 50170 DP-. 1.3.2 "". DP- DP- " DP-" (DP-master system). 32 127 . DP- , DP-. PROFIBUS-DP , , , - , ET 200 DP- SIMATIC S5.

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1- 11

1. SIMATIC S7-300/400

1.2.1 DP- DP- (mono master system) PROFIBUS-DP DP ("mono master system"); DP DP-. DP- , , . DP- DP " DP-" ("DP-master system") (. . 1.3).S7- DP-, , CPU 318-2DP

, , ET 200B

PROFIBUS-DP DP/PA (DP/PA link)

, , ET 200M

PROFIBUS-PA DP/RS232C (link) DP/PA (DP/PA coupler) PROFIBUS-PA DP/AS- (DP/AS-Interface link) AS-

, , CPU 315-2DP

. 1.3 DP- (DP-master system)

1- 12

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1. SIMATIC S7-300/400

DP- (multi master system) PROFIBUS-DP DP- ("multi master system"). , DP-; , , DP "" DP-, DP- "" DP- . . DP- , DP DP-. S7- DP-, DP- . CPU " DP-".

1.2.2 DP- (DP Master) DP- (DP Master) PROFIBUS. "" DP-. DP- : CPU DP- (, CPU 315-2DP, CPU 417). CPU (, IM 467). CP CPU (, CP 3425, CP 443-5).

" DP- 1 ", , " DP- 2 ", (, ).

1.2.3 DP- (DP Slaves) DP- (DP Slaves) PROFIBUS. SIMATIC S7 DP-: , DP-. , (). , .

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1- 13

1. SIMATIC S7-300/400

PROFIBUS DP- DP- : ET 200B ( / / , IP 20 , 12 /); ET 200C ( , IP 66/67, / / , , 1,5 / 12 /); ET 200L-SC (- / / , IP 20 , 1,5 /); , DP/AS-I (DP/AS-I Link), DP- PROFIBUS-DP. PROFIBUS DP- DP- ET 200M. S7-300, DIN, , IM 153 CPU 8 (SM) (FM). 9,6 / 12 /). ET 200M , DP- S7-400. , / S7-300 , . . , .. . ET 200M IM 153-3 DP- . IM 1533 : - DP- () - DP . PROFIBUS DP- () DP- S7-300, CPU DP, (slave) ( , CPU 315-2DP), S7-300 CP 342-5 (slave) .

1- 14

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1. SIMATIC S7-300/400

DP- ET 200X BM 147/CPU. 7 . "" "" BM 147/CPU, S7- . / / , (load feeders), 400 5,5 . 9,6 / 12 /.

1.2.4 PROFIBUS-PAPROFIBUS-PA PROFIBUS-PA ("Process Automation" [ ]) ( Ex-, , , ), (, ). PROFIBUS-PA EN 50170, 2 (PROFIBUS-DPA); IEC 1158-2. PROFIBUS-PA: PROFIBUS-DP

DP/PA (DP/PA coupler), , PROFIBUS-DP , 45,45 /. DP/PA (DP/PA link), PROFIBUS-DP PROFIBUS-PA.

DP/PA (DP/PA coupler) DP/PA (DP/PA coupler) PA- PROFIBUS-DP. PROFIBUS-DP DP/PA DP- , 45,45 /. DP/PA 31 PA- . "" PROFIBUS-PA , 31,25 /. PROFIBUS-PA PROFIBUS-PA (shared). DP/PA : DP/PA -Ex 400 DP/PA Ex 100 .

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1- 15

1. SIMATIC S7-300/400

DP/PA (DP/PA link) DP/PA (DP/PA link) PA- PROFIBUS-DP 9,6 / 12 /. DP/PA IM 157 5 DP/-, () SIMATIC S7. , PROFIBUS-PA, PROFIBUS-PD . DP/PA 31 PA- . SIMATIC DPM SIMATIC DPM (Process Device Manager [ ], : "SIPROM") , , , PROFIBUS-PA HART (Highway Addressable Remote Transducers [ ]). - DDL (Device Description Language [ ]). SIMATIC DPM "" , Windows 9x/NT, STEP 7.

1.2.5 AS-AS- AS- ("Actuator-Sensor Interface" ("AS-i") [ -]) . AS-i , 31 AS-i. AS-i-, , . AS-i AS-i , 8 ("normal" - "") . AS-i 100 , ( AS-i ) ( AS-i , AS-i).

1- 16

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1. SIMATIC S7-300/400

AS-i (AS-i master) AS-i (AS-i master) AS-i , 5 . AS-i SIMATIC S7 CP 342-2 PROFIBUS-DP DP/AS- (. . 1.4).P 342-2 S7-300 PROFIBUS-DP DP/AS- (DP/AS-Interface link) AS- DP/AS-i 4 AS-i ASIC : DP/AS-i 8 / AS-i ASIC DP/AS-i DP/AS-i DP/AS-i DP/AS-i (DP/AS-i distributor) DP/AS-i

. 1.4 SIMATIC S7 AS-i CP 342-2 AS-i S7-300 ET 200M. : CP 342-2 / . 16 16 ( 256). AS-i CP, . AS-i. FC, ( , / , ). DP/AS- (DP/AS-Interface link) AS-i AS-i PROFIBUS-DP. PROFIBUS-DP DP, AS- AS-i , 31 AS-i . AS-i DP/AS- 16 16 . - 12 /.Automating with STEP 7 in STL and SCL STEP 7 STL SCL 1- 17

1. SIMATIC S7-300/400

DP/AS- : ( 65) IP 66/67 ( 20) IP 20 , 20 .

1.2.6 PROFIBUS-DP/RS 232C (PROFIBUS-DP/RS 232C link) RS 232C (V.24) PROFIBUS-DP. DP/RS 232C RS 232C PROFIBUS-DP. DP/RS 232C 3964R ASCII. DP/RS 232C " ". . 224 . PROFIBUS-DP 12 /; RS 232C 38,4 / , , 8 1 -.

1.3

(ommunications) - SIMATIC S7. . - CPU. CP ( SIEMENS) . SIMATIC NET - , SIMATIC. SIMATIC NET , HMI (- ). SIMATIC .

1.3.1 1.5 . SIMATIC ( SIEMENS) . . SIMATIC S7 CPU MPI , . , (CP), .

1- 18

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1. SIMATIC S7-300/400

. - ( ). "" (" "), (""). , S7 S7- .

SIMATIC S7 CPU ID - DB ID SD SFB

SIMATIC S7 CPU ID - DB ID RD SFB

(Subnet)

. 1.5 SIMATIC S7 - . , . , , ; , . SIMATIC : MPI, PROFIBUS, Industrial Ethernet PTP ("point-to-point" [ " "]). (communications service) (communications service) , , . , .Automating with STEP 7 in STL and SCL STEP 7 STL SCL 1- 19

1. SIMATIC S7-300/400

SIMATIC : S7, PROFIBUS-DP, PROFIBUS-FMS, PROFIBUS-FDL (SDA), ISO transport, ISO-on-TSP . (connection) ( ). ( ) , , , (, ) . SIMATIC : S7, S7- (), "point-to-point" [ " "], FMS- FDL-, "ISO transport"-, "ISO-onTSP"- TSP-, UDP- E-mail-. (communications functions) . SIMATIC S7 CPU . ( Siemens) . 1.1 , .

1.3.2 - . SIMATIC Manager. : MPI SIMATIC . PROFIBUS ; /. Industrial Ethernet PLC . PTP (" ") .

1- 20

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1. SIMATIC S7-300/400

1.1 MPI CPU (GD) SFC SFB ( S7-400) PROFIBUS-DP ( ) SFC IM 467 PROFIBUS-DP ( ) SFC CP 342-5 CP 443-5 Extended () PROFIBUS-FDL, PROFIBUS-DP ( ) SFC SFB ( S7-400) PROFIBUS-FMS, PROFIBUS-FDL SFC SFB ( S7-400) ISO TCP / IP SFB ( S7-400) ISO TCP / IP IT- SFB ( S7-400) , GD- SFC , SFB , / , SFC SFC , / , SFC SFC NCM, , SEND / RECEIVE SFC , SFB NCM, FMS- , SEND / RECEIVE SFC , SFB NCM, , SEND / RECEIVE , SFB NCM, , SEND / RECEIVE , SFB

PROFIBUS

CPU DP-

CP 343-5 CP 443-5 Basic ()

Industrial Ethernet

CP 343-1 CP 443-1

CP 343-1 IT CP 443-1 IT

NCM - CP; NCM PROFIBUS Industrial Ethernet.

STEP 7 V.5 SIMATIC S7 , , , . () S7 . MPI CPU ("multipoint interface", MPI [" "]). CPU, PG, HMI ( ) Siemens.Automating with STEP 7 in STL and SCL STEP 7 STL SCL 1- 21

1. SIMATIC S7-300/400

MPI : " " - . 50 . 1100 RS485 100 (optical link modul). 187,5 /. 32 . . ( "token passing" [ ""]). MPI CPU : , SFC SFB. . PROFIBUS PROFIBUS ("PROcess FIeldBUS") " ". PROFIBUS , EN 50170, . PROFIBUS : " " - . ; 100 (12 /) 1000 (9,6 /). (optical link modul). 127 . . . ( "token passing" [ ""]). (slaves) (master), , . . PROFIBUS; PROFIBUS-DP. CPU DP- . PROFIBUS SFC SFB. CP PROFIBUS-FMS PROFIBUS-FDL. (FMS- SEND/RESEIVE-).1- 22 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1. SIMATIC S7-300/400

Industrial Ethernet Industrial Ethernet - IEEE 802.3. Industrial Ethernet , " " ("industrial") - . 1,5 , 4,5 . 10 /. Industrial Ethernet 1000 . , , , . , , , , ( "CSMA/CD"). . Industrial Ethernet : S7- SFB. Industrial Ethernet CP, ISO transport ISO-on-TCP, SEND/RESEIVE. Point-to-point " " ("Point-to-point", PTP) . "point-to-point" SIMATIC Manager. . RS 232C (V.24), 20 (TTY) RS 422/485. 20 300 / 19,2 /, RS 232C RS 422/485 - 76,8 /. ; 10 RS 232C, 1000 20 9,6 / 1200 RS 422/485 19,2 /. 3964 (R), RK 512, ASCII (), . . AS- AS- ("AS-Interface", AS-i) IEC TG 178 AS- c . AS- SIMATIC Manager; AS-i (AS-I master) .

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1- 23

1. SIMATIC S7-300/400

AS-Interface " ", ( ). 300 . 167 /. AS-I (master) 31 (slave) .

1.3.3 (communications services) , . , : S7- - SIMATIC. S7- CPU, () , HMI . : (PG): , ; PG , , "monitor variables" . - (HMI): (OP), , / . SFB- (SFB-communications): ; SFB ; , . SFC- (SFC-communications): 76 ; SFC ; , . S7- MPI, PROFIBUS Industrial Ethernet. (Global data communications) CPU . . "" ( ); . . MPI- -.

1- 24

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1. SIMATIC S7-300/400

PROFIBUS-DP . " " EN 50170 2. , SIMATIC S7 PROFIBUS. PROFIBUS-FMS (Fieldbus Message Specification [" "]) (FMS-) EN 50170 2. PROFIBUS. PROFIBUS-FDL (Fieldbus Data Link [" "]) SDA (Send Data with Acknowledge [" "]) EN 50170 2. . PROFIBUS , , SIMATIC S5. ISO transport ISO 8073 Class 4. . ISO transport , , SIMATIC S5 Industrial Ethernet. ISO-on-TSP TCP/IP RFC 1006. Industrial Ethernet.

1.3.4 (connections) - . ; ("Communications via non-configured connections" - " "). . (connection table). ("Communications via configured connections"- " "). . "Connection type" (" ") (. 2.4 " "). (GD) PROFIBUS-DP SFC- (SFC-communications) S7-. GD GD; PROFIBUS-DP SFC- .Automating with STEP 7 in STL and SCL STEP 7 STL SCL 1- 25

1. SIMATIC S7-300/400

(Connection resources) - "" CP. , , S7 MPI- CPU, CPU; MPI- CP () CP CPU. CPU . PG ( ). " " (SFC-).

1.4

1.4.1 PLC (. . 1.6). +HP01 -S10 I/O n

0

0 4

0 1 2 3 4 5 6 7 4 5

7 0 n+1

7 0 5

7

7

5 A A

DI 16

I 4

"Switch motor on"

BOOL

I 5.2

"Switch motor on" / I 5.2 /

1- 26

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1. SIMATIC S7-300/400

, , +HP01-S10, ("Switch motor on" - " "), , . "", I/O- (, 5, 2). CPU " ", ("input") (, I 5.2). "I 5.2" . , (, "Switch motor on"). "Switch motor on" .

1.4.2 ( S7-). . (" "). , . , . , I/O " ", DP . "Hardware Configuration" , S7-, . (. 2.3 " ").

1.4.3 , , , ( I/O-). / 0 , , CPU. , / (S7-). . (" "). () 8 (.. ). 0, 1, 2 3; . , 8 8, 9, 10 11 .Automating with STEP 7 in STL and SCL STEP 7 STL SCL 1- 27

1. SIMATIC S7-300/400

( ), "" ("channel"), 2 . , 2, 4, 8 16 , 4, 8, 16 32 . ( ) CPU , , . ( ) 0. . S7-3xx DP-, S7-318 S7-400 . . . , () I/O. I/O . DP- , ( ) . DP- I/O , SFC 14 DPRD_DAT SFC 15 DPWR_DAT. , "Input" ("") "Output" (""). , FM CP .

1.4.4 , . ( ), . , , , , , , . I/O . 0; ( ), CPU . STEP 7 , I/O. 1- 28 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1. SIMATIC S7-300/400

. ; (. 20.4.1 " ").

1.4.5 , DP- (, DP- ) PROFIBUS , . MPI- , MPI- (, CPU, FM CP), MPI-. PG, HMI . , S7-300 FM CP, , MPI-, MPI- CPU. CPU 318 MPI- , MPI-. .

1.5

: ; ; ; (. 7 " " 8 " "); L- ( 18.1.5 " ").

( ) , .

1.5.1 SIMATIC S7 : , LOAD TRANSFER .

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1- 29

1. SIMATIC S7-300/400

, , I/O. () . . / . , , (). . , 1, 2, 4 . 0. 0 ; . I/O , PI- ("peripheral inputs") ( ) PQ- ("peripheral outputs") ( ). , CPU . . PI- . 0- I/O, CPU. (Direct I/O Read) , (, ). , , . . , , . , . . PQ- . 0- I/O, CPU. (Direct I/O Write) , (, ).

1- 30

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1. SIMATIC S7-300/400

, , . . , (!), , .

1.5.2 ( ) ( ) , , . (I), (Q). , . , , . 20.2.1 " ". S7-300 CPU , 1998 ., S7-400 CPU , , , . , . CPU, , CPU 417, . , , , (work) . CPU (work) , . - . - , . CPU . : (I/O ). , (, - I/O , , , ). , . ( ). .Automating with STEP 7 in STL and SCL STEP 7 STL SCL 1- 31

1. SIMATIC S7-300/400

, , , RAM-. , . , . . (. 20.2.4 " "). - . - , . CPU . : ( I/O ). , (, - I/O , , , ). , . . . , , , RAM-, , . . . 20.2.4 " " , .

1.5.3 " " . . . CPU, , , . CPU. , , . : , , . , , .

1- 32

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1. SIMATIC S7-300/400

, , . 0- . CPU. 22.2.3 "". . ( ), (watchdog) ( ) . - , /, 1:1. , , (. .1.7). CPU. , .

7

6

5

4

3

2

1

0

10 5 ( [flickering light]) 2,5 ( [fast flashing light]) 2 1,25 ( [flashing light]) 1 0,625 ( [slow flashing light]) 0,5

.1.7

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

1- 33

1. SIMATIC S7-300/400

1- 34

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2 STEP 72.1 STEP 7 (STEP 7 Basic Package) STEP 7 (STEP 7 Basic Package) 5.1. , , . STEP 7 (STEP 7 Basic Package) : STL ("statement list" - ), LAD ("ladder diagram" - ), FBD ("function block diagram" - ). S7-SCL ("Structured Control Language" ), S7-GRAPH ( SIMATIC ), S7-HiGraph ( SIMATIC ).

2.1.1 STEP 7 V 5 32- , : Microsoft Windows 95 ( Service Pack 1, 4.00.950), Windows 98 Windows NT ( Service Pack 2, 4.00.1381). STEP 7 Windows 95/98 (PG) () 80486 32 ( : Pentium 64 ). Windows NT Pentium 32 ; STEP 7 Windows NT. STEP 7, , , , 100 , PG . STEP 7 V 5 200 380 (, ) . ( 128 256 ).

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2- 1

2. STEP 7

, . , , . . Windows. STEP 7 SETUP Windows 9x/NT, -. PG STEP 7 . STEP 7 - (. ), NCM STEP 7 Acrobat Reader V3.01. MPI-. PG MPI-, MPI-. , . STEP 7 V 5 , , , , . Windows SIMATIC Workstation. .

2.1.2 STEP 7 ( ). . STEP 7 , . , . , - . , , - , ( ) " " (emergency license), - ( ).

2.1.3 SIMATIC ManagerSIMATIC Manager STEP 7. Windows: SIMATIC Manager .

2- 2

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

" " (Project Wizard). . , Check box "Display Wizard on starting the SIMATIC Manager" (" - SIMATIC Manager"). - : File () -> "New Project" Wizard. ("project"). . ZEn01_09_S7_ZEBRA : File () -> Open (), : (), (.2.1).

.2.1 SIMATIC Manager "+" ; . SIMATIC Manager STEP 7. "" , SIMATIC Manager, "" (). () , (station) (PLC).

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2- 3

2. STEP 7

Project MPI [PTP, PROFIBUS, Ethernet] SIMATIC 300/400 station

Subnet ()

Configuration table Hardware ( ) ( ) CPU xxx Connections () S7 program Symbols () Sources CPU Connection table ( )

Symbol table ( ) ( ) GD

(STL-, SCL-)

Source programs Source files ( ) ( ) Blocks OB n FB n FC n DB n SFC n SFB n System data ( ) UDT n VAT n S7 program

. , CPU Data types ( ) Variable table ( ) ,

, CPU ( , S 7-, CPU)

.2.2 STEP 7 , , , MPI. CPU, CPU S7-. , Blocks (), .2- 4 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

STEP 7 . . 2.2 ("main branch" - " "), S7 (offline view). , , . (offline view) . PG. PG (online) CPU ( PLC), (online view), : View -> Online ( -> ). , ; , , . , (online) (offline) . . : Options -> Customize ( -> ) "View" (""). : Options -> Customize ( -> ), SIMATIC Manager, session language (), , . : - , . - (. ) , , , , : Edit -> Object Properties ( -> ), . , CPU, (), (Hardware Configuration). - , , , SIMATIC Manager , , SIMATIC Manager (, ). . , . . .Automating with STEP 7 in STL and SCL STEP 7 STL SCL 2- 5

2. STEP 7

2.1.4 (Project(s) Library(ies)) STEP 7 " ", , (project) (library). (projects) . : ; ; ; ( , , ). . . . (library) . . STEP 7 , ( ), . (online) ( ), . STEP 7 V5 Standard Library, : System Function Blocks ( ), , CPU; S5-S7 Converting Blocks ( S5-S7 ), S5-S7 ( S5 ); T1-S7 Converting Blocks ( TI-S7 ), TIS7 ; IEC Function Blocks ( IEC), DATE_AND_TIME STRING; Communication Blocks ( ), CP;

PID Control Blocks ( -), ;

Organization Blocks ( ), ( ). 33 " ".2- 6 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

S7- , . . : File -> Open ( -> ), . . : File -> New ( -> ) ( ). ( ) : Options -> Customize ( -> ) New (). Insert () (, ). , , SIMATIC Manager. : Edit -> Copy ( > ) Edit -> Paste ( -> ) , Windows, "drag-n-drop", . , , SIMATIC Manager.

2.1.5 (Online Help ) (Online Help) SIMATIC Manager , . , Help (). Getting Started (), , SIMATIC Manager. : Help -> Contents ( -> ) STEP 7 . . : Help -> Context-Sensitive Help F1 ( -> ) , F1, , "" , , . , . (, ), .

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2- 7

2. STEP 7

2.2 "" ("") , . , , ( , CPU) . , S7 - . , ( , CPU, ) Hardware Configuration tool. , SIMATIC Manager. , , (!) Windows Explorer () SIMATIC Manager.

2.2.1 Project Wizard ( ) STEP 7 V3.2 STEP 7 Wizard . CPU, - S7- CPU, S7-, . S7- "", , . 2.1.3 "SIMATIC Manager" . : File -> New ( -> ), , , , "" "Enter". : Insert -> Station -> Simatic 300 Station ( -> -> S7-300) ( S7-300).

2- 8

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

, project ; SIMATIC Manager Hardware () . Hardware Hardware Configuration, . , : View -> Catalog ( -> ). (rail), , "SIMATIC 300" "RACK 300" "drag-n-drop" (station window). , . , "drag-n-drop", . CPU, , CPU 314 2. . 2.3 " ". , SIMATIC Manager. CPU. CPU SIMATIC Manager S7 . . S7- CPU; S7- (S7-program) (connection table). S7-program; SIMATIC Manager (Blocks - ), . (Blocks - ); SIMATIC Manager (System data - ) (main) (OB1) . . 1 . : Insert -> S7 Block -> (Blocks ) . System data ( ) . .

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2- 9

2. STEP 7

Hardware () Station (). System data ( ) CPU, : PLC -> Download (PLC -> ), CPU. Source Files ( ) . Source Files : Insert -> S7 Software -> STL Source File ( -> S7 -> STL- ) Source Files , ASCII ( STEP) , : Insert -> External Source File ( -> ). S7- , . . S7-, : Insert -> Program -> S7 Program ( -> -> S7- ). S7- SIMATIC Manager Symbols () Sources ( ) Blocks (). Blocks () OB 1. library (), , . , . , (online) , S7- .

2.2.2 , SIMATIC Manager " " ("main objects"), , () . () STEP 7 . File -> Rearrange ( -> ) SIMATIC Manager , , . , . : File -> Archive ( -> ). SIMATIC Manager ( ) . , . STEP 7 ARJ PKZIP 2.50, (, winzip, 6.0, pkzip, 2.04g, JAR, 1.02 LHARC, 2.13).2- 10 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

, () . "" : File -> Retrieve ( -> ), . . "Archive" (""), : Options -> Customize ( -> ). "Generate archive name automatically" (" "), /, . CPU STEP 7 V 5.1, S7400 CPU () CPU, . , , , , , . , , CPU. , CPU, , CPU PLC -> Save Project on Memory Card (PLC -> ). : PLC -> Retrieve Project from Memory Card (PLC -> ). , , CPU, , . , CPU, , CPU PLC -> Display Accessible Nodes (PLC -> ). PG, : File -> S7 Memory Card -> Open ( -> S7 -> ) .

2.2.3 (Project Versions) SIMATIC. STEP 7 V1 1, STEP 7 V2 2, STEP 7 V3/ V4/ V5.0 - 2 3. STEP 7 V5.1 3 3.

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2- 11

2. STEP 7

1 2, : File -> Open Version 1 Project ( -> 1). , 1, STL-, . 2 STEP 7 V2, V3, V4 V5.0 (. .2.3). STEP 7 V1 1 (V1)

STEP 7 V5.1 File -> New -> project ( -> -> ) V3

: File -> Open Version 1 Project ( -> 1) V1 V2

File -> Open ( -> ) V2 V3

3 (V3) 3 (V3)

2 (V2) 2 (V2)

File -> New -> project 2. ( -> ) V2 File -> Save as ( -> ) V2 V3 V2 V3

STEP 7 V2

STEP 7 V3/ V4/ V5.0

.2.3 STEP STEP 7 V5.1 3. , V1 V2, : File -> Open Version 1 Project ( -> 1). 2, : File -> Open ( -> ). , V2.2- 12 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

2.3 Hardware Configuration. (offline), .. CPU. . . : Edit -> Open Object ( -> ) (Hardware object) SIMATIC 300/400 Station. (basic settings) , : Options -> Customize ( -> ). : Station -> Consistency Check ( -> ). : Station -> Save ( -> ) . : Station -> Save and Compile ( -> ) , System data ( ) "" (offline) Blocks (). CPU, : PLC -> Download (PLC -> ). System data ( ) "" (online) Blocks () CPU. "" , : PLC -> Upload (PLC -> ). , : Station -> Export ( -> ). STEP 7 ASCII , . , , () . ASCII . (Checksum) Hardware Configuration . , "" (offline) "" (online) . (Checksum) System data ( ).Automating with STEP 7 in STL and SCL STEP 7 STL SCL 2- 13

2. STEP 7

Blocks () S7, System data ( ) : Edit -> Open Object ( -> ). . Blocks (): Blocks (), : Edit -> Object Properties ( -> ) "Checksums" ( ). (Station) Hardware Configuration (. . 2.4).

. 2.4 , Hardware Configuration () . DP- . , , PROFIBUS, DP. , DP, .2- 14 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

(Hardware) : View -> Catalog ( -> ). , , , STEP 7. : Options -> Edit Catalog Profile ( -> ) , , . "" . (Configuration table) Hardware Configuration , , DP-. , , . (properties), .

2.3.1 "" "drag-n-drop" , , "SIMATIC 300" "RACK 300" . . . , "No Parking" (" ") , . S7-300 3 : . . S7-400 ( : ) "Link" () ("Properties") ("Send") IM. , : Edit -> Object Properties ( -> ). I/O 20.4.2 " I/O".

2.3.2 Hardware Configuration .

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2- 15

2. STEP 7

. S7-400 CPU S7-300 CPU DP- . S7-400 S7-300, . , , () . , ; . S7-400, . , , CPU. : View -> Address Overview ( -> ) CPU. MPI MPI-. . , , MPI- , CPU. , Hardware Configuration () , (Symbol Table). . ( ) : Edit -> Symbols ( -> ) , , ( ). "Add Symbol" (" ") . "Apply" ("") (Symbol Table). "OK" .

2.3.3 . , , . , . , 2- 16 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

: Edit -> Object Properties ( -> ). . CPU . SFC 55 WR_PARM, SFC 56 WR_DPARM SFC 57 PARM_MOD.

2.3.4 MPI MPI- (Module Properties). CPU MPI, , , : Edit -> Object Properties ( -> ). "General" ("") "Properties" () "Interface" (). , "Parameter" (), . MPI-, CPU. , S7-300 CPU, FM CP MPI- MPI- , CPU. MPI- MPI-, ( FM CP!). . : CPU , CPU (). "CPUxxx(1)", MPI-. CPU, , .. "CPUxxx(1)" "CPUxxx(n)", "n" MPI-. MPI- MPI- PG () . PG () MPI-; (spur-line) - MPI- . : 0 , 1 3 - CPU ( , ).

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2- 17

2. STEP 7

2.3.5 Monitor () Modify () Hardware Configuration . , (online) , CPU. . , : PLC -> Monitor/Modify (PLC -> /) . "Status Value" ( ) Hardware Configuration . "Modify Value" ( ) , "Modify Value". checkbox "I/O Display" ( I/O), / / ( ). checkbox "Enable Periph Outputs" ( ), , CPU STOP (. 2.7.5 " "). 2.7.3 " " 2.7.4 " ".

2.4 (Network) SIMATIC S7-. . SIMATIC Manager. ( CPU CP), Hardware Configuration; . - (connection) Network Configuration (connection table). Network Configuration . Network Configuration ; ("node properties") .

2- 18

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

(connections) Network Configuration : MPI-, . , : Insert -> Subnet ( -> ). Network Configuration , , . station () .

. , . (communication connections) (connection table), . Network Configuration: MPI : Options -> Define Global Data ( -> ) (. 20.5 " "). : Network -> Save ( -> ) . : Network -> Consistency Check ( -> ). : Network -> Save and Compile ( -> ). Network () Network Configuration . SIMATIC Manager MPI-. Network Configuration. , Connections () CPU. . 2.5 Network Configuration, () (connections). (connection table) . , , , , S7-400 CPU. SIMATIC , DP-. : View -> Catalog ( -> ). "" .Automating with STEP 7 in STL and SCL STEP 7 STL SCL 2- 19

2. STEP 7

. 2.5 Network Configuration : View -> Zoom In ( -> ), View -> Zoom Out ( -> ) View -> Zoom Factor ( -> ) .

2.4.1 (Network View) "" . . .2- 20 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

, . "". Hardware configuration, , , () . (Network Configuration). , , , . , "" . . . . . , . : Edit -> Object Properties ( -> ) . "General" () S7 (ID). ID - . ID S7- (online) , . (network properties) "Network Settings" (" "), , (data transfer rate) (highest node address). (network connection), : Edit -> Object Properties ( -> ), , (node address) (subnet), , . "Interfaces" ("") . ( Hardware Configuration).

2.4.2 DP- Network Configuration Network Configuration I/O. Automating with STEP 7 in STL and SCL STEP 7 STL SCL 2- 21

2. STEP 7

: View -> with DP Slaves ( -> DP-), (slave) DP (Network View). DP- : PROFIBUS ( , "" PROFIBUS ).

DP- (master) ( , "" , DP- Hardware Configuration CPU , ). (connection) DP- PROFIBUS ( Hardware Configuration, DP- (master) Network Configuration "" PROFIBUS). DP- (master), DP- (slave). DP (slave) "PROFIBUS" , "" . DP- (slave) : Edit -> Open Object ( -> ). Hardware Configuration. , (slave), I/O (. 2.3 " "). DP- , (. 20.4.2 " I/O"). DP- (slave) "Already created stations" (" "). DP- (master) "" ( Hardware Configuration). : View -> Highlight -> Master System ( -> -> DP-) DP- (DP-master system). () (master) (slave) .

2.4.3 (Connections) (Connection) .

2- 22

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

SFB- SIMATIC S7 ("Communications via configured connections" - " ") SIMATIC S7-. : (online) MPI- . , , . (Network Object Catalog) PG/PC Stations (), PG/PC (network), . Connection table ( ) (Connection table). : , , . Connections () CPU (Connection table). Connections () Network Configuration, . S7-400 CPU Network Configuration. (Connection table) (. : 2.1). , , , . 2.1 (Connection table)Local ID ( ID) Partner ID (ID ) Partner () Type () Active Connection Buildup ( ) Send Operating State Message ( )

1 2 3 4

1 2 1

Station 416/CPU416(5) Station 416/CPU416(5) Station 315/CPU315(7) Station 417/CPU414(4)

S7 connection S7 connection S7 connection S7 connection

Yes () Yes () Yes () Yes ()

No () No () No () No ()

: Insert -> New Connections ( -> ) . (connection) ("active") CPU. , S7-300 CPU ; S7-300 CPU "" ("passive") S7-.

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2- 23

2. STEP 7

"New Connection" (" ") "Station" ("") "Module" ("") (. . 2.6); . .

. 2.6 , check box "Show Properties Dialog" (" "). . : View -> Display Columns ( -> ), . Connection ID ( ) CPU. STEP 7 ID . . Local ID ( ID) ID ( local ID - ID ). , ID .2- 24 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

ID (local ID) . , , : S7-: 0001 16 0FFF16 PtP-: 1000 16 140016 Partner ID (ID ) ID ( partner ID), CPU ID (local ID); : Edit -> Object Properties ( -> ). STEP 7 ID (partner ID), , () (. ). Partner () . , "Station" ("") "unspecified" (" "). (one-way connection) ; : SFB- S7-400 S7-300 CPU. SFB- S7-300, S7-400 CPU SFB 14 GET SFB 15 PUT. S7300, . (one-way connection) (connection table) "" ("active") CPU. STEP 7 ID ("Local ID"). . (two-way connection) ; , , S7-400 CPU. , , SFB 8 BSEND SFB 9 BRCV. (two-way connection) . STEP 7 ID ("Local ID"), ID ("Partner ID") . . Type () . STEP 7 (connection type):Automating with STEP 7 in STL and SCL STEP 7 STL SCL 2- 25

2. STEP 7

PtP connection ("Point-to-point", " ") PTP ( 3964 (R) RK 512) SFB-. PtP . SIMATIC S7 CP SIMATIC S7 ( SIMATIC), , -. S7 connection MPI, PROFIBUS Industrial Ethernet SFB-. S7 SIMATIC S7, PG HMI ( - ). S7 . Fault-tolerant S7 connection ( S7) PROFIBUS Industrial Ethernet SFB-. S7 SIMATIC S7 . "NCM S7 for PROFIBUS" "NCM S7 for Industrial Ethernet" . NCM : FMS-, FDL-, ISO transport-, TCP-, ISO-on-TCP-, UDP E-mail-. (Active Connection Buildup) , , (). , . check box "Active connection buildup" (" ") : , : Edit -> Object Properties ( -> ). (Sending operating state messages) . , check box . CPU SFB 23 USTATUS. (Connection Path) , , () (Connection Path). , STEP 7 : Industrial Ethernet, Industrial Ethernet/TCPIP, MPI , , PROFIBUS.

2- 26

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

CPU, , . "Interface" ("") . CPU (, S7-400 CPU ), "PLC-internal" (" PLC"). "Type" ("") , . , , MPI- PROFIBUS-, "MPI". "PROFIBUS", STEP 7 . MPI PROFIBUS "Address" (""). (Connections between projects) S7 , SIMATIC-, "unspecified" (" ") ( ). , , STEP 7 . . S7- (Connection to non-S7 station) , S7, : ( [ Siemens] , S7- ) PG / () SIMATIC S5-

, ( S7) , (, Network Configuration, : Edit -> Object Properties [ -> ] "Interfaces" [""]).

2.4.4 (Network Transitions) , . S7-, MPI-. - S7- , PROFIBUS, . , .

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2- 27

2. STEP 7

, (routing table), . S7- "", . , , , ( ). "placeholder" (""), PG/ (Network Object Catalog) . PG/ , PG. PG : PLC -> Assign PG/PC (PLC -> PG/). . PG : PLC -> Undo PG/PC Assignment (PLC -> PG/). (online) , , ID S7- . ID S7- : . ID . , - : Edit -> Object Properties ( -> ) "General" ("").

2.4.5 (Loading the Connection Data) , ("connection table") PLC ( "" CPU). : (network window), . , . . , , STOP. : PLC -> Download -> (PLC -> -> ) . , , : -> Selected Stations ( ) -> Selected and Partner Stations ( ) -> Selected Connections ( ) -> Stations on Subnet ( ) -> Connections and Gateways ( )2- 28 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

(connection table). (System data) Blocks. CPU . (online) MPI . PG Ethernet PROFIBUS, . "Set PG/PC Interface" Windows.

2.5 S7- 2.5.1 ( ) S7 Program. CPU , CPU. S7 Program Symbols () Source Files ( ) Blocks () (. . 2.7).

. 2.7 , .

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2- 29

2. STEP 7

("sourceoriented") Source Files ( ). - ASCII, , . ; Blocks (). MC7 S7 CPU. "" ("incremental"), - . . , Blocks (). (online) CPU, . . - , , I1.0 ( ). Symbol Table Symbols, , , "Switch motor on" (" ") , ( ). Blocks () , (Symbol Table) - , (address priority). SIMATIC Manager , : Edit -> Object Properties ( -> ), "General-Part 2" (" - 2"). , SIMATIC Manager Blocks () : Edit -> Object Properties ( -> ). Blocks () (load memory) (work memory), . ; .

2.5.2 (Symbol Table) , .. , , . (, I1.0) (, Start signal [ ]). . , , .2- 30 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

(local) (global) ( ). (local) , . . . ( Symbols S7 Program). 24 . , , , . 00 hex, FF hex ("). . . 80 . : I, Q, PI PQ M, T C OB, FB, FC, SFC, SFB DB , , UDT VAT ; (declaration section) (declaration section) . S7- SIMATIC Manager Symbols. (. 2.8).

. 2.8 Symbol Table

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2- 31

2. STEP 7

S7- Symbols. . , . , BOOL , INT , 16- . 3.7 " " 24 " ", STEP 7. "" ; . , . , . "" , . , . : ASCII ( *.asc), sequential assignment list ( - *.seq), System Data Format ( - *.sdf Microsoft Access) Data Interchange Format ( - *.dif Microsoft Excel). . . : Edit -> Special Object Properties ( -> ), . : HMI WinCC S7-PDIAG : View -> Columns O, M, C, R ( -> O, M, C, R), . : Options -> Customize ( -> ) , , .

2.5.3 STL- (STL Program Editor) STEP 7 (STEP 7 Basic Package) LAD, FBD STL. STL- "" () 2- 32 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

. . 2.9 , STL-.

Symbols

(Symbol table)

,

Sources

(Source programs)

( ) off-line ( )

Blocks (off-line) PG

on-line ( ) ( )

PLC (PLC download)

PLC (PLC upload)

Blocks (on-line)

CPU

. 2.9 STL Editor. , . , . , , .Automating with STEP 7 in STL and SCL STEP 7 STL SCL 2- 33

2. STEP 7

STL- "" ("decompiled"), .. MC7 (offline database) ( CPU, PG ). , STL- . STL- SIMATIC Manager, , OB1 Windows: Start -> Simatic -> STEP 7 -> LAD, STL, FBD Program S7 Blocks. : Options -> Customize ( -> ). "Editor" ("") , , , , , . Blocks () (, ) . , , Source files ( ). , , , .. , . , , LAD FBD. MC7 . , , . , - . , , " " . , , , (block protection KNOW_HOW_PROTECT). , , CPU. , . , ACSII- . , (online) , ( ) .2- 34 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

, "Source-oriented" ( ) STL- Source Files ( ). STL- ACSII- . , . SIMATIC Manager Source Files ( ) : Insert -> S7 Software -> STL Source File ( -> S7 -> STL-). , : Insert -> Block Template -> ( -> -> ) ( ). - \Step7\S7ska, S7kafnnx.txt. , . STL- : File -> Generate Source File ( -> ). , SIMATIC Manager: Insert > External Source File ( -> ) Source Files ( ). : Edit -> Export Source File ( -> ). , , , . 3.4.3 " , STL" 3.6.2 " , " STL-. STL- , . Blocks (). STL-, . "Source Files" (" ") , : Options -> Customize ( -> ) , , , , , . "Generate Block" (" ") . : File -> Consistency Check ( -> ) Automating with STEP 7 in STL and SCL STEP 7 STL SCL 2- 35

2. STEP 7

. , : File -> Compile ( -> ). . , . , , , , CPU, , . , ( 3.4.3 " , STL"). STL- "Source Files" (" ") , : Options -> Customize ( -> ) "Generate source files automatically" (" "), ( ). . . "Execute" ("") , . (offline), (online) Blocks (). . , , , . "Create Block" (" "), : Options -> Customize ( -> ), (reference data) . (offline) (online) CPU (, , ["programmable controller"] PLC). SIMATIC Manager ("offline" "online"); . "" ("offline") PG. ("offline") : File -> Save ( -> ) CPU : PLC -> Download (PLC -> ). 2- 36 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

, CPU, : File -> Save as ( -> ). CPU "" ("online") . CPU . CPU : PLC -> Download (PLC -> ). CPU (RUN) , . , "" ("online") ("offline") , : File -> Save ( -> ). 2.6.4 " CPU" 2.6.5 " " (online) . 3.4.2 " STL" 3.6.1 " STL" , STL-.

2.5.4 SCL- (SCL Program Editor) S7-SCL SCL. S7-SCL SIMATIC Manager. . SCL, , (. . 2.10). , . , Blocks (), . , , STL. , . SCL- , , . (: CPU, ). STL- SCL- SIMATIC Manager SCL- SCL- Windows: Start -> Simatic -> STEP 7 -> S7-SCL -> Program S7 Blocks. SCL- , , , STL-.Automating with STEP 7 in STL and SCL STEP 7 STL SCL 2- 37

2. STEP 7

Symbols

(Symbol table)

,

Sources

(Source programs)

( )

Blocks (off-line)

PG

PLC

(PLC download)

( )

Blocks (on-line)

CPU

. 2.10 SL Program Editor. SL- : Options -> Customize ( -> ). "Editor" ("") , , , , . SCL- Source files ( ) SIMATIC Manager : Insert -> S7 Software -> SCL Source File ( -> S7 -> SCL-), . . : Insert -> Block Template -> ( -> -> ), 2- 38 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

. SCL- , SIMATIC Manager: Insert > External Source File ( -> ) Source Files ( ). : Edit -> Export Source File ( -> ). , "Window" (""). , , , . 3.5.2 " SCL" 3.6.2 " , " SL-. SCL- , . Blocks (). SCL-, . "Compiler" ("") , : Options -> Customize ( -> ). Create object code ( ): , , , ; . Optimize object code ( ): , . Monitor array limits ( ): , , , , . Create debug info ( ): Program Status, . ( - ) Set OK flag ( OK): , OK EN/ENO.Automating with STEP 7 in STL and SCL STEP 7 STL SCL 2- 39

2. STEP 7

, : File -> Compile ( -> ). . , . , , , , CPU, , . , : File -> Partial Compile ( -> ). , ( 3.5.2 " SCL"). SCL- DB, . DB (Symbol Table) . , , , IEC-, Blocks () . : PLC -> Download (PLC -> ) CPU , Blocks () . SCL , , . : Insert -> SCL Compilation Control File ( -> ) Source Files ( ). , . : File -> Compile ( -> ) .

2.5.5 (Rewiring) Rewiring . , I 0.0 I 0.7 I 16.0 I 16.7. , , , , FC FB. SIMATIC Manager , ; , , Ctrl, - Blocks ().2- 40 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

, , : Options -> Rewire ( -> ). , O, , SIMATIC Manager . , . : Address priority ( ). , , , (rewire) .

2.5.6 (Address Priority) ("offline") Blocks () "Blocks" ("") ( ) , . . : "Absolute address has priority" ( ) ( , STEP 7). , , , . : "Symbol has priority" ( ), , , . : : I 1.0 "Limit_switch_up" (" ") I 1.1 "Limit_switch_down" (" "), I 1.0: A I 1.0 "Limit_switch_up" : "Symbol has priority" ( ), : I 1.0 "Limit_switch_down" (" ") I 1.1 "Limit_switch_up" (" "), (" "), : A I 1.1 "Limit_switch_up" : "Absolute address has priority" ( ), : A I 1.0 "Limit_switch_down" (" ")Automating with STEP 7 in STL and SCL STEP 7 STL SCL 2- 41

2. STEP 7

, "Absolute address has priority" ( ), ( ), . : "Symbol has priority" ( ), ( ). : "Symbol has priority" ( ), . (rewired) . : (rewiring) , MC7- . , .

2.5.7 (Reference Data) SIMATIC Manager (Reference Data), . : Cross references ( ) Reserved locations ( : I, Q, M, T, C) Program structure ( ) Unused symbols ( ) Addresses without symbols ( ) Blocks () : Options -> Reference Data -> Display ( -> -> ). : View -> Filter ( -> ); : Save as Standard ( ). . C : Options -> Customize ( -> ) "Create Blocks" (" ") . : (offline) ; "" (offline) , , (online).

2- 42

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

(Cross references) . , ( ), , ( ) . STL- , , , ; SCL- - . . , : Edit -> Go To -> Line ( -> -> ) , . (: View -> Filter ( -> ) (, ). , , . STEP 7 ( "Standard") . : , . , (, ). (Assignments) I/Q/M , I, Q M . . (, ). T/C , . . : , () . (Program structure) . ("starting blocks") . : "" (tree structure) . , - "+" "-". , ("temporary local data"), ("path") . , . "-" (Parent-child structure) 2 , , .Automating with STEP 7 in STL and SCL STEP 7 STL SCL 2- 43

2. STEP 7

: , , , , ( ). (Unused symbols) , , . , , . : , , , , . (Addresses without symbols) , . , . : , , ( ).

2.5.8 SIMATIC Manager . , . , , , , , STEP 7 SIMATIC Manager : Options -> Customize ( -> ) "Language" (""). , .. , STEP 7. . , , (, ), . , . , *.csy , Microsoft Excel. (translation) (translation table) . () . . (Exporting and importing texts) SIMATIC Manager , , (), , , (block container), . : Options -> Manage Multilingual Text -> Export ( -> -> ).2- 44 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

(storage location) , (target language). (Text type), ( 2.2). 2.2 (Text type) ()Text type ( ) BlockTitle BlockComment NetworkTitle NetworkComment LineComment Meaning () Block title ( ) ( ) ( ) ( ) ( - - - )

Block comment Network Title

Network Comment Line Comment

( )

InterfaceComment

Comment in declaration table of code blocks data blocks user data type UDT Symbol Comment

SymbolComment

( )

, , SymbolComment.csv. . () () Microsoft Excel : File -> Open ( -> ) ( ). , () . : Options -> Manage Multilingual Text -> Import ( -> -> ). (log-) , . : , (Text type), . SIMATIC Manager : Options -> Manage Multilingual Text -> Change Language ( -> -> ). (, ), . ( log-).

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2- 45

2. STEP 7

SIMATIC Manager : Options -> Manage Multilingual Text -> Delete Language ( -> -> ).

2.6

(Online Mode) , engineering system (ES). S7- (offline) , . CPU PG CPU, - ("online") . CPU (assigned) , .. .

2.6.1 PLC (Connection a PLC) MPI- PG MPI- CPU (online) . , CPU . CPU MPI-, CPU (MPI-). MPI- CPU. CPU CPU System Data ( ) Blocks () Hardware Configuration : PLC -> Download (PLC -> ). CPU MPI- ("naming" - ) . MPI- CPU MPI- , MPI CPU. : MPI- . , , , , MPI-. MPI- CPU . , CPU . (online) CPU, , , PG .

2- 46

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

PG , CPU : PLC -> Display Accessible Nodes (PLC -> ). (project) : "Accessible Nodes" - "Module (MPI=n)" - "Online User Program (Blocks)" [" " - " (MPI=n)" - " ()"]. Module (online) , (operational status) (module status). Blocks (), , CPU. (, , ) . CPU , , PG (data management system). SIMATIC Manager, , - : PLC -> Upload Station (PLC -> ). CPU (online) . CPU, (online) . MPI- CPU , (online) S7- : Edit -> Object Properties ( -> ), CPU "Addresses Module". S7- (online) , (online) CPU. Blocks () , CPU. (offline) (online) , , PG ( , ). , CPU, (online) , , CPU . , SIMATIC-, .. CPU, .

2.6.2 CPU . , , . , , () . "Protection" ("") Hardware Configuration CPU.Automating with STEP 7 in STL and SCL STEP 7 STL SCL 2- 47

2. STEP 7

1: (Protection level 1: keylock switch position) ( ). CPU. RUN-P STOP ; RUN " " PG. , . RUN, , "Can be revoked with password" (" "), , CPU . 2: (Protection level 2: write protection) . 3: (Protection level 3: read/write protection) . (Password protection) 2 3 1 "Can be revoked with password" (" "), . 8 . , , . CPU, : PLC -> Access Rights (PLC -> ). CPU S7-. "Enter Password" (" ") "Use password for other protected modules" (" ") . ("Password access autorization") , S7 . , , CPU .

2- 48

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

2.6.3 CPU (CPU Information) (online) , CPU. , - ( [online] ) S7- ( [online] ). PLC -> Diagnose Hardware (PLC -> ) (. 2.7.1 " " ) PLC -> Module Information (PLC -> ) (, , ), , ( [map] [work memory] [load memory], [compression]), [cycle time] ( , ), ( CPU, , ), ( , , , SFC SFB), ( ), STOP (B-, I- L) "Addresses Module". PLC -> Operating Mode (PLC -> ) (, RUN STOP), . PLC -> Clear/Reset (PLC -> /) CPU STOP-. PLC -> Set Date and Time (PLC -> ) CPU. PLC -> CPU Messages (PLC -> CPU) , , SFC 52 WR_USMSG, SFC 18 ALARM_S SFC 17 ALARM_SQ. PLC -> Display Force Values, (PLC -> ), PLC -> Monitor/Modify Variables, (PLC -> / ) (. 2.7.3 "/ " 2.7.4 " ").

2.6.4 CPU CPU ( , ) (load) CPU. (load) RAM EPROM, CPU .

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2- 49

2. STEP 7

EPROM, : PG, CPU, . (work) CPU. CPU EPROM-, . (load) RAM, CPU : CPU STOP, . . RAM- (backup battery). ( CPU, , GD-, ..), CPU System data ( ). : PLC -> Download (PLC -> ). CPU ; (startup). , PLC System data ( ). : PLC -> Download (PLC -> ) , , GD-, PLC. : : PLC -> Save Project on Memory Card (PLC -> ) (. 2.2.2 ", "). , , PG, CPU.

2.6.5 (Block Handling) (load) RAM, (online), , . CPU, "" (offline) : PLC -> Download (PLC -> ). "" (online) "" (offline) , "" ( "drag-n-drop"). . , CPU, , " ". , . " " . , , .

2- 50

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

SIMATIC Manager "" (offline) "Blocks" ("") CPU SCL. CPU , SCL-. SCL- . (online) STL (online) ( CPU), , (offline) . , "" "" , , "" ; ( , , , ) . , , (offline) , (, " " ["time stamp conflict"], ). (load) RAM , . EPROM, , RAM- . EPROM "invalid" (""). , (load) EPROM (work) . PG. (compressing) CPU, CPU (load) (work) . (work) , " " (invalid) ( ), "" ( ). , (invalid), . (gap) . Compress. RUN , , ; STOP .Automating with STEP 7 in STL and SCL STEP 7 STL SCL 2- 51

EPROM

2. STEP 7

: PLC -> Module Information (PLC -> ) "Memory" (""). . SFC 25 COMPRESS , . (online) (offline) (initial value) (actual value) (. 3.6 " "). CPU, (initial) (load) , (actual) (work) . . CPU, (work) , (actual) . (actual) : View -> Data View ( -> ). (actual) , CPU, (work) . (load) EPROM, (work) CPU. . . S7-300 , (retentive) , "UNLINKED" (""), (work) ; (load) . "UNLINKED" ("") SFC 20 BLKMOV.

2.7

CPU () , . , , , , , . CPU STOP, , , CPU. . , , , CPU OB1. OB1 , , , , ,

2- 52

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

. ( ) PLCSIM, CPU PG .

2.7.1 "Diagnose Hardware". PG MPI- SIMATIC Manager. , , PG, (online) : View -> Online ( - ). : PLC -> Display Accessible Nodes (PLC ) CPU. : PLC -> Diagnose Hardware (PLC - ) ( ). Hardware Configuration ; SIMATIC Manager "View" ("") : Options -> Customize ( -> ). (status) (operating state) , , (project view - , ), (station view , ) (module view - ).

2.7.2 STOP CPU STOP - , , , - . CPU , , STOP , . PG (online) , S7- Diagnostics Buffer ( ) : PLC -> Module Information (PLC -> ). ( 1) CPU STOP, , "STOP because programming error OB not loaded" (" STOP - ").Automating with STEP 7 in STL and SCL STEP 7 STL SCL 2- 53

2. STEP 7

, CPU STOP, , : "FC not loaded" ("FC "). . , , "Open Block" (" "). , , CPU STOP , " " , , "Stacks" (""). "Stacks" (""), B- (block stack - ), , . "I stack", (interrupt stack), CPU (, , , ) , . "L stack" (local data stack - ), , B-. B- "" .

2.7.3 (Monitoring and Modifying Variables) (Monitoring and Modifying of Variables), VAT- ( ). . , .. . : , ! , (Monitoring and Modifying of Variables), VAT ( ), . 255 (VAT1 VAT255) (Symbol Table). VAT- 1024 255 (. . 2.11). VAT- (offline), Blocks (), : PLC -> Monitor/Modify Variables (PLC -> / ). ( ).

2- 54

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

, : View -> Display Format ( -> ), "Display Format" (" ").

. 2.11 (Variable Table) . , , . , . Blocks () : Table -> Save ( -> ). (online) VAT-, (offline), : PLC -> Connect To (PLC -> ). , : PLC -> Disconnect (PLC -> ) . (Trigger conditions) : Variable -> Trigger ( -> ) (trigger point) (trigger conditions) . (trigger point) - , CPU .

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2- 55

2. STEP 7

, . , . "Start of cycle" (" "), OB 1. "End of cycle" (" "), OB1 . (Monitoring of Variables) : Variable -> Monitor ( -> ). VAT- . . , Display Format ( ). Esc. : Variable -> Update Monitor Values ( -> ) , . (Modifying of Variables) ( CPU ) : Variable -> Modify ( -> ). VAT-, , . ("" ) "//" : Variable -> Modify Value Valid ( -> ); . , Display Format ( ). Esc. : Variable -> Activate Modify Values ( -> ) , .

2.7.4 (Forcing Variables) CPU (Forcing Variables), , .2- 56 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

. CPU . : , ! VAT-. VAT-, - , . CPU. , , : Variable -> Display Force Values ( > ). CPU, (force window) . . : Table -> Save As ( -> ). : I ( ) [S7-300 S7-400] Q ( ) [S7-300 S7-400] PI [ S7-400] PQ [S7-300 S7-400] [ S7-400] : Variable -> Force ( -> ). CPU . : (, load []) (, ) : .

S7-400 (, transfer []) (, SFC) : . S7-300 .Automating with STEP 7 in STL and SCL STEP 7 STL SCL 2- 57

2. STEP 7

S7-300 : CPU ; CPU . : , CPU! , : Variable -> Delete Force ( -> ). , () , , CPU . , , , . I/O CPU. PI PQ (, ), PI PQ . , " " (access width) , (, [byte] [word]), . ( [access or area length error]), CPU " " ["error substitute value"] CPU STOP. , " " (access width) , (, [byte] [word]), . , (write protection) (synchronization error). (loading) . " " (access width) , , , . I , PI, ; . . PQ Q ( "" ["externally"] ). ; ( ). ,2- 58 Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2. STEP 7

, , . "0" (substitute value) OD ( STOP [], HOLD [] RESTART []) - ( OD, ). OD , . STOP Enable PQ ( PQ), STOP ( OD-). Enable PQ ( PQ) , ("safe") ( "0" [substitute value]); RUN.

2.7.5 ( Enable peripheral outputs) STOP OD-. "Enable peripheral outputs" (" ") OD-, , , CPU STOP. . CPU . : STOP- . : . (PQ), . (online) : PLC -> Connect To (, CPU, , , : PLC -> Operating Mode, "STOP". OD- : Variable -> Enable Peripheral Outputs ( -> ); "0", (substitute value), (force value). : Variable -> Activate Modify Values ( -> ). . : Variable -> Enable Peripheral Outputs ( -> ) ESC.

Automating with STEP 7 in STL and SCL STEP 7 STL SCL

2- 59

2. STEP 7

OD-, "0", (substitute value), (force value) . STOP ,