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

SIMATIC S7-300/400

STEP 7

SIMATIC S7


STEP7 LAD
FBD


SIMATIC S7-300/400

::
6ES7810-4CA05-8AR0

2- , 2001


LAD
FBD

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27


, ,
.
:

!
!
!

, ,
.

, ,
.

,
.

,
.


.
, ,
, .

,
,
,
Siemens.

, , ,
.


SIMATIC, SIMATIC HMI SIMATIC NET SIEMENS AG.
, ,
; ,
.
Copyright Siemens AG 2003
,

.
.
, ,
,
.
Siemens AG

:
/ 4848, D- 90327
Siemens




.
,
.
, ,

.
.
Siemens AG 2003
.

6ES7810-4CA05-8AR0

Die Deutsche Bibliothek CIP-Cataloguing-in-Publication-Data



Die Deutsche Bibliothek


LAD FBD SIMATIC S7 .
STEP7 S7-300/400. .

. , . , ,
.

.
Publicis MCD Corporate Publishing
Postfach 3240
D-91052 Erlangen
Federal Republic of Germany
Fax:
++49 9131/72 78 38
E-mail: publishing-books@publicis-mcd.de

SIMATIC ,
,
.
,
(SIMATIC S7), (SIMATIC 7) (SIMATIC 7).
: S7-200 (-PLC), S7-300
S7-400 ,
, .
STEP 7, STEP 5, SIMATIC. (PC) (, )
Microsoft Windows 95/98 Windows
NT.
() STEP 7 , DIN EN 6.1131-3. STL (statement
list ; ), LAD
(ladder logic ladder diagram ; , ; ), FBD (function block diagram
) SCL ( ),
.
: S7-GRAPH
( ), S7-HiGraph ( -

-) CFC ( ;
).
. STEP 7.
LAD FBD S7-300/400.
S7-300/400 STEP 7. , -;
.
, ; ,
, , .
LAD FBD ( ) . ,
,
-/.
LAD
FBD.
STEP 7 5.1.

, 2001




S7-300/400

PLC,

1 SIMATIC S7300/400
(
S7-300/400)
;
/ (I/O) (PROFIBUS DP);
();
;

4
AND, OR OR;

2 STEP 7
;
;
;
;

LAD/FBD;
; LAD FBD

3 SIMATIC S7
;
;

(Code Block)
(Data Block);
,
,

, ,
; ;
;


6
;
MOVE;

7
SIMATIC-
, ;
IEC-
8
SIMATIC-;
, , ,
;
IEC-


9

INT, DINT
REAL
10

INT,
DINT REAL
11
;
;
, ,
,
12
;

13

14

AND, OR OR

15
,
;
;
EN/ENO
16
;
, RLO = 1;
, RLO = 0;

17
MCR-,
MCR-,
MCR-

18

,

,
;
,
19
,
;
,


20
;
( , ,
);
;
/
; SFC
SFB-
21
;
;
;
;
;

22
,
, ;
STOP, HOLD,
;

23

;

24

KNOW_HOW_PROTECT;
, : ;


25
;

;
IEC;
S5 S7;
TI S7;
PID-;

26 LAD
;
;

27 FBD
;
;

,
LAD FBD. , ,
: LAD_Book FBD_Book.
Retrieve ()
2 (
PC/PG).
LAD_Book FBD_Book , . , ( ),
( )
. .
.
. SIMATIC- (SIMATIC Manager)
File Dearchive ( ) ( README.TXT ).

, , , . , .
STEP 7 STEP 7 Mini, - STEP 7 -.

LAD_Book


FB 101
FB 102
FB 103

LAD
FB 104 4:
FB 105 5:
FB 106 6:
FB 107 7:
FB 108 8:

LAD
FB 109 9:
FB 110 10:
FB 111 11:
FB 112 12:
FB 113 13:
FB 114 14:

LAD
FB 115 15:
FB 116 16:
FB 117 17:
FB 118 18:
FB 119 19:

SFC-
FB 120 20:
FB 121 21:
FB 122 22:
FB 123 23:


FC 11
FC 12
FB 20 ( )
FB 21
FB 22


UDT 51
UDT 52
FB 51
FB 52
FC 51
FC 52


FC 41
FC 42
FC 43
FC 44




32- ( )

FBD_Book


FB 101
FB 102
FB 103

FBD
FB 104 4:
FB 105 5:
FB 106 6:
FB 107 7:
FB 108 8:

FBD
FB 109 9:
FB 110 10:
FB 111 11:
FB 112 12:
FB 113 13:
FB 114 14:

FBD
FB 115 15:
FB 116 16:
FB 117 17:
FB 118 18:
FB 119 19:

SFC-
FB 120 20:
FB 121 21:
FB 122 22:
FB 123 23:


FC 11
FC 12
FB 20 ( )
FB 21
FB 22



UDT 51
UDT 52
FB 51
FB 52
FC 51
FC 52

FC 41
FC 42
FC 43
FC 44




32- ( )

STEP 7

STEP 7

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

10

STEP 7

SIMATIC-

2
Hardware () SIMATIC-


Project ()


(
CPU)

CPU c DP-:
PROFIBUS,
DP-


Hardware

(
)

CPU

DP-,

DP-


System
Data ( )

11

STEP 7

CP-

()


UDT
DB
FC/FB,
DB
OB


System Data

12


Blocks ()


CPU

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

STEP 7. SIMATIC S7 ,
, (networks)
(rungs). , . STEP 7 ,
( BOOL ),
( INT REAL ), ,
( ).
S7-300/400,
STEP 7. STEP 7 5.1.
3 SIMATIC S7
S7-
LAD FBD.
LAD FBD. .

SIMATIC S7-300/400
; /; ; ;

STEP 7
SIMATIC-; ; ; ; ( , ); ;

SIMATIC S7
; ;
; LAD FBD; ; ()

1
SIMATIC S7-300/400

1
1

SIMATIC S7-300/400 .......................................................... 4


1.1
........................................................................ 4
1.1.1
.................................................................................................................... 4
1.1.2
S7-300............................................................................................................... 6
1.1.3
S7-400............................................................................................................... 7
1.1.4
CPU...................................................................................................... 9
1.1.5
................................................................................................................. 10
1.1.6
......................................................................................................... 11
1.2
/.......................................................................................... 13
1.2.1
DP-..................................................................................................... 13
1.2.2
DP-...................................................................................................................... 14
1.2.3
DP-................................................................................................................... 14
1.2.4
PROFIBUS-PA................................................................................... 16
1.2.5
AS-.................................................................................. 17
1.2.6
...................................................... 18
1.3
...................................................................................................................... 20
1.3.1
............................................................................................................... 20
1.3.2
.......................................................................................................................... 23
1.3.3
...................................................................................... 26
1.3.4
................................................................................................................... 27
1.4
.................................................................................................................... 29
1.4.1
................................................................................................................. 29
1.4.2
................................................................................................................... 29
1.4.3
............................................................................................. 29
1.4.4
................................................................................................ 31
1.4.5
............................................................................................... 32
1.5
................................................................................................................... 33
1.5.1
............................................................................. 33
1.5.2
............................................................................................................. 34
1.5.3
.......................................................................................................... 36

1 SIMATIC S7-300/400

SIMATIC S7-300/400

1.1

1.1.1
SIMATIC S7-300/400 , :
(Racks)
;
(Power Supply, PS)
;
(Central Processing Unit, CPU)
;
(Interface Modules, IM)
;
(Signal Modules, SM)

;
(Function Modules, FM)
CPU;
(Communications Processors, CP)
();
(Subnets)
.
( ) ,
. , CPU
/ (SM, FM CP) ( I/O-)
. /
I/O- ,
,
( 1.1). / ( 1.2
/).

1.1


S7-300


IM 365 IM 361


IM 365

:
IM 460-1
IM 460-0
IM 460-3
IM 463-2


S7-400

1,5

5
(IM 461-1)
3
5
(IM 461-0)
100

5
(IM 461-3)
600

S5
(IM 314)

1.1 S7-300/400

1 SIMATIC S7-300/400

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


I/O- (P-) , (K-) . CPU (MPI)
.
1.1.2 S7-300

S7-300 8 I/O-.
,
, CPU 314
:
( IM 365, 1 )
( IM 360 IM
361, 10 ).
8 .
,
1,2 (0,8 CPU 312 IFM).
, P K-.


FM 356 7-300. FM
356 .

.
SIMATIC
SIMATIC S7-300, . 25 +60, IEC 68
2-6, ,
IEC 721-3-3 3 5, -

1.1

EN 50155 ( ). .
1.1.3 S7-400

S7-400 18 9 (UR1
UR2); CPU ,
. IM 460-1 IM 461-1

1,5 , 5 . , 3 , IM 360-0 IM 361-0. , , IM 360-3 IM 361-3
100 .
21 .
IM .
P- K-.
ER1 ER2 18 9 , ,
24 P-, K-. K- UR1, UR2 CR2
, 1 6.

CR2.
CPU () . CPU K-,
P- .

S7-400, ,
CPU, .

CPU.
20.3.6 21.6 .

1 SIMATIC S7-300/400

SIMATIC S5
IM 463-2 S5
(EG 183U, EG 185U, EG 186U, ER 701-2 ER 701-3) S7-400, . IM
314 S5 .
, .
S7-400 IM 463-2; IM 463-2
S5.

SIMATIC S7-300/400, (master station) (standby station), .
, , ,
. .
.
/
/ ( 200 IM 153-3
PROFIBUS DP). (
) Software Redundancy ( ).
SIMATIC S7-400H
SIMATIC S7-400H
, ,
H-CPU
- . ; .
/ (,
) (
200). .
, ;

1.1

. S7-400H.
1.1.4 CPU

1.2 CPU, .
, (load memory) (work memory).
CPU (plugin) . , , .
RAM (
), CPU.
;
. - ,
.

)


( )

()

CPU S7-400

1.2 CPU
9

1 SIMATIC S7-300/400

() ,
, . CPU .

( 2.6.4
CPU 2.6.5 ).
RAM,
. , EEPROM - EPROM, CPU .
CPU 3IFM RAM- EEPROM-.
RAM, () EEPROM, .
CPU S7-300 ( CPU 318)
RAM, . - EPROM

.
S7-300 ( data
blocks) ( , )
. ,
.
RAM CPU S7-400 . ,
,
RAM. - EPROM .
CPU S7-400 .
STEP 7 5.1 (V5.1)
CPU S7-400
( 2.2.2 , ).
1.1.5
: RAM- EPROM.
, RAM (, CPU S7-400). RAM- -

10

1.1

() . RAM
.
,
, , EPROM.
( )
EPROM, . CPU ,
CPU .
1.1.6
(system memory) (),
. ( ),
. , , , () ( ), ,
. CPU :
(Inputs, I)
( ) .
(Outputs, Q)
( ) .
(Bit memory, M)
, .
(Timers, T)
, .
(Counters, C)
, .
(Temporary local data, L)
, . L, CPU .
, , , .
.

11

1 SIMATIC S7-300/400

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

12

1.2 /

1.2

/
PROFIBUS-DP () . DP- (DP master), DP (DP slaves). () / , PROFIBUS-DP PROFIBUS (- PROFIBUS). PROFIBUS-DP EN 50170
DP.
PROFIBUS-DP
1.3.2 .
DP- DP-. 32 , 127. DP . , PROFIBUS-DP , ,
-, 200 DP- SIMATIC S5.

1.2.1 DP-

PROFIBUS-DP , DP DP-. DP-
, ( ). DP- DP DP- ( 1.3).

DP- ( DP-)
PROFIBUS ( ). ,
, DP-
DP- DP-, ,
, DP-, ..
DP-
, DP-
DP-. DP S7, DP- DP-. CPU
DP-.

13

1 SIMATIC S7-300/400
S7 DP-,
, CPU 318-2DP

,
, 200

,
, 200

,
, CPU 315-2DP

PROFIBUS-DP


DP/PA

PROFIBUS-PA

DP/PA

PROFIBUS-PA


DP/RS232C


DP/AS-

AS-

1.3 PROFIBUS-DP
1.2.2 DP-
DP- PROFIBUS. DP-. DP-
CPU DP- (, CPU 315-2DP, CPU 417)
CPU (, IM 467)
CP CPU (, CP 342-5, CP 443-5)
1
2 (, ).
1.2.3 DP-
DP- PROFIBUS. SIMATIC S7
DP-
DP- ;

14

1.2 /

DP-
();
( ) DP- (I-slaves)
, ()
.
PROFIBUS DP
DP- ET 200B ( / /; IP 20; 12 /), ET 200 ( IP
66/67; /; 1,5 / 12 /) ET 200L-SC ( /
/; IP 20; 1,5
/). , (Link) DP/AS-i, PROFIBUS.
PROFIBUS DP
DP- 200.
S7-300 DIN, , IM 153 CPU (SM) (FM)
, .
9,6 / 12 /.
200 ,
DP- S7-400. , / S7300 . .
.
200 IM 153-3 . IM 153-3 , DP , DP- .
(I-) PROFIBUS-DP
DP- S7-300, CPU, DP-, (, CPU 315-2DP), S7-300 CP 342-5
.
200 147/CPU
DP-. 7 .

15

1 SIMATIC S7-300/400

,
147/CPU, STEP 7. /, /, ( 5,5 400 ).
9,6 / 12 /.
1.2.4 PROFIBUS-PA
PROFIBUS-PA
PROFIBUS-PA (Process Automation )

(Ex- 1), , ,
,
.
PROFIBUS-PA EN 50170, 2 (PROFIBUS-DP),
IEC 1158-2.
PROFIBUS-DP PROFIBUS-PA:
DP/PA-, PROFIBUS-DP 45,45
/
DP/PA, PROFIBUS-DP
PROFIBUS-PA.
DP/PA-
DP/PA- PROFIBUSDP. PROFIBUS-DP DP/PA- DP-, 45,45 /. DP/PA- 31 . PROFIBUS-PA
31,25 /.
PROFIBUS-PA PROFIBUS-PA.
DP/PA- : -Ex- 400 Ex- 100 .
DP/PA
DP/PA PROFIBUSDP 9,6 / 12 /. DP/PA
IM 157 DP/PA- ( 5 ),
SIMATIC S7. -

16

1.2 /

, PROFIBUS-PA,
PROFIBUS-DP. DP/PA 31 .
SIMATIC PDM
SIMATIC PDM (Process Device Manager ,
SIPROM) , PROFIBUS-PA
HART. HART- (Highway Addressable
Remote Transducers ) DDL (Device Description Language ).
SIMATIC PDM Windows 9x/NT
, STEP 7.
1.2.5 AS-
-
- (actuator-sensor interface AS-i)
. AS-i-
31 AS-i- 2- AS-i-,
, . AS-i-
AS-i,
8 () .
AS-i 100 ; 2100
(AS-i- AS-i ) (AS-i- AS-i , ).
AS-i-
AS-i- AS-i-
5 . AS-i- SIMATIC S7
342-2 PROFIBUS-DP DP/AS ( 1.4).
AS-i- 342-2 S7-300
200. :
342-2 /.
16 16 ( 128 ). AS-i- , .

17

1 SIMATIC S7-300/400

ASi-. FC

( , / , ).
DP/AS- AS-i- AS-i PROFIBUS-DP. PROFIBUS-DP DP-, AS- AS-i-,
31 AS-i-. AS-i- (31)
DP/AS- 16 16 . 12 /.

S7-300

PROFIBUS-DP

CP
342-2

AS-i

DP/AS-

AS-

AS-i

AS-i


AS-i
ASIC


AS-i
ASIC

AS-i

AS-i

AS-i


AS-i

1.4 AS-i SIMATIC S7


DP/AS- :
DP/AS- 65 IP 66/67 DP/AS-
20 IP 20,
, 20 .
1.2.6
PROFIBUS-DP/RS 232C RS 232C (V.24) PROFIBUS-DP. RS 232C
PROFIBUS-DP DP/RS 232C.

18

1.2 /

DP/RS 232C 3964R (free)


ASCII.
PROFIBUS-DP/RS 232C -- (, point-to-point).
PROFIBUS-DP PROFIBUS-DP/RS 232C. .
224 .
PROFIBUS-DP 12 /; RS 232C 34 / , , -.

19

1 SIMATIC S7-300/400

1.3


SIMATIC S7. . CPU -
.

( Siemens).
SIMATIC (SIMATIC NET) (-) SIMATIC.
- (HMI-). .

1.3.1
1.5 .
SIMATIC ,
. .

SIMATIC S7
CPU

SIMATIC S7
CPU
ID-

SFB

DB

ID-

SFB

DB

ID

ID

SD

RD

1.5 SIMATIC S7

20

1.3

SIMATIC S7 CPU MPI-,


. , (CP),
. . .
( ), , ,
(). S7-
, , S7- .


. , .

, ,
() (). SIMATIC
MPI, PROFIBUS, Ethernet (Industrial Ethernet) -- (point-to-point PTP).

() ,
, .
, , ,
.
SIMATIC : S7-, PROFIBUS-DP, PROFIBUSFMS, PROFIBUS-FDL (SDA), ISO-, ISO-on-TCP (global data communications).

() . , ,
(, ), .

21

1 SIMATIC S7-300/400

SIMATIC : S7-, S7-


(), FMS- FDL-, ISO-, ISO-onTCP- TCP-, UDP- e-mail-.

. SIMATIC S7 CPU .
(loadable
blocks).

1.1 , .
1.1

MPI

PROFIBUS

CPU

CPU DP

IM 467

CP 342-5
CP 443-5

CP 343-5
CP 443-5

22



SFC-

SFB- (
S7-400)
PROFIBUS-DP
(, )
SFC-

PROFIBUS-DP ( )
SFC-

PROFIBUS-DFL
PROFIBUS-DP ( )
SFC-

SFB- (
S7-400)
PROFIBUS-FMS
PROFIBUS-FDL
SFC-

SFB- (
S7-400)

,
(GD
table)
SFC-
(connection table), FB-
Hardware configuration ( ), / , SFC-
SFC-
Hardware configuration, / , SFC-
SFC-
NCM, ,
SEND/RECEIVE
SFC-
, SFB-
NCM, , FMS, SEND/RECEIVE
SFC-
, SFB-

1.3

1.1 ()

Ethernet

CP 343-1
CP 443-1
CP 343-1 IT
CP 443-1 IT


ISO
TCP/IP
SFB- (
S7-400)
ISO
TCP/IP, IT-
SFB- (
S7-400)

,
NCM, ,
SEND/RECEIVE
, SFB-
NCM, ,
SEND/RECEIVE
, SFB-

NCM ; NCM PROFIBUS . Ethernet.

1.3.2
. SIMATIC .
:
MPI
SIMATIC
.
PROFIBUS
,
/.
Ethernet
.
Point-to-point (PTP-)
.
STEP 7, ,
SIMATIC S7, , . S7 .
MPI
CPU ( multipoint interface, MPI).
, CPU, - . Siemens.

23

1 SIMATIC S7-300/400

MPI ,
.
50 . RS485 ( 1100 ) ( 100 ).
187,5 /.
32. .
(
).
MPI CPU , SFC- SFB. .
PROFIBUS
PROFIBUS Process Fieldbus ( ),
, EN 50170,
.
.
; 100 (12 /) 1000 (9,6 /). .
127; . ,
. ( ).
() (), ,
, .
.
/ PROFIBUS;
PROFIBUS-DP .
CPU DP-,
CP.
SFC- SFB-.
PROFIBUS-FMS PROFIBUS-FDL, CP. (FMS-
SEND/RECEIVE-),
.

24

1.3

Ethernet
Ethernet , , , IEEE 802.3.

,
. 1,5 , 4,5 .
10 /.
1000
Ethernet. ,
. , (
CSMA/CD-). .
Ethernet SFB-, S7. Ethernet CP,
ISO- ISO-on-TCP-
SEND/RECEIVE-.
-- (point-to-point)
-- (PTP) . SIMATIC-
.
.
RS 232C (V.24), 20 (TTY) RS 422/485. 300 / 19,2 / 20 76,8 / RS 232C RS 422/485.
; 10
RS 232C, 1000 20 9,6 / 1200
RS 422/485 19,2 /.
AS-
AS- ( /, AS-i) AS- IEC TG 178. AS- SIMATIC ; AS-I- (hardware configuration) (network configuration).

25

1 SIMATIC S7-300/400

,
( ). 300 .
167 /.
31 ,
.
1.3.3
. :
(PG): , ; , ,

.
HMI-: -; OP, , .
SFB-: . SFB-
; , .
SFC-: 76 .
SFC-; , .
S7- MPI, PROFIBUS Ethernet.
CPU
. .
;
. .
MPI K-
.
PROFIBUS-DP /. EN 50170 2. SIMATIC

26

1.3

S7 ( SIMATIC)
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-FDL , , SIMATIC S5 PROFIBUS.
ISO-
ISO 8073 4.
. ISO- , ,
SIMATIC S5 Ethernet.
ISO-on-TCP TCP/IP
RFC 1006.
Ethernet.
1.3.4
(connection)
.
; ()
( ).
.
;

( ).

.
Connection type ( ) ( 2.4
).
S7 PROFIBUSDP SFC-.
(global data table);
PROFIBUS-DP SFC-
.

27

1 SIMATIC S7-300/400


()
CP. , , S7 MPI- CPU,
CPU; MPI- CP CP CPU.
CPU . OP (
).
SFC-.

28

1.4

1.4

1.4.1
,
,
( 1.6).
, , +HP01S10 ( , Switch motor on), ,
. ,
/ (I/O-) (, 5, 2).
CPU
, (I 5.2, ). I 5.2 - .
-
, ( ),
(symbol table). - .
1.4.2
(
S7). . ( ).
, . ,
.
, / . DP-
.
Hardware Configuration STEP 7 S7 .
( 2.3
).
1.4.3
, , , (

29

1 SIMATIC S7-300/400

/). / 0 , CPU.

+HP01
S10

I/O
n

0 1 2 3 4 5 6 7
4
5

7
0

7
n+1

5
DI 16

I-
4

(LAD)

I 5.2

I 5.2


BOOL

(FBD)

&

I 5.2

&

1.6
,
( )
,
( ).
() , .
, . 0,
1, 2 3; . :
8 30

1.4

8, 9, 10 11.
(, ) ,
. 2, 4, 8
16 , 4, 8, 16 32 .
( ) CPU , , . (0-).
(configuration table).
S7-3 DP-, S7-318 S7-400 . .
. FM CP .
/
() /. / .
DP- ,
( ) ( ). / ,
SFC 14 DPRD_DAT SFC 15 DPWR_DAT.
,
,
(Input)
(Output). , FM CP , .
1.4.4
, . ( ),
.
(, ),
/ , .

/ .
; , , CPU .

31

1 SIMATIC S7-300/400

STEP 7 , /. Hardware Configuration.



;
( 20.4.1 /).
1.4.5
,
DP- (, DP-, DP-, ) PROFIBUS ,
.
MPI-
, MPI ( CPU, FM CP),
MPI-. , - .
, CPU S7-300 FM CP,
, MPI-, MPI- CPU.
CPU S7-300 MPI- FM CP MPI- CPU.
CPU 318 MPI-
, MPI-. .

32

1.5

1.5


, ,
,
,
,
( 7 8 ),
L- ( 18.1.5 ).

() .

1.5.1
SIMATIC S7 :
,
Load () Transfer (),
.
, /.
() .
. / , , ,
. .
, , , . . ; .
/, , , (peripheral
inputs, PI) (peripheral outputs, PQ).
,
CPU .

33

1 SIMATIC S7-300/400


(PI)
. PI
. I/O- 0; CPU.
/ (Direct I/O Read)
, ( , ). , , (Direct Read).
. , ,
.
,
.

(PQ),
. PQ . I/O- 0;
CPU.
Direct I/O Write ( /)
, (, ). ,
,
. . , Direct I/O Write ! ,

.
, .
1.5.2
,
. (I),
(Q). , .

34

1.5

, , .
20.2.1 .
CPU S7-300, CPU S7-400, 1998 .,
.
.
CPU, , CPU 417,
. . CPU ,
.

(input) .
, . CPU .
:
, ( / ).
,
(, ()
/ , ,
). .

(
). , .
,
(random access memory).
. ,
.
( 20.2.4 ).

35

1 SIMATIC S7-300/400

(output) . , .
CPU .
:
(
/ ).
, (,
() /, ,
). .

. .
(), . , .
, , .
. 20.2.4 .
1.5.3
, , ,
. .
, .
CPU
. CPU.
,
.
:
(temporary local data), ,
;

36

1.5

(static local data),


, .
()
(
), , . .
CPU. 22.2.3 .

.
( ),
(watchdog) ( )
(clock memory).
, (
) 1:1. ( 1.7). , ,
CPU. ,
.

0
10

5 ( )
2,5 ( )
2
1,25 ( )
1
0,625 ( )
0,5

1.7

37

2
STEP 7

2
2

STEP 7 ............................................................................................ 4
2.1
STEP 7............................................................................................................ 4
2.1.1
.................................................................................................................... 4
2.1.2
.................................................................................................................... 5
2.1.3
SIMATIC- ....................................................................................................... 5
2.1.4
................................................................................................... 8
2.1.5
..................................................................................................... 10
2.2
.................................................................................................... 11
2.2.1
....................................................................................................... 11
2.2.2
, , ........................................................ 13
2.2.3
........................................................................................................... 15
2.3
................................................................................................ 17
2.3.1
................................................................................................... 19
2.3.2
...................................................................................................... 19
2.3.3
............................................................................................ 20
2.3.4
MPI .......................................................... 21
2.3.5
............................................................... 21
2.4
...................................................................................................... 23
2.4.1
.......................................................................................... 25
2.4.2
DP- Network Configuration ......................... 26
2.4.3
.................................................................................. 27
2.4.4
........................................................................................................ 32
2.4.5
....................................................................................... 33
2.5
S7 ...................................................................................................... 35
2.5.1
........................................................................................................................ 35
2.5.2
........................................................................................................ 36
2.5.3
....................................................................................................... 38
2.5.4
.................................................. 41
2.5.5
......................................................................................................... 42
2.5.6
....................................................................................................... 43
2.5.7
............................................ 45
2.6
() ................................................................................ 48
2.6.1
PLC........................................................................................................ 48
2.6.2
............................................................................... 49
2.6.3
CPU ......................................................................................................... 50
2.6.4
CPU.......................................................... 51
2.6.5
......................................................................................................... 52
2.7
.................................................................................................... 55
2.7.1
..................................................................... 55
2.7.2
STOP................................................. 56
2.7.3
......................................................... 56
2.7.4
( Force)....................................... 58
2.7.5
..................................................................... 61
2.7.6
LAD/FBD...................................................................................... 62

2 STEP 7

STEP 7

2.1

STEP 7
STEP 7 5.1
(V5.1). , , .
(statement list,
STL), (ladder logic, LAD) (function block diagram, FBD).
, S7-SCL (structured control language ), S7-GRAPH (sequence planning ) S7-HiGraph (state-transition diagram -).

2.1.1
STEP 7 V5 32- , Windows 95 Service Pack 1 ( 4.00.950), Windows 98
Windows NT Service Pack 3 ( 4.00.1381). STEP 7 Windows 95/98 (programming device, PG) PC 80486
32 RAM; Pentium 64 . Windows
NT Pentium 32 RAM;
, STEP 7 Windows NT.
STEP 7 , , , 100 ,
PC .
STEP 7 V5 200 300 (, )
. ( swap-out).
128 256 .
, , , . , , . , , .
, Windows.

SETUP Windows 95/98/NT. STEP 7 .

2.1 STEP 7

STEP 7 V5 - (
), NCM CP STEP 7 Acrobat Reader V3.01.
MPI-. ,
MPI. ,
(prommer).
STEP 7 V5 , ,
, , , ,
. Windows (Windows Control Panel) SIMATIC
Workstation ( SIMATIC).
.
2.1.2
STEP 7 ( ). . STEP 7
, .
.
()
.
- , , - , ,
.
.
2.1.3 SIMATIC-
SIMATIC- (SIMATIC Manager)
STEP 7; () Windows
(Start).

SIMATIC Manager

SIMATIC-
.

2 STEP 7

(Project Wizard).
. (, check box) Display Wizard on starting the SIMATIC Manager ( SIMATIC- ), File New
Project Wizard ( ).
(project). .
, File Open ( ), :
( ),
( 2.1). ; .

2.1 SIMATIC-
STEP 7 SIMATIC. . ,
. , , , MPI. CPU,
CPU , S7-. , , (container) , Blocks
(), , , .

2.1 STEP 7

STEP 7 . 2.2
( ),
STEP 7 S7-
. () . . ,
. CPU ( PLC),
View
Online ( ). , ,
; , , .

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

CPU xxx

S7

OB n
FB n
FC n
DB n
SFC n
SFB n

UDT n
VAT n
S7







CPU





(= )



(, STL- SCL-)







. , CPU






()
, CPU
( , S7-, CPU)

2.2 STEP 7

2 STEP 7

, (). ,
. Options Customize ( ) View ().
Options Customize ( ) , SIMATIC-, (),
(libraries), ,
.

:
() ,
, ( ).
(
, ) Edit
Object Properties ( ) .
, CPU, (),
Hardware Configuration ( ).
, .
, SIMATIC- . , SIMATIC- (, ,
).

. , ,
(toolbar).
. .
2.1.4
STEP 7 (main objects)
.
(Projects)
, .

2.1 STEP 7

,
,
,
( , , ).
.
() , . , .
(Libraries) . . STEP 7, , , ( ),
(symbol table).
( )
, .
STEP 7 V5 (Standard
Library), :
System Function Blocks ( )
, CPU,
;
S5-S7 Converting Blocks ( S5-S7)
S5/S7 (
S5 );
I-S7 Converting Blocks ( I-S7)

I-S7;
IEC Function Blocks ( IEC)
DATE_AND_TIME STRING;
Communication Blocks ( )
CP 342-5 (CP-);
PID Control Blocks ( PID-)
;
Organization Blocks ( )
(templates) (
).

2 STEP 7

25 . , S7 ,
. . File Open ( ) .
.
File New ( ) (, ). ,
SIMATIC- , Options Customize ( )
New ().
Insert () (, ). ,
SIMATIC-
, .
Edit Copy ( ) Edit Paste ( )
, Windows, . , SIMATIC- (undo) .
2.1.5
() ,
, . (topic), , Help (). , GETTING STARTED
() , SIMATIC-.
Help Contents ( ) STEP 7 . .
Help Context-Sensitive Help F1 ( - F1)
- , F1, , .
.
, .
, ,
, , .

10

2.2

2.2


, . , ,
, , CPU
. , S7-
- . , ( , CPU, ) Hardware Configuration.
, SIMATIC-. ,
, (!) Windows Explorer
( Windows) SIMATIC-.

2.2.1
(Project wizard)
STEP 7 V3.2, STEP 7 Wizard ( STEP 7). CPU,
S7 CPU, S7-, .
S7
,
.
2.1.3 SIMATIC-.

File New ( ), ,

RETURN.

Insert Station SIMATIC 300
Station ( SIMATIC 300) ( S7-300).

11

2 STEP 7


,
, ; SIMATIC-
. Hardware ()
Hardware Configuration, (configuration table). , View Catalog ( ).
,
, SIMATIC 300 RACK 300, , ( drag &
drop).
.
,
, . , , CPU, , CPU 314 2. .
2.3 .
, SIMATIC. CPU.
CPU SIMATIC- S7 Program
(S7-) . .
S7 Program
CPU; S7- (connection table) S7 Program Connection.
S7-; SIMATIC- (Blocks ), .
(Blocks); SIMATIC- (System
data )
( 1).

. 1
, , , .

12

2.2

Insert S7 Block
( S7) (Blocks ) .
System data ( ) . .
Hardware () Station ().
System data ( ) CPU, PLC Download (PLC
), CPU.
Source Files ( ) .
Source Files ( ), Insert S7 Software
STL Source File ( S7 STL),
. Insert
External Source File ( ), , , , ASCII,
Source Files ( ).
S7
. .
S7- Insert Program S7
Program ( S7-). S7-
SIMATIC- Sources () Blocks
(). Blocks () 1.

, , ,
. ,
, .
, ,
, STEP 7 .
2.2.2 , ,
SIMATIC- : , . STEP 7, .

13

2 STEP 7

File Rearrange ( )
SIMATIC-
. ,
(),
().
File Rearrange ( ), SIMATIC , ,
,
.
.
(File Archive,
). SIMATIC-
( ) .
. STEP
7 ARJ PKZIP 2.50,
- (WinZip 6.0, Pkzip 2.04g, JAR 1.02
LHARC 2.13).
() .
File Retrieve (
) . .
Archive (), Options Customize (
); ,
Generate archive path automatically (
) ( , ).
CPU
STEP 7, 5.1, CPU S7400 ()
CPU, . , , ,
, - . , CPU .
, CPU, , CPU PLC Save Project on Memory Card (PLC
). :
PLC Retrieve Project from Memory Card (PLC
14

2.2

). , , CPU,
CPU, .
,
CPU, , CPU PLC Display Accessible Nodes (PLC
). ,
File S7 Memory
Card Open ( S7 ).
2.2.3
STEP 7 V5 SIMATIC- . STEP
7 V1 1, STEP 7 V2 2, STEP 7
V3/V4/V5.0 2 3. STEP 7 V5.1 V3 V3-.

STEP 7 V1

STEP 7 V2

V1

STEP 7 V5.1


V1 V2
File Open version 1 project.


V2
V3,
File
Open.

V3 File
New Project.

V3
V3

V2
V2

V2 File New project 2.x.


V2 V3 File Save As.

V2 V3.
STEP 7 V3/V4/V5.0

2.3

15

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 V5.1 3. , V1- V2- File Open Version 1 Project ( 1), V2-, File Open (
). V2- 2 .

16

2.3

2.3


Hardware Configuration. CPU.
. .
,
Edit Open Object ( ) Hardware SIMATIC
300/400 Station ( SIMATIC 300/400). Options Customize ( ).
, Station Consistency Check ( ) .
Station Save ( ) .

2.4 Hardware Configuration

17

2 STEP 7

Station Save and Compile ( )


,
System data ( )
Blocks (). CPU PLC Download (PLC ). System data ( ) Blocks ()
CPU. PLC Upload (PLC ).

Station Export ( ). STEP 7
ASCII,
. .
ASCII-.

Hardware Configuration (checksum) .
, , ,
.
System data ( ).
, S7- Blocks
(), System data ( ) Edit Open Object ( ).
. Blocks ():
Blocks () Edit Object Properties ( )
Checksums ( ).

Hardware Configuration
( 2.4). .
DP- . ,
, ,
PROFIBUS, DP-. ,
DP-, .

18

2.3


View Catalog
( ). , , STEP 7. Options Edit Catalog Profile ( ),
, ,
, - .
.

Hardware Configuration , , DP-.
,
.
.
2.3.1
, , , SIMATIC 300 RACK 300, ,
-
(drag&drop). . . No Parking
( )
.
S7-300 3 ; .
. S7-400 ( : ) Link ()
Properties () Send IM ( Edit
Object Properties, ).
I/O- 20.4.2 /.
2.3.2
Hardware Configuration () .
19

2 STEP 7

. CPU
S7-400 CPU S7-300 DP-
. , S7-300 S7-400,
.
, , () . ,
;

.
S7-400, (subsidiary) (
Part process image). CPU,
, .
View Address Overview ( ) , , CPU.
MPI- MPI-.
. , , MPI- CPU .

Hardware Configuration (),
.
, , . () Edit Symbols
( ). , , , (
).
Add Symbol ( )
. Apply ()
. .
2.3.3
.
, . .

Edit Object Properties ( ).
20

2.3

.
CPU,
() .

SFC 55
WR_PARM, SFC 56 WR_DPARM SFC 57 PARM_MOD.
2.3.4 MPI
MPI ()
(Module Properties). CPU MPI, CPU , , Edit
Object Properties ( ). Interface () General ()
Properties (). ,
Parameter (),
.
MPI-,
CPU. , CPU S7-300 FM CP MPI MPI- CPU.
MPI- MPI-,
( FM
CP!). .
: CPU, CPU
().
CPUxxx(1), MPI-. , , ,
CPUxxx(1) CPUxxx(n), n - MPI-.
MPI- MPI-
(operator panel, OP) . MPI ; ()
MPI- () . : 0 , 1 2 CPU (
).
2.3.5
Hardware Configuration () .
,
() , CPU.
. -

21

2 STEP 7

, PLC Monitor/Modify (PLC /)


(Monitor)
(Modify) .
Hardware Configuration Status Value ( ) . Modify Value
( ) , Modify Value.
() I/O Display ( I/O) ,
/ ( ) / ( ). Enable Perif Outputs ( ) , CPU STOP () ( 2.7.5
).
2.7.3
2.7.4 .

22

2.4

2.4


S7 SIMATIC-.

. SIMATIC- . Hardware
Configuration
( CPU CP); .
Network
Configuration ( ) .
Network Configuration
. Network Configuration ; .
, :
MPI ;
, Insert Subnet (
).
Network Configuration
.
.
.
, .
Network Configuration : MPI Options Define Global Data ( ) ( 20.5 ).
Network Save ( ) Network
Configuration.
Network Consistency Check ( ).
Network Configuration Network Save and Compile (
).

23

2 STEP 7

Network ( )
Network Configuration .
SIMATIC- MPI.
Network Configuration.
Network Configuration, Connections () CPU.

2.5 Network Configuration


Network Configuration
() .
, , CPU S7-400, .
(Network Object Catalog) SIMATIC, DP-. View Catalog ( ), (
).

24

2.4

View Zoom In ( ), View Zoom


Out ( ) View Zoom Factor ( ) .
2.4.1
Network Configuration .
, , , . .
.
, . .
Network Configuration,
, , () . Network Configuration.
Network
Configuration .
, , , .
.
.
. ,
.

: Edit Object Properties (
). , , General ()
ID () S7. ID
, . ID S7 , . , , ,
Network Settings ( ).
( )
Edit Object Properties ( ), , , ,
.
Interfaces ()
,
.

25

2 STEP 7

( , Hardware Configuration).
2.4.2 DP- Network Configuration
Network Configuration /. View With DP Slaves (
DP-), DP- .
DP-, :
PROFIBUS ( , PROFIBUS
).
DP- ( ,
, DP- Hardware Configuration CPU,
).
DP- PROFIBUS (
Hardware Configuration, DP-
Network Configuration, , PROFIBUS).
DP-, . DP- PROFIBUS
, .
DP- Edit Open Object ( ).
Hardware Configuration. , , / (
2.3 ).
DP- (I-slave) ,
( 20.4.2 /). DP-
Already created stations (
); , DP-,
( Hardware Configuration).
View Highlight Master System ( ) DP-; .

26

2.4

2.4.3
.
,
SFB- SIMATIC
S7 ( )
SIMATIC S7.
:
MPI
. , , ,
.
PG/PC ( ) Stations (),
PG/PC .

. : , ,
.
Connections () CPU . Connections () Network Configuration,
.
, Network Configuration CPU S7-400.
( 2.1;
,
). Insert New Connection ( )
.
CPU. ,
CPU S7-300; CPU S7-300
S7-.
Station
() Module () New Connection ( )
( 2.6); .
.
Show
Properties Dialog ( ).

27

2 STEP 7

.
View Display Columns
( ) .
ID ()
CPU. STEP 7 ID . .
ID (local ID, ID ). , ID.
ID .
, :
S7-:
0001hex 0FFFhex
PtP-:
1000hex 1400hex
ID (partner ID) CPU ( ) ID:
Edit Object Properties ( ). STEP 7
ID , ( ).
2.1
Local ID /
ID

Partner ID
/ ID

3
4

28

Partner /

Type /

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

S7
S7
S7
S7

Active connection
partner /

Send operating mode


messages /

2.4

.
-,
(Station) unspecified ().
(one-way connection)
; : SFB- CPU S7-400
S7-300. SFB- S7-300,
CPU S7-400 SFB 14 GET SFB 15 PUT. S7300 , .

CPU. STEP 7 ID.
.
(two-way connection)
; , CPU S7-400 SFB 8 SEND SFB 9 BRCV.
. STEP 7 ID ID
. .

STEP 7 Network Configuration
:
PtP- ( )
( 3964(R) RK 512) SFB-. PtP- ( point-to-point, )
. SIMATIC S7 CP
SIMATIC ( Siemens), , .
S7- MPI, PROFIBUS Ethernet SFB-. S7- SIMATIC S7 -. S7-,
.
S7- PROFIBUS Ethernet SFB-. S7-
SIMATIC S7, PC.

29

2 STEP 7

NCM S7 for PROFIBUS NCM S7 for Industrial Ethernet


CP. NCM :
FMS-, FDL-, ISO-, ISO-on-TCP-, TCP-, UDP- email-.

(). , , . Active Connection Buildup ( )
( , Edit Object Properties, ).

.
,
. CPU-
SFB 23 USTATUS.

(connection path)
, .
, STEP 7 :
1)
2)
3)
4)

Ethernet;
Ethernet/TCP-IP;
MPI;
PROFIBUS.

CPU, ,
.
Interface (), . CPU (, CPU S7-400 ), PLC-internal (PLC-).
Types () , . , , MPI
PROFIBUS, Types () MPI. PROFIBUS, STEP 7
. Address () MPI PROFIBUS-.

30

2.4

2.6
31

2 STEP 7


S7, SIMATIC-, unspecified () ( ).
, (STEP 7 ). .
, S7

, S7:
( Siemens, S7 );
/PC;
SIMATIC S5.
, , . , Network Configuration, Edit Object Properties ( )
Interfaces ().
2.4.4
,
. ,
S7,
MPI.
, PROFIBUS, S7, . ,
, .
,
(routing tables),
.
S7 ,
.

32

2.4

,
. (placeholder), PG/PC- .
PG/PC- , .
PLC Assign PG/PC (PLC
PG/PC). .
PLC Undo PG/PC Assignment (PLC PG/PC).
, , ID S7.
ID S7 : . ID Network Configuration Edit
Object Properties ( ) General ().
2.4.5
, PLC
( CPU).
: , . ,
.
. , , STOP.
PLC Download (PLC )
.
, , :
Selected Stations

( ),

Selected and Partner Stations

( -),

Selected Connections

( ),

Stations on Subnet

( ),

Connections and Routers

( ).

33

2 STEP 7


System data ( ) Blocks ().
.
MPI
. PC Ethernet PROFIBUS, . Set PG/PC Interface ( PG/PC)
Windows (Windows Control Panel).

34

2.5 S7

2.5

S7

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

2.7
,
-- (block-by-block). . Blocks ().
CPU , . .
, (
),
Source Files ( ). ASCII, , . , Blocks ().
STL;
LAD FBD,
, LAD FBD, .

35

2 STEP 7

. , , I 1.0 ( absolute addressing). Symbols () (- , , Switch motor on


) ( symbolic addressing). Blocks () ,
( address priority).
2.5.2
; , , ,
. (, I1.0) (, Start signal). . ,
.
(local) (global) . , .
. . ( Symbols () S7 Program (S7-)).

2.8
, 24 .
, , . 00hex, FFhex ().

. . 80 .
:

36

2.5 S7

I, Q, PI PQ;
, ;
OB, FB, FC, SFC, SFB DB;
UDT;
(variable table) VAT.
;
.
S7 SIMATIC-
Symbols (). , ( 2.8). S7
.
.
, . , BOOL () ,
INT () , 16- . 3.5 ,
, .
, ; . ,
.
,
. .
, ,
. ASCII- ( *.asc), (*.seq), (System Data Format, *.sdf Microsoft
Access) (Data Interchange Format, *.dif Microsoft Excel). . .

37

2 STEP 7


Edit Special Object Properties ( )
.
- (HMI-) WinCC;
;
;
S7-PDIAG.
View Columns O, M, C, R (
O, M, C, R). Options Customize ( )
, , .
2.5.3
STEP 7
(Program Editor) LAD, FBD STL. LAD
FBD ,
; 2.9 .
,

; ,
.
LAD/FBD , 7
(
CPU ). ,
STL.

SIMATIC, ,
1 Windows, Start Simatic STEP 7 LAD, STL, FBD Program S7 Blocks ( Simatic STEP 7
LAD, STL, FBD S7).

38

2.5 S7

()

PG

PLC

PLC

()

CPU

2.9 LAD/FBD
Options Customize
( ). Editor () Create Blocks ( ) ,
, , , ,
.
Blocks () ( ,
), .
, , , STL. ,

39

2 STEP 7

, , 7
, .
, :
(KNOW_HOW_PROTECT), ( 24.1 ).

, , Blocks (). , (network).
,
.
Create Blocks ( ), Options Customize (
),
.
, CPU,
PLC. SIMATIC- ; .
PG. , File Save ( )
CPU, PLC Download (PLC ). , CPU, File Save As ( ).
CPU, . CPU , , ,
. CPU, PLC Download (PLC ). CPU RUN (),
.
,
File Save ( ).
2.6.4 CPU 2.6.5
. 3.3
3.4
, LAD/FBD.

40

2.5 S7

2.5.4
Source Files ( ), Options
Customize ( ), Generate source file
automatically ( ) , ( )
, .

. .
Execute () , .
SIMATIC Edit Export Source File ( ).
ASCII-, ,
.
Source Files ( ) Insert External
Source File ( ).
, LAD FBD,
LAD- FBD-.
SIMATIC File Compile
( ). Blocks () STL-. , View LAD
( LAD) View FBD ( FBD).
.
Addresses Symbolic
( ),
. ,
, , , , . .
( ), , .
()
Rewire () . , I0.0 I0.7 I 16.0, , I 16.7.
, , , ,
FC FB.

41

2 STEP 7

SIMATIC- , ; , , Ctrl, Blocks () . Options Rewire ( ), ,


.
SIMATIC- .
, , .
, .
:
Address priority ( );
,
, ,
.
2.5.5
Blocks (),
Blocks () ,
, ()
.
Absolute address has priority (
) ( , STEP 7). , , , . Symbol
has priority ( ), , .
:
:
I 1.0 Limit_switch_up
I 1.1 Limit_switch_down

I1.0 :
I 1.0 Limit_switch_up

42

2.5 S7

I1.0 I1.1 :
I 1.0 Limit_switch_down
I 1.1 Limit_switch_up

, :
I 1.1 Limit_switch_up

Symbol has priority ( )


Absolute address has priority ( ),
:
I 1.0 Limit_switch_down

, Absolute address has


priority ( ) (statement) ( , ,
, ). Symbol has priority (
), (, ).
Symbol has priority ( ),
. ,
.
, , 7- .
,
.
2.5.6
SIMATIC- (reference data), . :

(I, Q, M , )


43

2 STEP 7

, Blocks ()
Options Reference Data Display ( ). View Filter ( ); Save as
Standard ( ).
.
Options Customize ( )
Create Blocks ( ) , .
,
; ,
, .

, . , ( ), ,
, ( )
. STL ,
; SCL . , .
, Edit Go To Line (
) .
, View
Filter ( ), , .
, , . STEP 7 , Standard (), , .
: ,
. , , ( ).

I/Q/M , I, Q
. , .
, , .
/ , .
.
: , () .
44

2.5 S7



. . :
.
+ -. , , / . , ,
.
/ .
.
: ?
? ?
( )?

, ,
. , , .
:
? , , ?

,
. .
: ( - )?
2.5.7
SIMATIC- .
,
. , , , STEP 7 SIMATIC-
Language () Options Customize ( ).

45

2 STEP 7

, , STEP 7 . .

, ,
. ,
. *.csy,
, , Microsoft Excel.
.
. .
.

SIMATIC- , ,
, , , ,
. Options Manage Multilingual Texts Export ( ).

. , (
2.2).
, , SymbolComment.csv .
() Microsoft Excel
File Open ( ) ( ). ,
.
Options
Manage Multilingual Texts Import ( ). (log-)
, .
, ,
.

46

2.5 S7

2.2 ()

BlockTitle

BlockComment

NetworkTitle

(, )

NetworkComment

(, )

LineComment
InterfaceComment





UDT

SymbolComment


SIMATIC-
Options Manage Multilingual Texts Change Language (
). (, ), . log-.
Options Manage Multilingual Texts Delete Language (
).

47

2 STEP 7

2.6

()
,
(engineering system, ES). S7
, .
CPU, . .
() CPU
, .

2.6.1 PLC
MPI MPI- CPU.
, CPU . MPI CPU,
(MPI-). MPI- CPU. CPU , CPU System
Data ( ) Blocks () Hardware Configuration, PLC Download (PLC ). CPU MPI- ( ) .
MPI- CPU MPI-
CPU , MPI-.
, MPI- .
, , ,
MPI-.
MPI- CPU . ,
CPU . CPU,
.
, CPU PLC Display Accessible Nodes (PLC ). Accessible Nodes Module (MPI=n)
Online User Program (Blocks) (MPI=n) (). Module ()
, . Blocks ()
CPU. (, ,
) .

48

2.6 ()

CPU ,
, . SIMATIC-,
PLC Upload Station (PLC ).
CPU
.
CPU , () . MPI- CPU, S7- Edit Object Properties ( ) Addresses Module
( ) CPU.
S7 Program (S7-),
CPU . Blocks ()
, CPU.
, ,
( , ).
CPU , , CPU .
, SIMATIC-, CPU .
2.6.2
CPU . , , . , ,
.
Hardware Configuration, Protection ()
CPU.
1:
( ). , . RUN-P (-P) STOP ;
RUN . ,
.
RUN
Can be revoked with password ( ),
49

2 STEP 7

, CPU, .
2:
,
.
2: /
,
.

2 3 2 Can be revoked with
password, . 8
.
, ,
. CPU
PLC Access Rights (PLC ).
CPU S7-.
Enter Password ( )
Use password for other protected modules ( ) , ,
.
S7.
, , CPU, .
2.6.3 CPU
CPU, . ( ) S7 ( ).
PLC Diagnose Hardware (PLC )
2.7.1 .

50

2.6 ()

PLC Module Information (PLC )


(, ), , ( , ), ( ,
), ( CPU, ,
), ( ,
, , SFC SFB), ( ), STOP
(B-, I- L-).
PLC Operating Mode (PLC )
( , RUN STOP),
.
PLC Clear/Reset (PLC /)
() CPU, STOP.
PLC Set Time and Date (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 CPU. RAM -EPROM,
CPU () .
-EPROM,
. CPU ;

CPU. CPU
-EPROM, CPU,
.
RAM CPU STOP,
. 51

2 STEP 7

. RAM .
( CPU, , GD-, ),
System Data ( ) CPU ( PLC Download - PLC
). CPU ; CPU
.
, PLC
System Data ( ). PLC Download (PLC
) , , , , .
: PLC Save Project on
Memory Card (PLC ) ( 2.2.2
, , ). , CPU.
2.6.5

RAM , .
CPU PLC Download (PLC ).
.
.
, , CPU STOP, . ,
. . ,
, .
SIMATIC- SCL Blocks () CPU.
CPU , SCL. SCL- , , .

52

2.6 ()


STL
( CPU), , .
,
, ;
( , , ,
).
, , , (, ,
, ).

RAM, . -EPROM,
, RAM. -EPROM
(invalid). ,
-EPROM
.
-EPROM .

CPU,
. ,
( ), . ,
.
,
. Compress ().
RUN, ; STOP.
PLC Module Information (PLC ), Memory
(). , ,
.

53

2 STEP 7

, ,
SFC 25 COMPRESS.
/
(initial
value) (actual value) ( 3.4 ). CPU, , . , ,
.
CPU , . View Data View (
).
CPU, .
-EPROM, , , CPU. , . .
S7-300 , .
, UNLINKED (),
; . SFC 20 BLKMOV.

54

2.7

2.7


CPU () , , , , . , , ,
. CPU
STOP , ,
, CPU.
. , ,
, CPU 1. 1 ,
, ,
, ,
.
PLCSIM CPU .

2.7.1
Diagnose Hardware ( ). MPI SIMATIC.
, ,
View Online ( ). PLC Display
Accessible Nodes (PLC ) CPU.
PLC
Diagnose Hardware (PLC ) ( ). Hardware Configuration ;
SIMATIC- View ()
Options Customize ( ).
, , ( , ), (, ) ( ).

55

2 STEP 7

2.7.2 STOP
CPU - STOP, STOP . CPU ,
STOP , . , PG , S7-
Diagnostic Buffer ( ) PLC
Module Information (PLC ). ( 1) STOP, , STOP because programming error OB not loaded (STOP, ). , STOP, ,
, FC not loaded ( FC). ,

. , Open Block ( ) .
STOP , , , Stacks (). Stacks () B- ( ), , .
I-stack (I-) , , CPU (,
, , ) . L- ( )
, B-.
2.7.3

VAT.
. , , .
: ,
.


VAT, . 255 ( VAT 1 VAT 255)
. 1024
255 ( 2.10).

56

2.7

VAT , Blocks ()
Insert S7 Block Variable Table ( S7
), VAT
S7 Program (S7-) PLC Monitor/Modify Variables (PLC / ).
,
( ),
( View Display
Format
Display Format ).
,
. , .
, . Table Save ( ) Blocks ().

2.10

, , PLC Connect To (PLC ).
VAT ,
PLC Disconnect (PLC ).
()
, Variable Trigger ( ), . , CPU
.

57

2 STEP 7

, .
, .
Start of circle ( ),
1. End of circle ( ),
1
.

Variable Monitor (
). VAT . . ,
Display format ( ). ESC .
Variable Update Monitor Values ( )
, .

CPU, , Variable Modify ( ).
, , .
// Variable
Modify Values as comment ( ); . , Display format ( ).
, . ESC .
Variable Activate Modify Values (
) ,
.
2.7.4 ( Force)
CPU .

58

2.7

( ). CPU .
: , .

(VAT). VAT, CPU. Variable Display Force Values (
), , .
CPU ,
. .
VAT 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
.
, :
(, ) (, ) .
S7-400
(, ) (, SFC )

59

2 STEP 7

. S7-300 .
S7-300 :
CPU ; CPU .
: CPU!
Variable
Delete Force ( ).

, , CPU .
, .
/,
CPU.
( , ),
.

, , ,
(,
), .
( ),
, (error substitute value), , CPU STOP.
, ,
(,
),
.
, .
. , , , ,
, () , .
I , PI, ;

60

2.7

. ,
.
PQ,
Q
( ). Q ;
( ). , .
0 OD ( STOP, HOLD RESTART , ) (: OD
). OD , .
STOP Enable PQ ( PQ), STOP ( OD). Enable PQ ( PQ) (safe) ( 0
); RUN.
2.7.5
STOP OD;

OD , , , CPU STOP. .
, CPU. : STOP .
: ,
!
(PQ) . PLC Connect To (PLC ), , , CPU, , PLC Operating Mode (PLC )
STOP.
OD Variable Enable
Peripheral Outputs ( );
0, .
61

2 STEP 7

Variable Activate Modify Values (


). .
Variable Enable Peripheral Outputs ( ) ESC. OD , 0, .
STOP, (), OD RESTART RUN.
2.7.6 LAD/FBD
Program status ( )
. (network).
, ,
CPU, . , ,
SIMATIC-. .
(network), .
Debug Monitor ( ).
. ( , ) LAD/FBD Options Customize (
). ,
Debug Monitor ( ).
, Debug Call Environment
( ). ,
.
,
. , No
condition ( ).
.
Debug Modify Address ( ).

.
: . (debug
mode) .
, , ,
.
(process mode) 62

2.7

, , ,
( ).
CPU, , CPU Protection ().
CPU,
.
. Debug Operation ( ).

63

3
SIMATIC S7

3
3

SIMATIC S7 ............................................................................................................. 4
3.1
........................................................................................................... 4
3.1.1
..................................................................................... 4
3.1.2
.................................................................................................... 6
3.1.3
.................................................................. 8
3.2
..................................................................................................................................... 10
3.2.1
.................................................................................................................. 10
3.2.2
......................................................................................................... 12
3.2.3
........................................................................................................... 14
3.2.4
........................................................................................................ 17
3.3
.................................................................................. 21
3.3.1
................................................................................................. 21
3.3.2
LAD................................................................................. 28
3.3.3
FBD ................................................................................. 31
3.4
.................................................................................... 35
3.4.1
........................................................................................................... 35
3.4.2
.................................................................................................... 35
3.4.3
.................................................................................................................... 36
3.5
, ............................................................................ 38
3.5.1
................................................................................ 38
3.5.2
................................................................................................ 39
3.5.3
..................................................................................................... 43
3.5.4
.................................................................................................. 44
3.5.5
................................................................................................ 52
3.5.6
................................................................................................ 57
3.5.7
................................................................................. 57

3 SIMATIC S7

SIMATIC S7
CPU SIMATIC S7-300/400, (
), () . LAD
FBD. .
; , .
.

3.1


CPU (operating system) (user program).
,
, . ,
, . CPU,
. ,
, , .

,
() .

3.1.1
, CPU .
,
( 3.1). , , (priority classes), ( mutual interruptibility), .
(main program),
CPU.
, CPU

3.1

() ()
.

<>

<>

3.1

3 SIMATIC S7

(organization
block OB).
. CPU
. , .
CPU
(startup routine). , CPU . ,
, S7-300 (
complete restart); S7-400 , ( warm
restart).
1,
.
(, network) 1. 1
( ) CPU ,
, ,
1.
, ,
(interrupts) (errors).
( ), CPU ( watchdog interrupts,
time-of-day interrupts ).
, . , , , .
. , , .
CPU; CPU STEP 7.
3.1.2
3.1 SIMATIC S7 . CPU .
; CPU ; CPU.

3.1

3.1 SIMATIC S7

TOD-
10 17

20 23

30 38

40 47

60

70
72
73

80,
8184,86,87
85

90
100,
101, 102
121, 122


(, )

2 24

36

2 24

(, 100 )

7 15

2 24

I/O- (
/)

16 23

2 24

25

- I/O-
CPU

25
28
25

2 26
2 28
2 26

,
(, time error, SE-, ,
/ , /)

262)
262)
262)

26
2 26
24 26

291)

27

, (, I/O)

1)
. 2) : 28

90 ( ) 1
, 1, .
100 ( ) 101 ( ); 27.
, , 28. .

CPU. (7

3 SIMATIC S7

) .
;
CPU 85 (Program Processing Error - ) STOP.

(L-).
18.1.5 .
3.1.3
CPU , . CPU (
Hardware ()), . .
CPU . STEP 7
.
Startup ( )
( , , ); Ready () ; ( CPU ).
Cycle/Clock Memory (/ , )
/ ;
;
;
; .
Retentive memory ( )
, ;
.
Memory ()

( ); L-
.
Interrupts ()
,
, ( )
.
Time-of-Day Interrupts ( )
, .

3.1

Cyclic Interrupts ( )
, .
Diagnostic/Clock (/ )
STOP;
; .
Protection ()
; .
Multicomputing ( )
CPU.
Integrated I/O ( /)
/.
CPU , , .

3 SIMATIC S7

3.2


. STEP 7
.
. (Blocks).
, ,
.

3.2.1
STL :
(user blocks)
.
(system blocks)
.
(standard blocks)
( ) ,
(FM) ().

() . :
(Organization blocks - OB)
. CPU
, , . 1. ,
, .

10

3.2

(Function blocks - FB)


, .
(variable memory), . , , (call) .
,
( , ).
(instance data block),
(call instance)
(instance).

; (local instance).
(Functions - FC)

. .
( ) . .
.
.
(Data blocks - DB)
. , ( ,
). :
1) (global data blocks),
2) (instance data blocks).
, , . ,

.

CPU. ;
CPU. .
()
.

11

3 SIMATIC S7


. ( , SFC,
, SFB) ( , SDB). , CPU .
SFC SFB, ,
. (user
memory); SFB .
SDB , . STEP 7
. , , ,
. , SDB
(load memory). .


( ).
, STEP 7 (, IEC- S5/S7).
25 , (Standard Library).
3.2.2
(code blocks) ( 3.2):
(block header),
, , ;
() (declaration section),
() (
);
(program section),
.

12

3.2
, , ,
Block header ( )

Block type Address ( )


Block header

Declaration ()

Var_xxx

name: Data type := Initialization;


name: Data type := Initialization;

END_VAR
Program ()

BEGIN
Program

&
&

END_Block Type

, ,

Block header

DATA_BLOCK Address ( )
Block header

Declaration

STRUCT

name: Data type := Initialization;


name: Data type := Initialization;

END_STRUCT

BEGIN
name := Initialization;
END_DATA_BLOCK

3.2

13

3 SIMATIC S7

:
(block header) ;
() (declaration section) ,
;
(initialization section),
.

. (declaration view) (data view) ( ).
3.2.3
. File Properties ( ) ( 3.3).
General Part 2 ( 2)
:
Local Data ( ): ( );
7: ( );
Load memory requirement: ;
Work memory requirement: .
KNOW HOW Protection ( -) .
, ,
.
() (declaration table) . KNOW_HOW_PROTECT. , ,
, ( !).
, Siemens,
Standard Block ( ).
DB is write-protected in the PLC (DB PLC ) . ,
.

14

3.2

.
.
,
.

3.3
, Unlinked ()
; . ,
, ,
SFC 20 BLKMOV.
General Part 2 (
2).
Name () ; ,
. .
Family ()
. ,

(program elements catalog).

15

3 SIMATIC S7

Author () .
. ,
.
Version () 0 15.
General Part 1 ( 1) (time stamps):
, . ,
, .
(time stamp conflict).
1 2.
. multi-instance capability ( , DB ), , 2. multi-instance capability
, ,
. 1 ( STL).
Calls () ,
, .
. Attributes ()
,
, , SIMATIC PCS7.
,

. SIMATIC-, Edit Object
Properties ( )
General Part 2 2.
.
(Properties)
Blocks (). Blocks () Edit
Object Properties ( ). Blocks ()
Size in work memory ( )
Size in load memory ( ).

16

3.2

, ( )
.
Blocks (),
( ). SIMATIC- ,
Ctrl.
, ( ),
SIMATIC- CPU
Memory (), PLC Module
Information (PLC ).
(Checksum)
(Program Editor)

Blocks (). ,
.
. ,
Blocks () Edit Object Properties (
).
3.2.4
(block interface) . (, ), . .

( 19 ).
.
: (
), , . ,
.

(Time stamp conflict) , . ,
.
. , ,
, ,
17

3 SIMATIC S7

,
.
, , , . , (
), . , , :
, ;
;

(
, ,
);
( );
UDT ,
UDT; , , UDT.


UDT-. Edit Block
Call Update ( ).
,
; .
.

,
. ,
Check block consistency (
).
, .
Blocks () Edit Check Block Consistency ( ). ,
, 5 SP3 STEP 7.
,
( ,
18

3.2

Check block consistency ( ) ), Program Compile ( ).


1:Compile (1:). .
( 3.4). .

3.4
(reference tree) : , .
: DB 20/FB 20 1, FB 21
FB 22 FB 20.

19

3 SIMATIC S7

(dependency tree) ,
. ,
. : FB 32 DB
20/FB 20, 1. DB 29,
FB 20.
, , , . ( ) , .
, Edit Open Block ( ) , , .

20

3.3

3.3


2.5 S7 .

3.3.1
.
SIMATIC-,
File Open ( ). , :
SIMATIC- Blocks
(), Insert S7 Block ( S7
) . (Properties) .
General Part 1 ( 1)
LAD FBD.
.
File New ( ),
( , , ).
. ,
Create Block ( ), Options
Customize ( ).
,
,
File Properties ( ).

,
( 3.5). :
() (variable declaration table).
.
(program window).
.
(program element catalog).
STL .

21

3 SIMATIC S7

3.5 LAD
()
. ,
, , . . ( 3.2).
3.2

Input parameters
( )
Output parameters
( )
In-out parameters
(/ )
Static local data
( )
Temporary local data
( )

22

in

FC

FB

out

FC

FB

in_out

FC

FB

stat

FB

OB

FC

FB

temp

3.3

(variable types)
. - , .
, , (
) ( ).
(, ).
19 .
( ),
.
, 8
16 , BYTE () - . ()
BOOL () BYTE (), .
( ).


,
(network), () ,
. View Comment
( ), View Symbolic Representation ( ) View Symbol Information ( ). , View Zoom In
( ), View Zoom Out ( )
View Zoom Factor ( ).
()
LAD/FBD- , ( ). , 1.
999 . (network title)
(network comment). ,
Edit Go To ( ). .

, Display with comments ( ), . . . (current path) LAD
(logic operation) FBD.
23

3 SIMATIC S7

Insert
Network ( ).
.
,
. , () Block End ( ), (, , ).
(Network templates)
, , ,
, , .
, , ,
, S7- Source Files ( ).
, ,
() . ,
, %00 %99.
.
, , ,
. ,
() ( ).
,
.
; Ctrl .
Create Network Template (
). . ( Source
Files ( ) ).
,
(Program Elements Catalog) ( ). , .
.

24

3.3

(Absolute addressing)

(ID) / .
,
. , .

. .
Type check for address ( )
LAD/FBD, Options Customize (
).
(Symbol addressing)
, . .
Options Symbol Table ( ),
.
View
Display Symbolic Representation ( ). View Display Symbol Information (
) ( )
.
,
, Insert Symbol ( ), Insert Symbol (
) ,
. , View Display Symbol Selection (
).

,
LAD/FBD. ,
, . ,
.
, LAD/FBD,
STL.
25

3 SIMATIC S7


(program
output), , , ,
( ),
Edit Call Update ( ). UDT.
Edit Call Change to Multi-Instance Call ( ) Edit Call Change to FB/DB
Call ( FB/DB) . .

, View Catalog ( ) Insert Program Elements ( ).
, (
).
LAD FBD,
, ,
Blocks (),
( 3.6).

26

3.3

3.6 LAD FBD

27

3 SIMATIC S7

3.3.2 LAD

LAD,
. . (current path) (rung)
(power rail).
, ,

(,
F2 (normally open - NO) ),
,
( Insert Program Elements or
View Catalog ( )).
(coil) (box).
3.3 .
(). , (label).
(Contacts)
, (inputs), . .
(normally open contact), 1 ( );
(normally closed contact),
0 ( ). , ( ) ( NOT ()).
(Coils)
,
(outputs). ,
, .

28

3.3

, , (Set
coil) (Reset coil), . , , .
(Boxes)
LAD
. STEP 7 :
EN/ENO, , , , ;
EN/ENO, , MOVE (),
, .
( FC, FB, SFC SFB), LAD
EN/ENO. , LAD
(Empty box),
.
(Contacts)

(Coils)

NO


NC

(, )

NOT

(,
, ,
)

JMP

FP

(Boxes)
EN/ENO (, )

EN/ENO (, )

(, )
DB m


S_PULSE
S
TV

Q
BI
BCD

EN
IN1
IN2

ADD_I
ENO
OUT

FB n
EN
in1
in2
in3

ENO
out1
out2
out3

3.7 LAD

29

3 SIMATIC S7
Network 2: Parts ready to remove
When the parts have reached the end of the belt, they are ready for removal.

Load

N
Remove

Ready_rem

EM_Loa_N

SR
S

EM_Rem_P
P

Basic_st

/Mfault1

3.8 LAD

LAD .
,
( ) .
LAD. ,
( ),
.
: LAD
,
( ,
). ,
LAD, .

;
- , ( );
ENO EN ;
(
) ENO.
30

3.3

ENO: ENO () ,
,
, (
15.4 ).
3.3.3 FBD

, ( , ) .

( , F2 AND
()),
(Insert FBD Element AND Box
FBD AND)
Insert Program
Elements ( ) View Catalog ( ).
(assign box). 3.3
.

(). : , (labels).

() , , , AND (),
OR () Exclusive OR ( ).
.
,
1 . .

31

3 SIMATIC S7


AND,
OR,
OR


, ,
, ,

&

>=1

,
..

XOR

CU
()
JMP



EN/ENO (, )


EN/ENO (, )


(, )
DB m


S_PULSE
S
TV
R

BI
BCD
Q

ADD_I
EN
IN1
IN2

OUT
ENO

FB n
EN
in1
in2

out1
out2
ENO

3.9 FBD

, ,
.
.
,
(), , ,
.


. STEP 7 :
EN/ENO ( ,
, )
EN/ENO ( MOVE, , ).

32

3.3

(FC, FB, SFC SFB), FBD


EN/ENO.
, FBD (Empty box),
.
Network 2: Parts ready to remove
When the parts have reached the end of the belt, they are ready for removal.
Ready_rem

EM_Loa_N
N
Load

SR
S

EM_Rem_P
P

>=1

Remove
/Mfault1
Basic_st

3.10 FBD

FBD .
, .
.
.
-
( ). ,
- . ,
-. ,
FBD, .
,
;
- , ( );

ENO EN ;

33

3 SIMATIC S7

AND OR ENO.
, , ( 15.4
). ENO: AND ENO , , OR ENO , ( )
.

34

3.4

3.4


2.5 S7 . (data blocks) LAD FBD.

3.4.1
.
SIMATIC-,
File Open ( ). , :
SIMATIC-: Blocks
(), Insert S7 Block Data Block (
S7 ) .
(Properties) . General Part 1 ( 1)
. DB. .
: File New ( ),
. Object Name ( )
.
.
,
. , File Properties
( ).
3.4.2
, New Data
Block ( ); , .
:
Data block ( )
;
() ;
Data block with assigned user-defined data type (
, UDT)
;
UDT (User defined
data type);

35

3 SIMATIC S7

Data block with assigned function block ( )


;
,
.
3.4.3
3.11 .
:
(declaration view), , ;
(data view),
.

3.11 ( )
36

3.4


. ,
.
, , .
UDT ( ) UDT.
: .
(Declaration view), View
Declaration View ( ),
, , ,
(UDT) .
(Data view), View Data
View ( ), . . ,
CPU. .

: . , ( FB/DB) .
View Data View ( )
Actual value (
). Edit Initialize Data Block ( ) .

37

3 SIMATIC S7

3.5

3.5.1
(variable) ( 3.12). (, 5.2, 5 , 2 ). , () .


.
.

3.12
BOOL () (binary address)
(binary operand). , , (digital operand).
, , () . , .
,
(, DI, L-,
DB-).
, ( ). 32 , , , .
STL-.
, IEC, STEP 7 (
38

3.5 ,


).
,
,
(, , 30 , ).
(Constants) . .
3.5.2
: (absolute addressing) (symbolic addressing). , (0),
. - ,

() () . (indirect addressing),

.

.
, ,
. () .
()
(binary signal) . , . ., , , , . .
.

(analog signal) 16 .
,
(word), ( ). (-

39

3 SIMATIC S7

, ) ,

16- (16 ). , 16 ,
(, ).
QW 27
QW 24
7

QW 26

QB 24

QB 25

QB 26

0
QB 27

QW 25

3.13
(information width - ) , .
(, ), , (data type) . BOOL (), INT ().
. STEP 7 , :
1

BOOL ();

BYTE () 8- ;

16

WORD () 16- ;

32

DWORD ( ) 32- .

BOOL () , . (0) . CPU.


0 7. :

40

I 1.0

0 1;

Q 16.4

4 16.

3.5 ,

BYTE ()
, . . :
IB 2

2;

QB 18

18.

WORD ().
, .
W. :
IW 4

4; 4 5;

QW 20

20; 20 21.

DWORD ( ).
, . D.
:
ID 8

8; 8, 9, 10 11;

QD 24

24; : 24, 25,


26 27.

. :
DB 10.DBX 2.0

2.0 DB 10;

DB 11.DBB 14

14 DB 11;

DB 20.DBW 20

20 DB 20;

DB 22.DBD 10

10 DB 22.

18.2.2 .

( , symbol). . 24 . (
) . STL . SCL
# .

41

3 SIMATIC S7

( ) . (global) (local) , .

:
;
, , , ;
, ;
;
.
,
, . 00hex
FFhex. .
STL .
; .
,
2.5.2 .

. , .
. (
) ( ) .
#.
( ) #.

( Blocks ()).
, .
.

42

3.5 ,


, . ,
,
. .
() ,
( ) .

, , MSERIES[1] . LAD FBD (INT) (constant) .
, , FRAME.HEADER.CNUM.
.

(),
. : MVALUES
MVALUE1, MVALUE2 MTIME. :
MVALUES.MVALUE1
MVALUES.MVALUE2
MVALUES.MTIME

18.2.2
.
3.5.3
(data types) , , , . STEP 7
, (user-defined data types, UDT).
. LAD FBD .
(Elementary data types),
(Complex data types),
(User data types),
( ) (Parameter data types).
43

3 SIMATIC S7

3.3 .
, , LAD_Book FBD_Book
Data Types ()
.
3.3

BOOL, BYTE, CHAR,


WORD, INT, DATE,
DWORD, DINT, REAL,
S5TIME, TOD

DT, STRING,
ARRAY, STRUCT

,


(32 )

,
,

(DT, STRING)


UDT

(
),

TIMER, COUNTER,
BLOCK_DB,
BLOCK_SDB,
BLOCK_FC,
BLOCK_FB, POINTER,
ANY


( )

3.5.4
, , .
3.5 .
, (, TIME# T#).
.
()
3.4 .
(Name) () ( 24 , , ).
(Type) .

44

3.5 ,

3.4
(Name)


(Initial Value)
FALSE

(Comments)

Automatic

(Type)
BOOL

Manual_off

BOOL

TRUE

Measured_value

DINT

L#0

DINT

Memory

WORD

W#16#FFFF

WORD

Waiting_time

S5TIME

S5T#20s

S5TIME

(initial value). , . (Comments) .


BOOL (), BYTE (), WORD (), DWORD ( ),
CHAR ()
BOOL , , I 1.0.
BYTE, WORD DWORD ( ), 8, 16 32 . .
- (BCD) (count), ,
CHAR, ASCII- ().
BCD-
- (Binary coded decimal BCD)
. BCD- 16# () 0 9.
BCD-
. S5TIME#
( ),
16# C# - . C#
BCD- 000 999, 0.
, BCD- .
BCD- () ,
.
BCD- 16- , ,
15- . 0 , .
1 , .

45

3 SIMATIC S7

.
32- .
16- BCD-: 0 999. 32 - : 0 9 999 999.
3.5

BOOL
BYTE
CHAR
WORD

DWORD

INT
DINT
REAL

S5TIME
TIME

DATE
TIME_OF_DAY

46

()
(1 ) ( )
(8 ) 8-
(8 ) (ASCII)
(16 ) 16-
16-

, 3 () BCD
8-

(32 ) 32-
32-

8-

(16 )

(32 )

(32 ) (
)
(16 )
SIMATIC
(32 )
IEC
(16 )
(32 )


FALSE
TRUE
B#16#00, 16#00
B#16#FF, 16#FF
, , A
W#16#0000, 16#0000
W#16#FFFF, 16#FFFF
2#0000_0000_0000_0000
2#1111_1111_1111_1111
C#000
C#999
(0,0)
(255,255)
DW#16#0000_0000, 16#0000_0000
DW#16#FFFF_FFFF, 16#FFFF_FFFF
2#0000_00000000_0000
2#1111_11111111_1111
(0,0,0,0)
(255,255,255,255)
-32 768
+32 767
L#-2 147 483 648
L#+2 147 483 647
+1.234567+02

123.4567

S5T#0ms
S5TIME#2h46m30s
T#-24d20h31m23s647ms
TIME#24d20h31m23s647ms
T#-24.855134d
TIME#24.855134d
D#1990-01-01
DATE#2168-12-31
TOD#00:00:00
TIME_OF_DAY#23:59:59.999

3.5 ,

Char ()
CHAR (character, ) . CHAR
ASCII-, , A.
,
. , 3.6.
: $$ ASCII-.
MOVE () ASCII, ,
CHAR ASCII- .
3.6 CHAR
CHAR
$$
$
$L $l
$P $p
$R $r
$T $t

Hex ( )
24hex
27hex
0hex
0hex
0Dhex
09hex

(Dollar sign)
(Apostrophe)
() (Line feed, LF)
(New page, FF)
(Carriage return, CR)
(Tabulator)

INT ( )
INT (integer) (16- ). INT
.
.
0- 14- () .
15- (sign, S). 0 , , 1
. ( ). : +32 767 (7FFFhex)
-32 768 (8000hex).
DINT ( )
DINT (32-
). DINT-, 32 767
-32 768, L#.
DINT .
0- 30- . 31- .

47

3 SIMATIC S7

31, 0, ;
1, . ( ). :
+2 147 483 647 (7FFF FFFFhex)
2 147 483 648 (8000 0000hex).
REAL ()
REAL 32- ( ). REAL
.
. , 10. STEP 7 REAL-
.
REAL ,
( )
( ).
:
-3.402 823 10+38 1.175 494 10-38
0
+1.175 494 10-38 +3.402 823 10+38.

:
1.175 494 10-38 1.401 298 10-45

+1.401 298 10-45 +1.175 494 10-38.


CPU S7-300 ( CPU 318) .
. , , OV OS ( - overflow).

48

3.5 ,

BCD-, 3

CHAR
m

7 6 5 4 3 2 1 0

15

ASCII-

m+1

12 11

8 7
102

4 3
101

0
100

BCD-, 7
m+1

m
31

28 27

24 23

m+2

20 19

106

105

16 15

m+3

12 11

104

103

INT

15 14
14

8 7
102

4 3
101

0
100
0

13

2 2 20

S 2 2

DINT
15

31 30

16

S 230 229

216 215

22 21 20

REAL
31 30

23 22

S 2

-1

0
-2

2-23

2 2

S5TIME 15 14
100

0
102

101

100

15 14

DATE

215 214 213

0
22 21 20

TIME
31 30
30

16
29

S 2 2

16

15
15

0
2

2 21 20

TIME_OF_DAY
31 30
31

30

16
29

2 2 2

16

15
15

0
2

2 21 20

3.14 (S )

49

3 SIMATIC S7

REAL : (31 ), 8- 2 ( 23- 30-) 23-


( 0- 22-). 0 () 1
(). (, +127), 0 255.
. ,
1 ( )
0 ( ).
.
3.7

0
0

255
255

0
0

1 254

0
1

0
0

0
0

1 254

1
1

255
255

0
0

+
-

S5TIME
S5TIME STL, LAD FBD SIMATIC. 16- 1 + 3 .
(hours), (minutes), (seconds) (milliseconds). STEP 7 , BCD- 000 999. : 10 (0000), 100 (0001), 1 (0010) 10
(0011). .
:

50

S5TIME#500ms

(= 0050hex)

S5T#2h46m30s

(= 3999hex)

3.5 ,

DATE ()
DATE
. ,
01.01.1990. , , .
:
DATE#1990-01-01

(=0050hex)

D#2168-12-31

(=FF62hex)

TIME ()
TIME .
(d), (h), (m), (s) (ms),
.
(ms) 32- .
:
TIME#24d20h31m23s647ms

(= 7FFF_FFFFhex)

TIME#0ms

(= 0000_0000hex)

T#-24d20h31m23s648ms

(= 8000_0000hex)

TIME , ,
TIME#2.25h T#2.25h.
:
TIME#0.0h

(= 0000_0000hex)

TIME#24.855134d

(= 7FFF_FFFFhex)

TIME_OF_DAY ( )
TIME_OF_DAY .
( 00:00)
.
, , . , , . .

51

3 SIMATIC S7

:
TIME_OF_DAY#00:00:00

(= 0000_0000hex)

TOD#23:59:59.999

(= 0526_5BFFhex)

3.5.5
STEP 7 :
DATE_AND_TIME (DT, )
( BCD-);
STRING ()
254 ;
ARRAY ()
- ( );
STRUCT ()
- ( ).
:
STRING ( ), ARRAY STRUCT
().
3.8 DT STRING
Name
()

Type
()

Date1

DT

Date2

DATE_
AND_
TIME

Initial Value
( )
DT#1990-01-0100:00:00
DATE_AND_TIME#
2089-12-3123:59:59.999

First_Name

STRING[10]

Jack

Last_Name

STRING[7]

Daniels

NewLine

STRING[2]

$R$L

BlankString

STRING[16]

Comments
()
DT
DT
STRING, 4 10

STRING, 7
STRING,
STRING,

()
, ,
.

52

3.5 ,

( ).
DT STRING, , DATE
, IEC-. FC,
(Standard Library) IEC- (IEC Function Blocks).
DATE_AND_TIME ( )
DATE_AND_TIME ,
. DT DATE_AND_TIME.
DT- ASCII (
3.15).
STRING ( )
STRING (), 254 .
STRING.
,
. (254 ).
FC 254 .
STRING ,
.
ASCII, (),
( CHAR).
(initial) (pre-assigned) , . STRING ( ), , .
. 3.15 STRING.

53

3 SIMATIC S7

Year ()

0 99

(k)

n+1

Month ()

1 12

n+1

(m)

n+2

Day ()

1 31

n+2

n+3

Hour ()

0 23

n+3

n+4

Minute ()

0 59

n+5

Second () 0 59

n+m+1

n+6

ms ()

n+k+1

0 999
Week-day

n+7

STRING

DT

Week-day ( )
1 = Sunday ()
7 = Saturday ()

3.15 DT STRING
ARRAY ()
ARRAY , .
ARRAY
. . INT
32 768 +32 767. 6, .

ARRAY. ARRAY; .

( , /
). , .
.
,
. . .

54

3.5 ,

,
.
3.9
Name
()
Meas. val.

Type
()
ARRAY[1..24]

Initial Value
( )
0.4, 1.5, 11 (2.6, 3.0)

Comments
()
24 REAL

21 (TOD#08:30:00)

TOD 21

96 (L#0)

96

2 (a), 2 (b)

REAL
TOD

ARRAY[-10..10]
TIME_OF_DAY

Result

ARRAY[1..24,1..4]
DINT

Char.

ARRAY[1..2,3..4]
CHAR

()
ARRAY ANY
(). , - SFC 20 BLKMOV. , , .
, LAD FBD.
, . LAD FBD ( ).
,
6-. .
.

ARRAY ,
.
.

55

3 SIMATIC S7

BOOL () ;
BYTE () CHAR () .
.
( ), .
.
,
( ).
STRUCT ()
STRUCT , ,
.

STRUCT. , .
3.10
Name
()

Type
()

MotCont

STRUCT

Initial Value
( )

On

BOOL

FALSE

Comments
()
4

MotCont.On BOOL

Off

BOOL

TRUE

MotCont.Off BOOL

Delay

S5TIME

S5TIME#5s

MotCont.Delay S5TIME

maxSpeed

INT

5000

MotCont.maxSpeed INT

END_SRUCT

( , / ).
.

()
STRUCT ANY (). , STRUCT

56

3.5 ,

SFC 20 BLKMOV.
,
, .
,
, LAD FBD.
, .

STRUCT ,
.
. STRUCT-
.
BOOL () ;
BYTE () CHAR ()
. .
, .
6 . LAD FBD.
.
3.5.6
(parameter types)
( 3.11). () .
TIMER COUNTER
.
3.5.7
(user data type UDT) ( ) .
,
, .
UDT ; ,
. UDT ;
.
UDT ( ) .

57

3 SIMATIC S7

, UDT, UDT . UDT (UDT 0 UDT 65 535).


UDT . UDT .
Message
Frame Data ( ) 24.3
Message Frame Data ( ).
3.11

TIMER

16

15

COUNTER

16

16

BLOCK_FC

16

FC 17

BLOCK_FB

16

FB 18

BLOCK_DB

16

DB 19

BLOCK_SDB

16

POINTER

DB-

48

ANY

ANY-

80

SDB 100
P#M10.0
()
P#DB20.DBX22.2
()
MW 20
()
I 1.0
()
P#DB10.DBX0.0 WORD 20

UDT
SIMATIC, Blocks () Insert S7 Block
Data Type ( S7 ), File New ( ) UDTn Object Name
( ).
UDT , , . UDT , (Name),
(Type), (Initial value) (Comments).
,
(data view). ( UDT , ; ).
, UDT, .

58


LAD
FBD, . PLC
.
(ladder diagram, LAD) . (function block diagram, FBD) ,
, () AND () OR ().
RLO (Result of logic operation, ), , ,
, .
(move) .
. , CPU,
, , .
,
0999.
, , . . , .
, . ,
,
.
5
. 8 , .
FC .
(FB) 19
.

(binary logic)
(LAD), AND, OR OR (FBD); (); ( )

(memory functions)
LAD; FBD; (); ( );

(move functions)
MOVE,

(timers)
, ; IEC-

(counters)
; ( );
; IEC-;

4
4

....................................................................................................... 4
4.1
(LAD) .............................................................. 4
4.1.1
NO- NC- ............................................................................................. 4
4.1.2
.............................................................................................. 7
4.1.3
..................................................................................................... 7
4.1.4
..................................................................... 8
4.1.5
................................................... 10
4.2
(FBD) ..................................................................................... 11
4.2.1
................................................................ 11
4.2.2
................................................................... 17
4.2.3
................................................... 18
4.3
.......................................................................... 19

4.1

(LAD)
LAD ( ) (series) (parallel) .
AND (), OR ().
:
, ;
;
;
;
( ).
, ,
. LAD NO (
1) NC ( 0).
, (rung),
. , , (coil). RLO (power
flow, ) .
, , , , FB 104 Basic Functions (
), LAD_Book. ,
(Program Element Catalog) View
Catalog ( ) [Ctrl + K] Insert Program Elements ( ) Bit Logic ( ).

4.1.1 NO- NC-


,
contact closed (
), power flowing ( ) coil energized ( , / ).
(power) , ,
. (RLO) 1.
, . 1.
4

4.1 (LAD)

LAD : NO NC-.


(Normally-open, NO)


(Normally-closed, NC)

(NO-)
1.
1, NO- , .
4.1 ( ) , (sensor) S1
I 1.0 NO-. S1 , I 1.0 0, NO- . (contactor) K1, Q 4.0, .
S1 , I 1.0 1.
( ) NO- ,
K1, Q 4.0, . NO-
1 , , , NO NC, .
(NC-)
NC-, 0. 1, NC- , .
4.1 ( ) NC-,
S2 ( I 1.1 0). K2 Q 4.1.
S2 , I 1.1 1, NC . , K2
.
NC-
, ,
, NO- NC- ( 4.3 ).

NO-

S1

S1

I 1.0

Q 4.0

K1

I 1.0

Q 4.0

K1

NC-

S2

S2

I 1.1

Q 4.1

K2

I 1.1

4.1 NO- NC-

Q 4.1

K2

4.1 (LAD)

4.1.2
.
, .
4.2 . 1 (network 1)
;
. NO-.
1 ( NO- ), . , , 1. , Coil1 (1) 0.
2 (Network 2) NC-.
NC-,
0 ( NC- ). ,
, Contact4 (4)
1, Contact5 (5) 0.
4.1.3
,
. , .
4.2 . 3 (Network 3) ; .
NO-. 1, . , , 1. 0, , Coil3 (3)
0.
4 (Network 4) NC-.
NC-, 0,
, Contact4 (4) 1, Contact5 (5) 0.
LAD , 4.3, 8 (Network 8). , ,
, ( ). LAD ;
. (, open) -.


Network 1
Contact1

Contact1
Contact2

Contact3

Coil1

Contact2
Contact3
Coil1

Network 2
Contact4

Contact4
Contact5

Coil2

Contact5
Coil2


Network 3
Contact1

Coil3

Contact1
Contact2

Contact2

Contact3

Contact3

Coil3
Network 4
Contact4

Coil4

Contact5

Contact4
Contact5
Coil4

4.2
4.1.4
, ,
.
,
( 4.3).

4.1 (LAD)

,
Network 5
Contact1

Contact2

Contact3

Contact4

Coil5

Network 6
Contact5

Contact6

Coil6

Contact7

Contact0

,
Network 7
Contact1

Contact2

Contact3

Contact4

Coil7

Network 8
Contact5

Contact6

Contact0

Coil0

Contact7

4.3


. 4.3 . 5 (Network 5)
( ), Contact1 (1) Contact2 (2)
Contact3 (3) Contact4 (4) .
( 6, Network 6) , Contact5 (5)
Contact6 (6) Contact7 (7) Contact0 (0).


, . 4.3 . 7 (Network
7) ( ), Contact1 (1) Contact3
(3) Contact2 (2) Contact4 (4) .
( 8, Network 8), Contact5 (5),
Contact0 (0) Contact6 (6), Contact7 (7) .
4.1.5
NOT- (RLO). , , ,
( 4.4, 9, Network 9).
, NOT, Contact1 (1) Contact2 (2) ( ).
10 (Network 10), NOT . Coil10 (10) , .
NOT , ( ). NOT- ,
, .
NOT- ( RLO)
Network 9
Contact1

Contact1
Contact2

Coil9
Contact2

NOT

Coil9
Network 10
Contact3

Coil10
NOT

Contact4

Contact3
Contact4
Coil10

4.4 NOT-

10

4.2 (FBD)

4.2

(FBD)
FBD , , AND (), OR () Exclusive OR (
). , , () . :
, ( );
;
;
;
;
( ).
.
, ( ), (). .
FBD (, )
(binary logic circuit).
.
, (logic operation), , , . .
, , ,
FB 104 Basic Functions ( ),
FBD_Book. , , (Program Element Catalog) View Catalog (
) [Ctrl + K] Insert Program Elements ( ) Bit Logic ( ).

4.2.1
FBD AND (), OR () Exclusive OR ( ). () ( ). ,
; (),
11


(. ).

AND

OR

Exclusive OR

&

>=1

XOR


. ,
CPU.


, () .
1 0. 1, . 0 .


1

0

1 (scan result) 1,
1.
0, 0. 0 , 1, 0.
, .

NO- NC- .
: 0 NO-
( 4.5). 1
( ).
NC- NC12

4.2 (FBD)

0 ( ). 1, NC-, 0 .
1

S1

S1

0
I 1.0

1
I 1.0

S2

S2

0
I 1.1

1
I 1.1

4.5 1 0
, NC, NO, 1. 4.3 .
( - ) ;
Assign
13

() ( 5 ). ,
, . .
, , , , AND (), OR () Exclusive OR
( ).

&

&

AND (), .
AND ()
AND (RLO) 1, ( ) 1. AND , 1, RLO 1.
AND RLO
0.
4.6 AND. 1 (Network 1) AND
,
. 1, ()
AND. 1,
AND Output1 (1) 1
Assign () ( ). AND , Output1 (1) 0.
2 (Network 2) AND . () . 1, 0,
AND , Input4 (4) 1 Input5
(5) 0.

14

4.2 (FBD)

AND ()
Network 1
Input1

Input1
&

Input2

Input2
Input3

Input3

Output1

Output1
Network 2
Inupt4

Input4
&

Input5

Input5
Output1
Output2

OR ()
Network 3
Input1

Input1
>=1

Input2

Input2
Input3

Input3

Output3

Output3
Network 4
Input4

Input4
>=1

Input5

Input5
Output4
Output4

Exclusive OR ( )
Network 5
Input1

Input1
XOR

Input2

Input2
Output5
Output5

Network 6
Input4
Input5

Input4
XOR

Input5
Output6
Output6

4.6

15

OR ()
OR RLO
1, ( ) 1.
OR , ,
(RLO) 1, , 1. OR RLO 0,
0.
4.6 OR. 3 (Network 3) OR
; .
1, OR.
1, Output3 (3) 1. 0, OR ,
Output1 (1) 0.
4 (Network 4) OR . () . 1, 0, OR , Input4 (4) 1
Input5 (5) 0.
Exclusive OR ( )
Exclusive OR RLO 1, ( ) , RLO 0, ( ) .
4.6 OR. 5 (Network 5)
, 1, Exclusive OR. 1, OR , Output5 (5)
1. 1 0, Output5 (5) 0.
6 OR . () . 1, 0, OR ,
.
Exclusive OR
. OR (
),
1.

16

4.2 (FBD)

4.2.2
. ,
AND OR OR
OR. (
) .
T- ( )
, ( 5.2 FBD).
. 4.7 .
9 (Network 9): (limit
switches) X Y. ; .
10 (Network 10): , , OR
AND.

Network 9
x_front

&
>=1

x_back
y_front

&

Limit_switch_
error
=

y_back
Network 10
Input1
Input2

&

XOR
Output8

Input3

Input4
Network 11
Input5

>=1
&

Input6
Input7

Output9
=

4.7

17

11 (Network 11): (), RLO, , , RLO OR AND.


4.2.3

. ()
, 0 (. ),
( )
( , , , RLO = 0).
T-.
4.8 NAND ( AND ) NOR ( OR ). RLO
NAND 0 , 1.
NOR RLO 1 , 1.
NAND ( )
Network 1
Input1

Input1
&

Input2

Input2
Input3

Output7

Input3
Output7

NOR ( )
Network 2
Input1

Input1
>=1

Input2

Input2
Input3

Output0

Input3
Output0

4.8 NAND NOR

18

4.3

4.3


(sensor) , NC NO. ,
: 1 NO- 0, NC-. CPU
, NO- NC-.
1 0.

LAD-
, 1 ,
, -. NO- NC-.
NO- 1, 1. NC-
1, 0. ,
() ,
, 0 ( ),
(re-gate) .
4.9
. NO-
, NO- NC-. , , ,
. NO- , 1,
NO-, , . NO- , , .
NC-, 0.
,
NC-. , NO- NC-

.

19

1: NO-

S4

S3
0

I 1.2

S4

S3
0

I 1.3

Q 4.2

I 1.2

Q 4.2

I 1.3

K3

K3

2: NO- NC-

S6

S5
0

I 1.4

S6

S5
1

I 1.5

Q 4.3

I 1.4

I 1.5

Q 4.3

0
K4

K4

4.9 (LAD)

20

4.3

FBD-
, 1 ,
, -. NO- 1 , 1. NC-
0; 1 NC-, .
, ,
0 ( ),
.
4.10 , .
NO- ,
NO- NC-. , , , . NO-, 1, (), 1,
. NO-, AND ,
.
NC- , 0.
1 .
AND , .

21

1: NO-

S3

S3

S4

I 1.2

S4

I 1.2

I 1.3

&

I 1.3

&

Q 4.2

Q 4.2
0

K3

K3

2: NO- NC-

S5

S5

S6

I 1.4

I 1.5

S6

I 1.4

&
Q 4.3

&
Q 4.3

0
K4

1
K4

4.10 (FBD)

22

I 1.5

5
5

............................................................................................... 4
5.1
LAD ......................................................................................................................... 4
5.1.1
........................................................................................................ 4
5.1.2
......................................................................................... 5
5.1.3
() .............................................................................. 7
5.2
FBD....................................................................................................... 11
5.2.1
................................................................................................................ 11
5.2.2
...................................................................... 12
5.2.3
.......................................................................................... 14
5.3
........................................................................................................................... 18
5.3.1
LAD....................................................................................................... 18
5.3.2
FBD ....................................................................................................... 19
5.4
..................................................................................................... 21
5.4.1
....................................................................... 21
5.4.2
LAD .................................................................................. 23
5.4.3
FBD .................................................................................. 25
5.5
................................................................................................ 27
5.5.1
LAD............................................................................................................. 27
5.5.2
FBD ............................................................................................................. 27
5.6
......................................................................... 30

5.1

LAD
(ladder diagram, LAD) ( , memory functions)

(result of logic operation,
RLO), CPU.
( ):
(coil) () RLO;
R S ;
(boxes) RS SR , ;
(midline outputs) ;
P N ()
( );
POS NEG .
.
.
.
, ,
105 Basic functions ( ), LAD_Book.
, .
: View Catalog ( ) [Ctrl + K] Insert Program Elements
( ) Bit logic ( ).

5.1.1
, ( ) ,
(assigns) ( ) , .
(Master Control Relay, MCR). MCR , , , 0.
4

5.1 LAD

( ), ; ,
() ( 5.1, 1, Network 1).
NOT- ( 2, Network 2).
, , - ( 3, Network 3). , , . 16 .
- ( 4, Network 4).
4.1 (LAD).
5.1.2
(set coil, reset coil) . , .

,
1. , 0 ().
( 5.1, 5 6, Network 5, 6).
(MCR).
MCR , .
, , ,
( - complete restart). . (,
warm restart), ( ,
) CPU (, ).

(single coil)
Network 1

Contact1

Contact1

Coil1
Coil1

Network 2

Contact1

Contact1

Coil2
Coil2

NOT
Network 3
Contact2

Coil3
Coil4

Contact2
Coil3
Coil4
Contact3

Network 4
Contact3

Coil5
Contact4

Coil6

Contact4
Coil5
Coil6

(set coil reset coil)


Network 5

Contact1

Contact1

Coil7
S

Network 6

Coil7
Contact2

Contact2

Coil7
R

Coil7

Network 7
Contact3

Contact4

Coil8
S
Coil9
R

Contact3
Contact4
Coil8

Coil10
S

Coil9

Coil11

Coil10
Coil11

5.1 ,

5.1 LAD

( 7, Network 7). , ,
. , .
,
.
5.1.3 ()

(memory box).
. S (set input) , R (reset input) . , ,
Q .
: SR (
) RS ( ). S R.

SR

SR
S

RS

RS
R

(, , ), 1,
0. , 1
, 0 - . 0
. 1, -: SR , RS .
.
MCR , .
7

, , , ( ) . . (, ), ( , )
CPU (, ).
SR ( )
SR (reset input).
, ,
. ( 5.2, 8, Network 8).
, CPU
(memory operand), , , . , .
, , () . CPU
.

, ( 0)
.
RS ( )
RS (set input). , ,
. ( 5.2, 9, Network 9).
CPU , , , . , .
, , () . CPU
.

. , , ,
(still)

5.1 LAD

, .
(memory boxes)
Memory1

Network 8

Contact1

SR

Contact1
S

Contact2

Contact2
Memory1

R
Memory2

Network 9

Contact3

RS

Contact3
R

Contact4

Contact4
Memory2

()
Memory3

Network 10
Contact1

SR

Contact2
S

Contact3

Coil12

Contact4
R
Contact5
Contact6

Contact7

Network 11
Contact1

Memory4

Memory6

SR

SR

Coil13
Q

NOT

Contact2
R
Memory5
RS

Contact3
R

NOT

5.2 (LAD)


.
, ( 5.2, 10, Network 10).
. . ( 11, Network 11).
- ,
( ).


(latching) .
. , : .
12 13 (Network 12, 13) 5.2 , , .
. , ,
, ( ) () . Contact1 (1) , Coil14 (14) , Contact1 (1). Contact1 (1) , Coil14 (14)
. Coil14 (14) ,
Contact2 (2). 1 Contact1
(1) Contact2 (2), ( ).
- . 1
Contact3 (3) Contact4 (4),
( ).
(latching)
Network 12
Contact1

Contact2

Coil14

Coil14

Network 13
Contact3
Coil15

Coil15
Contact4

5.2 (LAD)
10

5.2 FBD

5.2

FBD
FBD (RLO), CPU.
:
(assign box) ;
(set) (reset) ;
RS SR ;
(midline output box) ;
P N ()
;
POS NEG .
.
, ,
.
(edge memory bits).
, , ,
, FB 105 Basic Functions ( ), FBD_Book. ,
,
, View Catalog ( ) [Ctrl + K] Insert Program Elements ( ) Bit logic (
).

5.2.1
(assign) ( ) () , . RLO 1 , ; RLO 0,
. (MCR). MCR ,
0.

11


5.3.
1 (Network 1): Output1 (1) Input1 (1).
2 (Network 2): ,
.
3 (Network 3): RLO - ( ). .
4 (Network 4): - ,
.
4.2 (FBD).
5.2.2


(set box reset box)
( ). , ,
, 1.


S

R

RLO, , 1,
1. RLO,
, 1, 0. RLO,
, 0, . (MCR). MCR
, .
12

5.2 FBD

(Assign)
Network 1

Input1

Output1
=

Input1
Network 2

Output1
Input1

Output2
=

Input1
Network 3

Output2
Input2

Output3
=

Input2

Output3

Output4
Output4

=
Network 4

Input3

Output5
=

Input3

&

Input4
Output6
=

Input4

Output5
Output6

(Set, Reset)
Network 5

Input1

Output7
S

Input1
Network 6

Output7
Input2

Output7
R

Input2

Output7

Network 7
Input3
Input4

Input3
&

Output8

Input4

S
Output9
R
Output10
S

Output8
Output9
Output10

Output11
=

Output11

5.3 , (FBD)

13

5.3
.
5 (Network 5): Output7 (7) , Input1
(1) 1. Input1 (1) 0,
Output7 (7) .
6 (Network 6): Output7 (7) , Input2
(2) 1. Input2 (2) 0,
Output7 (7) .
7 (Network 7):
-. ,
-
.
, , .
.
, , , ( complete
restart). .
(, warm restart),
(, ) CPU ( , ).
5.2.3

. .
S (set box), R (reset box). , , Q .
, :
SR ( ) RS ( ).
S R.
( ), (set input) 1 (reset input) 0. , 1,
0.

14

5.2 FBD

SR

SR
S

RS

RS
R

0 . 1 , -: SR ,
RS .
(MCR). MCR ,
.
, , , ( ).
. (, ), ( , )
CPU ( , ).
SR
SR (reset input).
, , RLO
1 . , ( 5.4, 8, Network 8).
, CPU , , , . , .
,
, ()
. CPU
.

, ( 0)
.

15

(memory function)
Network 8

Output12
Input1

SR
Input1

Input2

Network 9

Input2
Output12

Q
Output13

Input3

RS
Input3

Input4

Input4
Output13

(memory function)
Network 10:
&

Input1

>=1

Input2
Memory1
Input3

&
S

Input4
Input5

SR

>=1

Input6

Output14
=

Input7
Network 11:
Memory2
Input1

&

SR
S

Input2

Memory4
SR

Input3

Memory3
SR
Input4

S
R

Q
Input5

5.4 (FBD)

16

&

Output15
=

5.2 FBD

RS
RS (set input). , ,
RLO 1 .
( 5.4, 9, Network 9).
, CPU
, , , . , .
, , () . CPU
.
, . , , , (still) , .

.
, (
5.4, 10, 11, Network 10, 11). .
.
-.

17

5.3

(midline outputs)
. RLO, , . , (post-process) RLO, , .
:
, .
.
; , .
CPU
; ( ).
, , ( ).
(MCR).
MCR , , , 0. RLO
0 ( ).
: (scratchpad memory)
, .

5.3.1 LAD
. RLO,
( , , ), . .

18

5.3

NO- NC-. .
, (
). -, ;
.
5.5 ,
. RLO , Contact1 (1), Contact2
(2), Contact4 (4) Contact5 (5),
Midl_out1 (1). (
), Contact3 (3) , Coil16 (16) . RLO (network) .
,
, Contact6 (6), ,
, Contact7 (7).
5.3.2 FBD
. RLO,
,
.

.
. ;
.
12 13 (Network 12, 13) 5.5 , . RLO , Input1
(1), Input2 (2), Input3 (3) Input4 (4),
Midl_out1 (1). ,
Input5 (5) 1, Coil16 (6) . RLO (network) .
,
, Input6 (6), -

19

, , Input7 (7).
(midline outputs) LAD
Network 14: (1)
Contact1

Contact2

Contact4

Contact5

Midl_out1
#

Contact3

Coil16

Network 15: (2)


Midl_out1

Contact6

Midl_out1

Contact7

Coil17

(midline outputs) FBD


Network 12: (1)
Input1

&
>=1

Input2
Input3

&

Midl_out1
#

Input4

Input5
Network 13: (2)
Midl_out1

&
>=1

Input6
Midl_out1

&

Input7

5.5

20

Coil17
#

&

Coil16
=

5.4

5.4

5.4.1
(edge evaluation) , . (), 0 1.
().
LAD FBD (pulse contact element).
, .
.
( )
. CPU RLO (, )
RLO. , .
RLO (edge memory bit) ( ). ,
, ( ), - .
, .
RLO, CPU . ,
RLO ,
CPU
RLO. ( ) ,
RLO ( ), CPU
.
(RLO)
. CPU , RLO 1
( ). ,
RLO 0.
, 1 (edge detected). 1 , . CPU ( ) ( RLO
), RLO 0
.

21

(edge evaluations) LAD


Network 16:
Memory7
Contact1

EMemBit1
P

Contact2

Contact5

EMemBit2
N

SR
S

Contact3
Contact4

Network 17:
Contact1

Memory0

POS

SR
Q

M_BIT

EMemBit3

Contact3
NEG

Contact2

M_BIT

EMemBit4

(edge evaluations) FBD


Network 14: RLO
Input1

>=1

EMemBit1
P

Input3

Memory1

&

SR
S

Input2
&

Input4

EMemBit2
N

Input5

Network 15:
Memory2

Input1
EMemBit3
Input3
EMemBit4

NEG
M_BIT

Input2
Q

5.6

22

POS
M_BIT

SR
Q

&
R

5.4

, CPU .
, RLO CPU.
( ).
5.4.2 LAD
LAD
:


POS
Q

M_BIT

NEG
Q

M_BIT

RLO , , , ,
( , pulse memory bit).
, RLO ; , , ( ). ,
, ,
.

23


, P ( ,
) N ( , ). , , RLO . , ,
( )
.
5.6 16 (Network 16)
. , Contact1 (1)
Contact3 (3), ,
EMemBit1 (1). Contact2 (2)
, Memory7 (7) . Memory7 (7)
EMemBit2 (2), , Contact4 (4) Contact5 (5),
.
, ( ).
( ).

LAD
(box). , . , , M_BIT.
Q
. , Q ; , Q . ,
, (
).
5.6
17 (Network 17). ,
Contact1 (1) 0 1 ( ). Memory0 (0).

( ). Contact2 (2). 1 ,

Contact3 (3) 1 0 ( ).

24

5.4

5.4.3 FBD
FBD
:

RLO

RLO

POS
M_BIT

NEG
M_BIT

RLO , , ,
( ). , RLO
; , , . , , . -
.
RLO
RLO , P
( , ) N ( , ). , , RLO . RLO RLO 1 RLO 0 .
, 5.6, 14 (Network 14), . OR, Input1
(1) Input3 (3), ,
EMemBit1 (1). Input2 (2) 1
, Memory1 (1) . Memory1 (1) 25

EMemBit2 (2), AND, Input4 (4) Input5 (5), .



.
,
. , , M_BIT. Q 1, CPU .
15 (Network 15) 5.6 . POS , Input1 (1)
0 1 ( ). NEG , , Input3 (3) 1 0 ( ). Input2 (2) 1,
Memory2 (2).

26

() (Memory () 1). Input ()


0, Memory () ( Output ()
). ,
.
(LAD)
Network 18: (1)
Output_1
Input_1

SR

Memory_1
S

Input_1

Memory_1
R

Network 19: (2)


Memory_1
Input_1

SR

Output_1
S

Input_1

Output_1
R

Network 20: (1)


Input_2

Memory_2

Input_2

Output_2

Output_2

Network 20: (2)


Input_2

Output_2

Input_2

Memory_2

Memory_2

5.8 (LAD)
Input () (
5.9, 18 20, Network 18 20). Input () , RLO, , 0,
(jump) JCN (
16 ). bin
20 (Network 20).
, . 28

5.5

19 (Network 19): Output () 0, ;


1, . , Input (). , ,
Input (), Output () .
(FBD)
Network 16: (1)
Input

Output
SR

&
S

Memory
Input

&
R

Memory

Network 17: (2)


Input

Memory
SR

&
S

Output
Input

&
R

Output

Network 18: (1)


Input0
EMemBit0

POS
M_BIT

bin
JMPN

Network 19: (2)


Output0

&

Output0
JMPN

Network 20: ( )
bin

5.9 (FBD)

29

5.6



, .


,
readyload (ready to load );
Start (),
;
end-of-belt ( ),
, (), , ready_rem (ready to
remove );
continue (),
, end-belt (end of belt )
.
, , . .
,
:
Basic_st
;
Man_on
;
/Stop
0 (NC- , );
End_belt
;
/Mfault
() (,

30

5.6

); , , , .
, ,
.
( 5.1), , ,
.
5.1 (Symbol Table)
Symbol
()
Belt_control

Address
()
FC 11

Data Type
( )
FC 11

Comment ()

Basic_st

I 0.0

BOOL

Man_on

I 0.1

BOOL

/Stop

I 0.2

BOOL

Start

I 0.3

BOOL


(
)

Continue

I 0.4

BOOL

Light_barrier1

I 1.0

BOOL

/Mfault

I 2.0

BOOL

Readyload

Q 4.0

BOOL

Ready_rem

Q 4.1

BOOL

Belt_mot1_on

Q 5.0

BOOL


( ) End of belt (
) 1 (belt 1)
1,

(ready to load,
)
(ready to remove, )
1

Load

M 2.0

BOOL

Remove

M 2.1

BOOL

EM_Rem_N

M 2.2

BOOL

remove

EM_Rem_P

M 2.3

BOOL

remove

EM_Loa_N

M 2.4

BOOL

load

EM_Loa_P

M 2.5

BOOL

load

LAD
, 1 ( FC Blocks,
FC) CPU.
. 19
().
,
, (
).
31

, .
(, ),
. ,
.
5.10 . , ,
LAD_Book FC 11 Conveyor Example ( ).
FC 11
Network 1:

Network 2:

Load

Ready_rem

SR

Start

Load

Lbarr1

Remove
R

Basic_st

Basic_st

/Mfault1

/Mfault1

Network 3:

EM_Rem_P
P

Readyload

SR
S

Remove
Q

Lbarr1

SR

EM_Rem_N
N

EM_Loa_P
P

Basic_st
R

Basic_st

Load

/Mfault1

/Mfault1

Network 5:
Load

/Stop

/Mfault1

Belt_mot1

Remove
Man_on

5.10 (LAD)
32

Network 4:

Remove
Continue

SR

EM_Loa_N
N

5.6

FBD
,
1 ( FC Blocks, FC) CPU.
19
(). , , (
).
, .
(, ),
. ,
.
5.11 (, ) .
, ,
FBD_Book FC 11 Conveyor Example ( ).
FC 11
Network 1:
Load
SR

Start
Lbarr1

S
>=1

Basic_st
/Mfault1

Network 2:

Load

Remove

Ready_rem
SR
S
>=1

Basic_st
/Mfault1

5.11 (FBD)

33

5.5

5.5


(binary scaler), , . , 0 1, ( 5.7).
, ,
. . , .

Input

Output

5.7
5.5.1 LAD
, .
( 5.8, 8 9, Network 8, 9).
Input_1 (_1) 1, Output_1 (_1) ; Memory_1 (_1) . Input_1 (_1) 0, Memory_1 (_1) (Output_1 (_1) 1). Input_1
(_1) 1, Output_1 (_1) (Memory_1 (_1)
1). Input_1 (_1) 0, Memory_1 (_1)
( Output_1 (_1) ). ,
.
, ( 20 21, Network 20, 21) . , , , (zero active).
5.5.2 FBD
-. .
( 5.9, 16 17, Network 16,
17). Input () 1, Output ()
( Memory () ). Input () 0, Memory () (Output () 1). Input () 1, Output
27

FC 11
Network 3:
Remove
SR

Continue
Lbarr1

S
>=1

Basic_st
/Mfault1

Network 4: ()
Remove

Basic_st
Load

Readyload
SR

>=1
S

>=1
R

/Mfault1

Network 5:
Load

>=1

Remove
Man_on

&

/Stop
/Mfault1

5.11 (FBD)

34

Belt_mot1
=

6
6

....................................................................................................................... 4
6.1
................................................................................................................... 4
6.2
MOVE ....................................................................................................... 6
6.2.1
MOVE.......................................................................... 6
6.2.2
............................................................................................... 9
6.2.3
........................................................................................................ 11
6.3
....................................................................... 12
6.3.1
ANY .................................................................................................... 12
6.3.2
..................................................................................... 13
6.3.3
.............................................................. 14
6.3.4
........................................................................................ 14


LAD FBD move-
( , ):
MOVE
;
SFC 20 BLKMOV
;
SFC 21 FILL
;
SFC 81 UBLKMOV
.
SFC Standard Library System Function Blocks ( ).

6.1



(system memory), (user memory) ( 6.1).
CPU, ( ).
1 (accumulator 1).
1 (loading), 1 (transferring).
MOVE .
IN 1 () 1
().

6.1

(System memory)


(Work memory)

L-

(Modules)

MOVE


(System memory)

L-


(Work memory)

(Modules)

6.1 (Loading) (Transferring)

6.2

MOVE

6.2.1 MOVE

(enable input) EN
ENO MOVE IN OUT. IN
OUT
( BOOL ).
IN OUT .
MOVE
MOVE

LAD
EN

ENO

IN

OUT
MOVE

FBD
EN

OUT

IN

ENO

3.5 , .
MOVE, , (Program Element Catalog), View Catalog ( ) [Ctrl + K] Insert Program
Elements ( ) Shift ().

(, , ) MOVE . , ,
( ) .
,
, .
6.2 . 1, . OUT 1 .

6.2 MOVE
IN
7

(n)

0 7

(n+1)

0 7

(n+2)

0 7

(n+3)

(n)

0 7

(n+1)

(n)

(n)

31

24

23

16

15

(n)

0 7

(n+1)

0 7

(n)

0 7

(n+1)

(n+2)

0 7

(n+3)

OUT

6.2

MOVE IN
OUT. MOVE , (enable input) 1 , (master control relay, MCR) .
EN = 1 MCR , OUT . 0 OUT .
MOVE .
EN == 1

ENO := 1
MCR

ENO := 0
OUT := 0
OUT := 1

(input word) IW 0 (memory


word) MW 60.
LAD:
MOVE

IW 0

EN

ENO

IN

OUT

MW 60

FBD:
MOVE

IW 0

EN

OUT

IN

ENO

MW 60

MOVE (LAD)
EN ENO .
MOVE , ( ).
EN, .
( ) MOVE . , . , , ,
.
MOVE .
ENO EN .
MOVE ( , , ),
, .
, ( LAD_Book FB 106 Basic Functions,
).

6.2 MOVE

MOVE (FBD)
MOVE
,
EN. ENO ;
, MOVE , ENO EN
.
EN ENO .
, ,
FBD_Book, FB 106 Basic Functions ( ).
6.2.2
,
(. 7 8 ). 18.2

.

IB n

IW n

ID n

CPU ,
(. 1.5.2 ).

QB n

QW n

QD n

CPU
, (. 1.5.2 ).

I/O ( /)
PIB n

PIW n

PID n

PQB n

PQW n

PQD n

/ ( I/O-)
. I/O- ( PI) IN MOVE I/O- ( PQ) OUT.
I/O ( /) ( ), (peripheral inputs, PI). . , I/O- ( /)
,
. ( CPU ), , I/O-, .
(peripheral outputs, PQ) I/O. , I/O-.
I/O-, , ,
.

MB n

MW n

MD n

, CPU. , CPU .

10

6.2 MOVE


LB n

LW n

LD n

L- . 18.1.5 .
6.2.3
IN MOVE.

, , .
, . 3.5.4
. , MOVE, . :
B#16#F1

1000

( INT)

5.0

( REAL)

S5T#2s

S5

TOD#8:30


(pointers) , . MOVE .
P#1.0

(area-internal pointer)

P#M2.1

(area-crossing pointer)

11

6.3


:
SFC 20 BLKMOV
;
SFC 21 FILL
;
SFC 81 UBLKMOV
.
ANY ( 6.1). ,
, .
, ();
( , ) .
ANY ().

6.1 SFC 20, 21 81


SFC

20

21

81

ANY

SRCBLK

INPUT

RET_VAL

OUTPUT

INT

DSTBLK

OUTPUT

ANY

BVAL

INPUT

ANY

RET_VAL

OUTPUT

INT

BLK

OUTPUT

ANY

SRCBLK

INPUT

ANY


,
( )
,

RET_VAL

OUTPUT

INT

DSTBLK

OUTPUT

ANY

6.3.1 ANY
, ,
ANY, .
ANY- :
P#[DataBlock]Operand Type Quantity

12

(P#[] )

6.3

:
P#M16.0 BYTE 8

8 , MB 16

P#DB11.DBX30.0 INT 12

12 DB 11, DBB 30

P#I18.0 WORD 1

IW 18

P#I1.0 BOOL 1

I 1.0

, ANY
.
ANY- ,
, . , ANY . , P#I1.0
BOOL 1 I 1.0 .
6.3.2
SFC 20 BLKMOV ( SLCBLK) ( DSTBLK) ( ).
:
(I), (Q),
(M) ( );
( ANY
);
, ANY.
SFC 20 , ( ) ( SDB).
,
.
( , UNLINKED, )
.
. , ,
.

13

( 6.3, 6.3, 4, Network 4): ()


MB 64, 16 DB 124, DBB 0.
6.3.3
SFC 81 UBLKMOV
( SRCBLK) ( DSTBLK) ( ). , .
512 .
:
(I), (Q),
(M) ( );
( ANY
);
, ANY.
SFC 81 , ( )
( SDB)
( , UNLINKED, ).
,
.
. , ,
.
6.3.4
SFC 21 FILL ( ) ( )
. (
). :
(I), (Q),
(M) ( );

14

6.3

, ANY;
( ANY
).
SFC 21 , ( )
( SDB).
,
.
. , , .
( 6.3, 6.3, 5, Network 5): ()
MB 80 16 DB 124, DBB 16.
(LAD)
Network 4: SFC 20 BLKMOV
SFC 20

Contact2
EN
P#M 64.0 BYTE 16

SRCBLK

ENO
RET_VAL
DSTBLK

MW 82
P#DB124.DBX0.0 BYTE 16

Network 5: SFC 21 FILL


SFC 21

Contact3
EN
P#M 80.0 BYTE 1

BVAL

ENO
RET_VAL
BLK

MW 84
P#DB124.DBX16.0 BYTE 16

6.3 SFC 20 BLKMOV SFC 21 FILL

15

(FBD)
Network 4: SFC 20 BLKMOV
SFC 20
Input2
P#M 64.0 BYTE 16

EN

RET_VAL

SRCBLK

DSTBLK

MW 82
P#DB124.DBX0.0 BYTE 16

ENO
Network 5: SFC 21 FILL
SFC 21
Input3
P#M 80.0 BYTE 1

EN
BVAL

RET_VAL
BLK
ENO

6.3 SFC 20 BLKMOV SFC 21 FILL

16

MW 84
P#DB124.DBX16.0 BYTE 16

7
7

......................................................................................................................................... 3
7.1
.................................................................................................. 4
7.1.1
................................................................................... 4
7.1.2
................................................................................................................ 6
7.1.3
............................................................................ 6
7.1.4
................................................................................................................. 8
7.1.5
................................................................................................................ 8
7.1.6
................................................................ 9
7.1.7
(LAD) ................................................................... 10
7.1.8
(FBD).............................................. 10
7.2
............................................................................................................. 11
7.3
..................................................................................... 13
7.4
............................................................................................... 15
7.5
.................................................................. 17
7.6
............................................................................................ 19
7.7
IEC-.......................................................................................................................... 21
7.7.1
SFB 3 TP .................................................................................... 22
7.7.2
SFB 4 TON .................................................................. 22
7.7.3
SFB 5 TOF ................................................................ 23

7.1

(Timers) , ,
.
:
(Pulse timers);
(Extended pulse timers);
(On-delay timers);
(Retentive on-delay timers);
(Off-delay timers).
. , ;
. (Timer running,
) ,
- (BCD) .

( : )
LAD:

FBD:

S_PULSE
S

TV

BI

TV

S_PULSE

BCD

BI
BCD

BOOL

S5TIME

BOOL

BI

WORD

BCD

WORD

BCD-

BOOL

S
TV

7.1 (timer box)

7.1

7.1.1
:
, ;
() ;
() ;
() ;
() BCD-.
( 7.1). .
(S_PULSE Start pulse
timer ). S TV , .
LAD

( 7.2).
. (SP = start pulse timer ), S5TIME, (duration). ,
. NO- NC- . , MOVE.
FBD

( 7.3).
, (SP = start pulse timer
). S5TIME, . ,
. . ,
MOVE.

7.1


(
)


SP


( )


(NO-, NC-)

( MOVE)

MOVE

EN

ENO

IN

OUT

7.2 (LAD)
(Program Element
Catalog), View Catalog ( ) [Ctrl + K]
Insert Program Elements ( ), Timers ().


SP


( )

TV

R


( )
(
)


( MOVE)

MOVE

EN

OUT

IN

ENO

7.3 (FBD)

7.1.2
, (RLO) (start input) / .
, . RLO 1 0;
RLO 0 1.
( 7.4). ,
, .

SP
S_PULSE

SE
S_PEXT

SD
S_ODT

SS
S_ODTS

SF
S_OFFDT


(Start signal)
t

7.4
7.1.3
, /
, TV.
, S5TIME.

S5TIME#10s
S5T#1m10ms

10
1 + 10

, , . S5TIME#10s S5TIME#2h46min30s ( 9990 ).


10 .
S5TIME# S5T#.

7.1


MW 20
Time1

,
S5TIME

16- S5TIME (.
).

(time value) (time base): = .
, (
). , .
, CPU
( 7.5).

15

12

11

8 7
102

101

100

- (BCD)

- (BCD): 0 = 0.01 s
1 = 0.1 s
2=1s
3 = 10 s

7.5
16- .
, . ,
, ,
:
= 2001hex

= 1010hex

100

= 0100hex

10

.
CPU .
, -

. , . CPU ( 0
1 , , ) . (0 W#16#0000) , ,
CPU , .
. , .
(. ), .
7.1.4
LAD: , (reset input) (reset coil) ( RLO 1).
, NO- 0, NC 1.
FBD: , 1. , 0, 1.
. R
(
).
7.1.5
(LAD)
Q .
NO- (
Q) NC-. NO-
Q (. ). , , NC-
, NO-. Q .
(FBD)
Q .

( Q). -

7.1

(. ). Q .
(time value)
BI BCD (BI) - (BCD) .
( , ). ( MOVE).
.

-
. 0. INT ().
, !

MOVE.

. ,
- . BCD- , (. ).
7.1.6

. , .
.
, ,
:
(Start);
(Reset);
;
.

. , , , .
, .
7.1.7 (LAD)
(start input) (reset input)
, Q.
- , ().
, .

LAD_Book , FB 107 Basic Functions
( ).
7.1.8 (FBD)
, Q,
.

-.

FBD_Book , , FB 107 Basic
Functions ( ).

10

7.2

7.2


7.6 ,
, . ,
,
7.1.6 .
c

(start input) 0 1 ( ), .
, 1. Q
1.
,
.

0
, . Q 0. ,
, .



( 7.6).
e

1 (reset input)
. Q 0. . 1 0,
1, .

1
.

0 1 ( ), , , ( ).
,
.

11

g
t






()

( 1)
t -

7.6

12

7.3

7.3


7.7 , . , , 7.1.6 .
no

0
1 ( ), .
,
0. 1 ( ) 1, .
,
.

0 1 ( ) , ( ). ,
.



( 7.7).
q

1 . 1 ( ) 0 .
.

1 .

st

0 1 ( ) , ,
( ). , .

13

o
t

q
t

t
t






()

( 1)
t -

7.7

14

7.4

7.4


, 7.8,
, . , , 7.1.6 .
c

0
1 ( ), . . 1 1,
, -
1 ( ).
,

.

1 0, . 1 ( )
1.
.


( 7.8).
ef

1 .
1 ( )
0, , 1.
.
1 0 1 .

0 1 ( ) , ,
( ).

, .

15

g
t






()

( 1)
t -

7.8

16

7.5

7.5


, 7.9,
, . , , 7.1.6 .
no

0
1 ( ), .
,
0.
1 ( )
1
. 0 .
, .

0 1 ( ) ,
( ). , .



( 7.9).
qr

1
.
1 ( )
0.
.

0 1 ( ) , ,
( ). , .

17

o
t

p
t






()

( 1)
t -

7.9

18

7.6

7.6


, 7.10,
, . , , 7.1.6 .
ce

, 1 0 ( ).
.
1 ( )
1, 1, ( ).
, .

0 1 ( ) , .
.



( 7.10).
f

1 . 1 ( ) 0.
.

gh

1
. 1 ( ) 0. 0, 1.

1 0 ( ) , ,
( ).
1 ( )
0.

19

d
t






()


( 1)
t -

7.10

20

7.7 IEC-

7.7

IEC-
IEC- CPU ( SFB).
CPU :
SFB 3 TP
(pulse timer);
SFB 4 TON
(on-delay timer);
SFB 5 TOF
(off-delay timer).
7.11 .


IN
Q
SFB 3 TP
Q
SFB 4 TON
Q
SFB 5 TOF
t

t -

7.11 IEC-
SFB
. Standard Library System Function Blocks ( ).

LAD_Book FBD_Book, FB 107 Basic
Functions ( ).

21

7.7.1 SFB 3 TP
IEC- SFB 3 TP 7.1.
7.1 IEC-

IN

INPUT

BOOL

PT

INPUT

TIME

OUTPUT

BOOL

ET

OUTPUT

TIME

( )

RLO 0 1, .

RLO .
Q 1.
Q.
T#0s . ,
IN 0. IN 0 ,
T#0s, .
, = T#0s.
SFB 3 TP CPU START RUN. () .
7.7.2 SFB 4 TON
IEC- SFB 4 TON 7.1.
, RLO 0 1.
. Q 1, , 1. RLO 1 0
, .
.
.
T#0s . ,
IN
0. IN , T#0s.
, = T#0s.

22

7.7 IEC-

SFB 4 TON CPU START RUN.


.
7.7.3 SFB 5 TOF
IEC- SFB 5 TOF 7.1.
Q 1, RLO
0 1. , RLO
. , Q
1.
Q , . RLO
1 , , Q 1.
.
T#0s . ,
, ,
IN 1. IN 1 ,
T#0s.
, = T#0s.
SFB 5 TOF CPU START RUN.
.

23

8
8

........................................................................................................................................ 4
8.1
................................................................................................. 4
8.2
................................................................................................ 9
8.3
........................................................................................................................... 10
8.4
..................................................................................................................... 11
8.5
IEC-......................................................................................................................... 12
8.5.1
SFB 0 CTU ............................................................................ 12
8.5.2
SFB 1 CTD ......................................................................... 13
8.5.3
/ SFB 2 CTUD ....................................................... 13
8.6
.................................................................................................... 15

(counters) CPU . ( ) (
). ( 000 999). CPU; CPU.

.
, .
( ) ( , count value),
, - .

8.1


:
, ;
;
;
;
() ;
() ;
() - .



( 8.1). .
(S_CUD up-down counter,
). ( CU) ; .
:
(up-down counter, S_CUD), (up counter, S_CU)
(down counter, S_CD). .

8.1


( : )
LAD:

FBD:

S_CUD
CU

CU

CD

CV

CD

CV

S_CUD

CV_BCD

PV

PV

CV_BCD

CU

BOOL

CD

BOOL

BOOL

PV

WORD

BOOL

CV

WORD

CV_BCD

WORD

BOOL

8.1 (counter box)


(Program Element
Catalog), View Catalog ( ) [Ctrl + K]
Insert Program Elements ( ),
Counters ().
(LAD)
, ( 8.2).
. () (SC = Set Counter, ); WORD, .
CU (count up) , CD (count down)
. , , NO-
NC- .
, MOVE.


( )


CU


( )


CD

,
(
)


SC


( )


(NO-, NC-)


( MOVE)

MOVE

EN

ENO

IN

OUT

8.2 (LAD)
(LAD)
, , Q .
- ,
( ).
.

, , LAD_Book,
FB 108 Basic Functions ( ).
(FBD)
, ( 8.3).

.
(SC = Set Counter, ); PV
WORD, .

8.1


( )


CU


( )


CD

,
( )


SC
PV


( )
(
)


( MOVE)

MOVE

EN

OUT

IN

ENO

8.3 (FBD)
CU (count up) , CD (count
down) . ,
, .
, MOVE.
(FBD)
, , Q .
,
-.

, , FBD_Book,
FB 108 Basic Functions ( ).



. , .
, ,
,
.
,
, :
( );
;
;
;
.
. ,
, , . , ,
0.

, ,
,
.
.

8.2

8.2


, RLO 0 1 S
. . (Set counter)
, .
0 999.

,
PV .
, WORD.

C#100
W#16#0100

100
100

000 999. BCD-; .


C# W#16# (
).

MW 56
Count value

,
WORD.

(LAD)
,
( RLO 1). NO- 0, NC- 1. . R ().
(FBD)
, 1 . 0, 1.
. R ().

8.3

!
, , CPU
, ( )
, , . ,
, .


, RLO 0 1
CU (up count input) ,
. .

999.
. .

RLO 0 1 CD (down count input) , . .

0.
.
.

:
S_CUD

/ ;

S_CU

S_CD


. S_CUD , S_CU
, S_CD .
.
(S_CD) S_CUD, S_CU.

10

8.4

8.4

(LAD)
Q .
NO- ( Q) NC-.
Q 1 ( ),
. Q 0, .
Q .
(FBD)
Q .
( Q) .
Q 1, . Q 0, . Q
.
(LAD FBD)
CV CV_BCD
(CV) - (BCD). ,
, .
( , MOVE).
( ).


. INT.
MOVE.


. - (BCD) (. ).

11

8.5

IEC-
IEC- CPU ( SFB). CPU
:
SFB 0 CTU
;
SFB 1 CTD
;
SFB 2 CTUD
/ .
SFB .

Standard Library System Function Blocks ( ).

LAD_Book FBD_Book, FB 108 Basic
Functions ( ).

8.5.1 SFB 0 CTU


IEC- SFB 0 CTU , 8.1.
8.1 IEC-
SFB

12

CU

INPUT

BOOL

CD

INPUT

BOOL

INPUT

BOOL

LOAD

INPUT

BOOL

PV

INPUT

INT

OUTPUT

BOOL

QU
QD
CV

2
2
2

OUTPUT
OUTPUT
OUTPUT

BOOL
BOOL
INT

8.5 IEC-

CU 0 1 ( ), 1 CV. ( 0 R)
PV.
32767, , CU
.
, R 1.
R 1, CU . CV PV, Q 1.
SFB 0 CTU CPU START RUN. .
8.5.2 SFB 1 CTD
IEC- SFB 1 CTD , 8.1.
CD 0 1
( ), 1
CV. ( 0
LOAD) PV.
32768, , CD
.
LOAD 1, PV. LOAD 1, CD .
CV , Q 1.
SFB 1 CTD CPU START RUN. .
8.5.3 / SFB 2 CTUD
IEC- SFB 2 CTUD , 8.1.
CU 0 1 ( ), 1 CV. CD 0
1 ( ), 1
CV. , .
32767, CU. CU .

13

32768,
CD. CD .
LOAD 1,
PV. LOAD 1, .
, R 1. R 1, 1 LOAD .
QU 1, CV
PV.
QD 1, CV .
SFB 2 CTUD CPU START RUN. .

14

8.6

8.6


.
, ,
. ; .
,
, 19 .


.
. Finished (). ().

, ( ) .
Set () (, ) .
.
Finished ().
( ) .
Set () Active ().
. ,
, Active () .

Duration1 (Durat1, 1) (retentive pulse timer). 0 , . , .
,
. Duration2 (Durat2, 2).
, Durat1,
, Durat2, Fault (). Durat2.

15

,
Set () ( ).
, ,
( ) . , (,
) . ( ) .
() ( ).
, ,
. ( , , ,
).
,
, . ( 8.2), , ,
, , .
8.2
Symbol
()
Counter_control

Address
()
FC 12

Data Type
Comment
( ) ()
FC 12

Acknowl

I 0.6

BOOL

Set

I 0.7

BOOL

Lbarr1

I 1.0

BOOL

Finished

Q 4.2

BOOL

,
1 End_of_belt
(_)

Fault

Q 4.3

BOOL

Active

M 3.0

BOOL

EM_LB_P

M 3.1

BOOL

EM_LB_N

M 3.2

BOOL

EM_Ac_P

M 3.3

BOOL

EM_ST_P

M 3.4

BOOL

Quantity

MW 4

WORD

Monitor active ( )
Set ()

Durat1

MW 6

S5TIME

Durat2

MW 8

S5TIME

Count

C1

COUNTER

Monitor

T1

TIMER

16

8.6

, CPU 1 ( , FC
Blocks, FC). , .
( , ),
. .
8.4 8.5 .
, , LAD_Book
FBD_Book FC 12 Conveyor Example ( ).

17

FC 12
Network 1:
Count
S_CD
Lbarr1
CD

S
PV

CV

Finished
NOT

Set
Quantity

CV_BCD

Acknowl
R

Network 2:
Set
POS
Q
M_BIT
EM_ST_P
Lbarr1
NEG
Q
EM_ST_N

M_BIT

Active
SR
S

#PM_LB_N
#

Finished
R

Acknowl

Network 3:
Lbarr1
Durat1

#t_Duration

MOVE
ENO
OUT

#t_Duration

Lbarr1
Durat2

#t_BOOL

MOVE
EN
ENO
IN
OUT

EN
IN

Network 4:
Active
POS

Monitor
S_PEXT
Q

EM_Ac_P

M_BIT

NOT

BI

Lbarr1
POS

BCD

Q
EM_LB_P

Active

M_BIT

#PM_LB_N
#t_Duration

TV
R

8.4 (LAD)

18

Fault

8.6

FC 12
Network 1:
Count
S_CD
Lbarr1
Set
Quantity
Acknowl

CD
S
PV
R

CV
CV_BCD
Q

Finished
=

Network 2:

EM_ST_N

Set
POS
M_BIT

EM_ST_P

Lbarr1
NEG
M_BIT
Q

#PM_LB_N
#

Active
SR
Q

&
>=1

Finished

Acknowl

Network 3:
Lbarr1

MOVE
EN
OUT

Durat1

IN

Lbarr1

MOVE
EN
OUT

Durat2

IN

ENO

>=1
#t_Duration
#t_BOOL
#

ENO

Network 4:
Active
POS
M_BIT
Q
EM_Ac_P

EM_LB_P

#t_Duration

>=1

Lbarr1
POS
M_BIT
Q

Monitor
S_PEXT
S
BI

#PM_LB_N
#t_Duration

TV
R

BCD
Q

&

Acknowl

Fault
=

8.5 (FBD)

19


INT (), DINT ( ) REAL () , ,
PLC.
.
INT, DINT REAL.

. INT, DINT REAL.

, , , .
, .

.
( ) , ()
1 0.
,
. , . 18.2
.


: , , , ,

10


, INT, DINT
REAL

11


; ;
; ;

12


INT/DINT BCD ; DINT REAL
; () ;
()

13


, , ; ( )

14


AND, OR OR;

9
9

..................................................................................................................... 3
9.1
............................................................................................. 3
9.2
............................................................................................... 6

9.1


,
INT, DINT REAL, , , ,
, , .
( 9.1).

9.1


INT
DINT
REAL
CMP ==I
CMP ==D
CMP ==R

CMP <>I

CMP <>D

CMP <>R

CMP >I

CMP >D

CMP >R

CMP >=I

CMP >=D

CMP >=R

CMP <I

CMP <D

CMP <R

CMP <=I

CMP <=D

CMP <=R

9.1



( : INT)
LAD:

CMP ==I
IN1
IN2

FBD:

CMP ==I
IN1
IN2

(LAD)
()
IN1 IN2 () .
(CMP compare,
) ( , CMP ==I INT ).
( ) . ()
.
IN1 IN2, . ( -

). , . .
(FBD)
IN1 IN2
.
( , CMP ==I
INT ).
IN1 IN2, . , 1, 0. .

. ,
REAL CMP >R ( REAL). , . .
, INT.
3.5.4
.
REAL , REAL ( REAL). OS OV. , 15 .

9.1 . ,
, .
(Program Element Catalog),
View Catalog ( ) [Ctrl + K] Insert Program Elements
( ), Comparator ().
(LAD)
.

9.1

99.0 , MW 92 120;
.


INT

CMP ==I
MW 92
120

IN1
IN2

99.0
R

CMP ==I
MW 92

IN1

120

IN2

99.0
R

CompRes Global_DB ,

DINT CompVal1 CompVal2; .
CMP <D

Global_DB.
CompVal1

IN1

Global_DB.
CompVal2

IN2

Global_DB.
CompRes

CMP <D

Global_DB.
CompVal1

IN1

Global_DB.
CompVal2

IN2

Global_DB.
CompRes
=

#Act_Value #Calibrat,

REAL #NewCali ; #NewCali .
CMP >=R
#Act_value
#Calibrat

IN1
IN2

#NewCali
S

CMP >=R
#Act_Value

IN1

#Calibrat

IN2

#NewCali
S

9.1

. .
,
. , .
LAD_Book , , (FB 109 Digital
Functions, ).
(FBD)

.
. FBD_Book , ,
(FB 109
Digital Functions, ).

9.2


, , ,
. ( RLO 1), .
, REAL, , .
OV OS.

, , , . (
RLO 1), .
, REAL, , .
OV OS.

, , ,
IN1 IN2. ,
( RLO
1).
, REAL, , .
OV OS.


, ,
, IN1 IN2.
, (
RLO 1).

9.2

, REAL, , .
OV OS.

, , ,
IN1 IN2. ,
( RLO
1).
, REAL, , .
OV OS.


, , ,
IN1 IN2. ,
( RLO
1).
, REAL, , .
OV OS.

10
10
10.1
10.2
10.3
10.4

.................................................................................................. 4
.................................................................................. 4
INT ......................................................................................... 8
DINT ...................................................................................... 9
REAL ................................................................................... 11

10

10



, , . INT, DINT REAL
( 10.1).

10.1

INT
ADD_I


DINT
ADD_DI

REAL
ADD_R

SUB_I

SUB_DI

SUB_R

MUL_I

MUL_DI

MUL_R

DIV_I

DIV_DI

DIV_R

MOD_DI

10.1


( : INT)
LAD:

ADD_I

FBD:

ADD_I

EN

ENO

EN

IN1

OUT

IN1

OUT

IN2

ENO

IN2

(enable input) EN (enable output)


ENO IN1 IN2
OUT. (ADD_I, , INT).
IN1 IN2, OUT. . , ADD_R ( REAL) REAL.
, . ,

10.1

. , INT.

3.5.4 .

,
1 ( EN ). , 0;
1. (EN = 0), , ENO .
(MCR) , OUT
, (EN = 1). MCR
ENO.

EN == 1

OUT := IN1 Cfct IN2


ENO := 0
ENO := 1
ENO := 0
Cfct


:
() INT
DINT;
REAL;
() REAL REAL.
, , 15 .

10.1 .
,

.
5

10


(Program Element Catalog), View Catalog ( ) [Ctrl + K] Insert Program Elements
( ), Integer Math ( , INT DINT) FloatingPoint Math ( ,
REAL).

() MW 100 250; () MW 102.


INT

DIV_I
EN

ENO

MW 100

IN1

OUT

250

IN2

DIV_I
EN
MW 102

MW 100

IN1

OUT

250

IN2

ENO

MW 102

CalcVal1 CalcVal2 ,
DINT CalcRes.
Global_DB.
ADD_DI
EN

ENO

Global_DB.
CalcVal1

IN1

OUT

Global_DB.
CalcVal2

IN2

ADD_DI
EN
Global_DB.
CalcRes

Global_DB.
CalcVal1

IN1

OUT

Global_DB.
CalcVal2

IN2

ENO

Global_DB.
CalcRes

#Act_value #Factor,
REAL #Indicator.
MUL_R
EN

ENO

#Act_value

IN1

OUT

#Factor

IN2

MUL_R
EN
#Indicator

#Act_value

IN1

OUT

#Factor

IN2

ENO

#Indicator

10.1
(LAD)
, , EN ENO.
- , ( ).
EN
.
6

10.1

, .
, .
, ,
, .
.
ENO EN , , .
, .

( ),
, .
LAD_Book , , (FB 110 Digital
Functions, ).
(FBD)
EN ENO .
, EN. ENO . , , , ENO
EN .
,
.
FBD_Book , , (FB 110 Digital
Functions, ).

10

10.2 INT
INT
ADD_I IN1 IN2 INT ( ). OUT.
0 1 , . OV OS .
INT
SUB_I IN1 IN2 INT. IN2 IN1
OUT.
0 1 , - , . OV OS
.
INT
MUL_I IN1 IN2 INT. OUT.
0 1 , - , . OV
OS INT.
INT
DIV_I IN1 IN2 INT. IN1 () IN2 () OUT. .
, , ,
. , .
0 1 , ,
. OV OS
. 0, 1, OV OS 1.

10.3 DINT

10.3 DINT
DINT
ADD_DI IN1 IN2 DINT ( ).
OUT.
0 1 , . OV OS .
DINT
SUB_DI IN1 IN2 DINT. IN2 IN1
OUT.
0 1 , - , . OV OS
.
DINT
MUL_DI IN1 IN2
DINT.
OUT.
0 1 , - , . OV
OS INT.
DINT,
DIV_DI IN1 IN2 DINT. IN1 () IN2 () OUT. . , , ,
. , .
0 1 , ,
. OV OS
. 0, 1, OV OS 1.

10

DINT,
MOD_DI IN1 IN2
DINT. IN1 () IN2
() OUT. , ; . ,
.
0 1 , - , . OV OS
.
0, 1, OV OS 1.

10

10.4 REAL

10.4 REAL
REAL ()
() .
( ) ( ;
3.5.4 ). CPU S7-400 , CPU S7-300 .
CPU S7-300 , , ,
.
REAL
ADD_R IN1 IN2 REAL. OUT.
0 1 , . OV OS .
( REAL, + ) ADD_R OUT
0, 1, OV OS 1.
REAL
SUB_R IN1 IN2 REAL. IN2 IN1 OUT.
0 1 , - , . OV OS
.
( REAL, + ) SUB_R OUT
0, 1, OV OS 1.
REAL
MUL_R IN1 IN2 REAL. OUT.

11

10

0 1 , - , . OV
OS .
( REAL, 0) MUL_R OUT
0, 1, OV OS 1.
REAL
DIV_R IN1 IN2 REAL. IN1 () IN2
() OUT.
0 1 , ,
. OV OS
. 0, 1, OV OS 1.
( REAL, 0 0) DIV_R
OUT 0, 1, OV OS 1.

12

11
11
11.1
11.2
11.3
11.4

.................................................................................................. 4
................................................................................... 4
.............................................................................................. 8
............................................................................. 9
................................................................................. 10

11

11


LAD FBD :
, , ;
, , ;
, ;
, .
REAL.

11.1

IN OUT,
EN ENO. (, SIN ).

( : )
LAD:

FBD:

SIN

SIN

EN

ENO

EN

OUT

IN

OUT

IN

ENO

IN, OUT. REAL. , ,


.
3.5.4
REAL.

, (EN) 1, EN . , 0; -

11.1

1. (EN = 0), , ENO 0.

EN == 1

OUT := Mfct (IN)


ENO := 0
ENO := 1
ENO := 0
Mfct

(MCR) , (EN = 1), OUT . MCR


ENO.
:
( );
() REAL .
15 , .

11.1 .
REAL,
.
(Program Element Catalog),
View Catalog ( ) [Ctrl + K] Insert Program Elements
( ), Floating-Point Math (
).
(LAD)
EN ENO.

11

() MD 110 .
() MD 104.

SIN
MD 110

SIN

EN

ENO

IN

OUT

MD 104

MD 110

EN

OUT

IN

ENO

MathVal1 MathRoot.
SQRT

Global_DB.
MathVal1

EN

ENO

IN

OUT

SQRT

Global_DB.
MathRoot

Global_DB.
MathVal1

EN

OUT

IN

ENO

Global_DB.
MathRoot

#Result , #Exponent.

EXP
#Exponent

MD 104

EN

ENO

IN

OUT

EXP
#Result

#Exponent

EN

OUT

IN

ENO

#Result

11.1
- , (
). EN
.

. , . , , ,
.
.
ENO EN , ,
. , .

( ),
, .

11.1

LAD_Book , , (FB 111 Digital


Functions, ).
(FBD)
EN ENO .
, EN.
ENO . , , , ENO EN .
, .
FBD_Book , , (FB 111 Digital
Functions, ).

11

11.2

SIN
COS
TAN

REAL.
: 0 360
0 2 ( = +3.141593+00).
. , 90 () /2
+1.570796+00. , 2 (+6.283185+00), 2
2 , 2.
( 11.2a 11.3, 4, Network 4): () (idle power) Ps = U I sin .

Network 4:
MUL_R
EN

ENO

#Voltage

IN1

OUT

#Current

IN2

SIN
#t_REAL1

MUL_R
EN

ENO

#t_REAL1

IN1

OUT

#t_REAL2

IN2

#IdlePower

11.2 (LAD)

#phi

EN

ENO

IN

OUT

#t_REAL2

11.3

11.3
()
ASIN
ACOS
ATAN

,

.

. IN REAL ( 11.1).
IN , REAL, ENO = 0, 0, 1, OV OS 1.
11.1

ASIN ()

1 +1

/2 +/2

ACOS ()

1 +1

ATAN ()

/2 +/2


Network 5:
SQR
#a

EN

ENO

IN

OUT

SQRT
#t_REAL1

#t_REAL3

EN

ENO

IN

OUT

#c

SQR
#b

EN

ENO

IN

OUT

#t_REAL2

MUL_R
EN

ENO

#t_REAL1

IN1

OUT

#t_REAL2

IN2

#t_REAL3

11.2 (LAD)

11

11.4
:
SQR
SQRT
EXP
LN

,
,
,
( ).


SQR IN OUT.
: . .

SQRT IN OUT. IN , SQRT 0, 1, OV OS 1
REAL. IN 0 ( ), 0.
______
: = a2 + b2
11.2 ( ) 11.3, 5 (Network 5):
a b, .
. .
( b c ,
#, ; b c , .)

EXP (
2.718282+00) IN (eIN) OUT.
,
ab = eb ln a.

10

11.4


LN (= 2.718282+00)
IN OUT.
, LN 0, 1, OV OS 1 REAL.
:
y = ex, x = ln y.
,
logb a =

logn a
logn b

b n . n = e, , :
logb a =

ln a
ln b

10 :
lg a =

ln a
= 0.4342945 ln a
ln 10

11

11


Network 4:
MUL_R
EN
#Voltage

IN1

OUT

#t_REAL1
SIN

#Current

IN2

EN

ENO

OUT

#t_REAL2
MUL_R

#phi

IN

EN

ENO
#t_REAL1

IN1

OUT

#t_REAL2

IN2

ENO

#IdlePower

Network 5:
SQR

#a

EN

OUT

IN

ENO

#t_REAL1
&

SQR

#b

EN

OUT

IN

ENO

#t_REAL2

ADD_R
EN
#t_REAL1

IN1

OUT

#t_REAL3
SQRT

#t_REAL2

IN2

ENO
#t_REAL3

11.3 (FBD)

12

EN

OUT

IN

ENO

#c

12
12
12.1
12.2
12.3
12.4
12.5

................................................................................................... 4
.................................................................................... 4
INT DINT ........................................................................... 8
BCD........................................................................................ 10
REAL ..................................................................................... 11
.................................................................................. 13

12

12


. 12.1
, .

12.1

(enable input) EN (enable output)


ENO IN
OUT. (, I_BCD INT BCD).

( : INT BCD)
LAD:

I_BCD

FBD:

I_BCD

EN

OUT

EN

ENO

IN

ENO

IN

OUT

IN, OUT. .
DI_R (DINT REAL), , DINT,
REAL. ,
.
,
, , INT.

,
1 ( EN). ,
ENO 0; 1. (EN = 0),
, ENO (. - ).

12.1

BCD
3 .

INVI
NEGI

BTI
INT
ITB

ITD

INVD
NEGD

BTD
BCD
7 .

DINT
DTB

DTR

RND+, RNDRND, TRUNC

ABS
NEGR
REAL

12.1
(MCR) , (EN = 1) OUT . MCR ENO
.

EN == 1

OUT := Confct (IN)


ENO := 0
ENO := 1
ENO := 0
Confct

. ,
(I_BCD, DI_BCD) REAL (FLOOR, CEIL, ROUND, TRUNC).
BCD_I BCD_DI , ,

12

121 ( ).
15 , .
12.2 .
,
.

() MW 120
INT BCD () MW 122.

INT

I_BCD
MW 120

EN

ENO

IN

OUT

I_BCD
MW 122

MW 120

EN

OUT

IN

ENO

ConvDINT DINT
REAL ConvREAL.

DINT

DI_R

Global_DB.
ConvDINT

EN

ENO

IN

OUT

REAL

DI_R

Global_DB.
ConvREAL

Global_DB.
ConvDINT

EN

OUT

IN

ENO

Global_DB.
ConvREAL

#Indicator.
ABS

#Indicator

MW 122

EN

ENO

IN

OUT

ABS
#Indicator

#Indicator

EN

OUT

IN

ENO

#Indicator

12.2
(Program Element Catalog),
View Catalog ( ) [Ctrl + K] Insert Program Elements
( ), Convert ().
(LAD)
EN ENO.
- , (

12.1

). EN
.

. , . , , ,
.
. ENO EN ,
,
.
,
.

( ),
, .
LAD_Book , , (FB 112 Digital
Functions, ).
(FBD)
EN ENO .
,
EN. ENO
. , , , ENO
EN .
, .
FBD_Book , , (FB 112 Digital
Functions, ).

12

12.2 INT DINT


12.1 INT DINT.

(, INT).
12.1 INT DINT

INT DINT
INT BCD
DINT BCD
DINT REAL

I_DI
I_BCD
DI_BCD
DI_R


IN

OUT

INT
INT
DINT
DINT

DINT
WORD
DWORD
REAL

INT DINT
I_DT IN INT
OUT. 15-
() 16- 31- OUT.
INT DINT .
INT BCD
I_BCD IN INT
3- BCD (- )
OUT. . 12- 15-. 0,
; 1, .
INT BCD (> 999),
I_BCD OV OS. .
DINT BCD
DI_BCD IN
DINT 7- BCD OUT. . 28- 31-. 0, ;
1, .

12.2 INT DINT

DINT BCD (> 9 999 999),


DI_BCD OV OS.
.
DINT REAL
DI_R IN DINT
REAL OUT.
DINT ,
REAL, . REAL ( ROUND).
DI_R .

12

12.3 BCD
12.2 BCD.
(, INT).
12.2 BCD

BCD INT
BCD DINT

BCD_I
BCD_DI


IN

OUT

WORD
DWORD

INT
DINT

BCD INT
BCD_I IN 3- BCD-
INT OUT.
. 12- 15-. , ; 1,
. 15- .
BCD- ( 10 15 F), CPU 121 ( ). , CPU STOP.
BCD_I .
BCD DINT
BCD_DI IN 7- BCD-
DINT OUT. . 28-
31-. 0, ;
1, . 31-
.
BCD- ( 10 15 F), CPU 121 ( ). , CPU STOP.
BCD_DI .

10

12.4 REAL

12.4 REAL
REAL DINT ( ) ( 12.3). .
.
12.3 REAL DINT





IN

OUT

CEIL

REAL

DINT

FLOOR

REAL

DINT

ROUND

REAL

DINT

TRUNC

REAL

DINT


CEIL IN REAL
DINT OUT. CEIL ,
.
IN ,
DINT, REAL, CEIL
OV OS. .

FLOOR IN REAL
DINT OUT. FLOOR ,
.
IN , DINT, REAL, FLOOR OV OS. .

11

12


ROUND IN REAL
DINT OUT. ROUND .
, .
IN , DINT, REAL, ROUND OV OS. .

TRUNC IN REAL
DINT OUT. TRUNC
; .
IN , DINT, REAL, TRUNC OV OS. .
REAL DINT
12.4
REAL DINT. 1 +1.
12.4 REAL

REAL
DW#16#
1.0000001
3F80 0001
1.00000000
3F80 0000
0.99999995
3F7F FFFF
0.50000005
3F00 0001
0.50000000
3F00 0000
0.49999996
3EFF FFFF
5.877476E39
0080 0000
0.0
0000 0000
5.877476E39
8080 0000
0.49999996
BEFF FFFF
0.50000000
BF00 0000
0.50000005
BF00 0001
0.99999995
BF7F FFFF
1.00000000
BF80 0000
1.0000001
BF80 0001

12

ROUND
1
1
1
1
0
0
0
0
0
0
0
1
1
1
1

CEIL
2
1
1
1
1
1
1
0
0
0
0
0
0
1
1

FLOOR
1
1
0
0
0
0
0
0
1
1
1
1
1
1
2

TRUNC
1
1
0
0
0
0
0
0
0
0
0
0
0
1
1

12.5

12.5

( ), REAL
( 12.5).
(, DINT).
12.5


IN

OUT

INV_I

INT

INT

INV_DI

DINT

DINT

NEG_I

INT

INT

DINT

NEG_DI

DINT

DINT

REAL

NEG_R

REAL

REAL

ABS

REAL

REAL


INT

DINT
INT


REAL

INT
INV_I IN (
) OUT. INV_I . INV_I .
DINT
INV_DI IN
( ) OUT. INV_DI
. INV_DI .
INT
NEG_I IN INT,
( )
OUT. NEG_I 1.
NEG_I CC0, CC1, OV OS.

13

12

DINT
NEG_DI IN DINT, ( ) OUT. NEG_DI
1. NEG_DI CC0, CC1, OV OS.
REAL
NEG_R IN REAL, 1 OUT. NEG_R REAL. NEG_R .
REAL
ABS IN REAL, OUT. ABS 0 REAL. ABS .

14

13
13
13.1
13.2
13.3

.................................................................................................................... 4
................................................................................................... 4
........................................................................................................................................ 8
............................................................................................................... 10

13

13


. ,
. 13.1 .
13.1



SHL_W



SHL_DW

SHR_W

SHR_DW

SHR_I

SHR_DI

ROL_DW

ROR_DW

13.1

(enable input) EN (enable output)


ENO IN, N OUT. (, SHL_W ).

( : )
LAD:

SHL_W

FBD:

SHL_W

EN

ENO

EN

IN

OUT

IN

OUT

ENO

, , IN.
N. OUT.
. ,
DWORD SHR_DW ( ).
, . , ;
, INT .
N WORD .
4

13.1

3.5.4
.

, 1,
EN. ENO 1.
(EN = 0), , ENO 0.

EN == 1

OUT := Sfct (IN, N)


ENO := 1
ENO := 0
Sfct

(MCR) ,
(EN = 1) OUT . MCR ENO .
15 ,
.

13.1 .

(Program Element Catalog),
View Catalog ( ) [Ctrl + K] Insert Program Elements (
), Shift ().
(LAD)
EN ENO .
-
, ( ). IN,
.

. , . -

13

, , , .
. ENO
EN ,
. ,

.
( ),
, .

MW 130 4
MW 132.

SHL_W
EN

ENO

MW 130

IN

OUT

W#16#4

SHL_W
EN
MW 132

MW 130

IN

OUT

W#16#4

ENO

ShiftIn , ShiftNum,
ShiftOut.


( )

SHR_DW
EN

ENO

Global_DB.
ShiftIn

IN

OUT

Global_DB.
ShiftNum

SHR_DW
EN
Global_DB.
ShiftOut

Global_DB.
ShiftIn

IN

OUT

Global_DB.
ShiftNum

ENO

Global_DB.
ShiftOut

#Act_value 2 ,
#Indicator.

SHR_I
EN

ENO

#Act_value

IN

OUT

W#16#2

SHR_I
EN
#Indicator

13.1

MW 132

#Act_value

IN

OUT

W#16#2

ENO

#Indicator

13.1

LAD_Book , , (FB 113 Digital Functions,


).
(FBD)
EN ENO .
,
EN. ENO . ,
, , ENO EN .
, .
FBD_Book , , (FB 113 Digital Functions,
).

13

13.2

SHL_W WORD IN
, N. , , .
WORD OUT .
N , . .
0, ; 15,
SHL_W .

SHL_DW DWORD
IN , N.
, , .
DWORD OUT .
N ,
. . 0,
; 31, SHL_DW .

SHR_W WORD IN
, N. , , .
WORD OUT .
N , . .
0, ; 15,
SHR_W .

SHR_DW DWORD
IN , N.
, , .
DWORD OUT .

13.2

N ,
. . 0,
; 31, SHR_DW .

SHR_I INT IN
, N.
, , 15
( INT), 0, , 1, . OUT
INT .
N ,
. . 0,
; 15, SHR_I .
INT
2. . , .

SHR_DI DINT IN
, N.
, , 31
( DINT), 0, , 1, . OUT
DINT .
N , . .
0, ; 31,
SHR_DI .
DINT
2. . , .

13

13.3
( )
ROL_DW DWORD
IN , N.
. DWORD OUT.
N , . .
0, . 32,
, .
33, . 34, ( 32).
( )
ROL_DW DWORD
IN ,
N. . DWORD OUT.
N , . .
0, . 32,
, .
33, . 34, ( 32).

10

14
14
14.1
14.2

...................................................................................... 4
.................................................................... 4
........................................................................ 8

14

14


( )
AND, OR OR. .
14.1.
14.1

AND ()


WAND_W


WAND_DW

WOR_W

WOR_DW

WXOR_W

WXOR_DW

OR ()
OR ()

14.1

(enable input) EN (enable output)


ENO IN1
IN2 OUT. (, WAND_W
AND).

( : AND)
LAD:

WAND_W

FBD:

WAND_W

EN

ENO

EN

IN1

OUT

IN1

OUT

IN2

ENO

IN2

IN1 IN2, OUT.


: WORD (16 ) DWORD
(32 ).
, .
3.5.4 .

14.1

, 1 ( EN ). (EN 0), , ENO


0.

EN == 1

OUT := IN1 Wlog IN2


ENO := 1
ENO := 0
Wlog

(MCR) ,
(EN = 1) OUT . MCR ENO
.
. 0 IN1 0 IN2, 0 OUT.
1, 2 15 31 .
14.2 .
15 , .
14.2
IN1

IN2

AND

OR
OR

14.1 .
(Program Element Catalog), View Catalog ( ) [Ctrl + K] Insert Program Elements ( ), Word Logic (
).

14

4 MW 140 0, MW 142.

AND

WAND_W
EN

ENO

MW 140

IN1

OUT

W#16#FFF

IN2

WAND_W
EN
MW 142

MW 140

IN1

OUT

W#16#FFF

IN2

ENO

MW 142

WLogVal1 WLogVal2 OR, WLogRes.

OR

WOR_DW
EN

ENO

Global_DB.
WLogVal1

IN1

OUT

Global_DB.
WLogVal2

IN2

WOR_DW
EN
Global_DB.
WLogRes

Global_DB.
WLogVal1

IN1

OUT

Global_DB.
WLogVal2

IN2

ENO

Global_DB.
WLogRes

, OR #Input #Mask, #Store.

OR

WXOR_W
EN

ENO

#Input

IN1

OUT

#Mask

IN2

WXOR_W
EN
#Store

#Input

IN1

OUT

#Mask

IN2

ENO

#Store

14.1
(LAD)
EN ENO .

- ,
( ). IN,
.

. , . , , , .
. ENO EN
, . 6

14.1

, .

( ),
, .
LAD_Book , , (FB 114 Digital
Functions, ).
(FBD)
EN ENO .
,
EN. ENO . , , ,
ENO EN .
, .
FBD_Book , , (FB 114
Digital Functions, ).

14

14.2
AND
AND IN1 IN2 AND.
OUT 1,
1.
, 0 IN2,
0 IN1,
. () AND.
OR
OR IN1 IN2 OR. OUT 0,
0.
, 1 IN2,
1 IN1,
. () OR.
OR
OR IN1 IN2
OR. OUT 1,

1. IN2 1,
,
IN1.
1 IN1 IN2,
OR. () OR
.


LAD FBD .
.
, ,
().
(,
). ()
.
,
RLO ( ).

(Master Control Relay, MCR). LAD FBD .
. , .
19 , 5
8 .
.
Feed ( ) .

15


RLO, BR, CC0, CC1 (overflow);
; ; EN/ENO

16


; RLO

17


MCR-; MCR; MCR

18


, , ; (
); , ;

19


; , ;
; : ,

15
15

.................................................................................................................... 4
15.1 .................................................................................................... 4
15.2 ................................................................................................... 7
15.3 .............................................................................................. 11
15.4 ................................................................................ 13
15.4.1
BR.......................................................................... 13
15.4.2
, EN/ENO ............................................................................... 14
15.4.3
ENO , ................................................... 15

15

15


( ).
CPU
. . , .
, LAD
FBD.

15.1
15.1 . CPU
;
.
15.1

/FC

/ First Check

RLO

/ Result of logic operation

STA

/ Status

OR

OR / Status bit OR

BR

/ Binary result


OS

/ Stored overflow

OV

/ Overflow

CC0

() 0 / Condition code (status) bit 0

CC1

() 1 / Condition code (status) bit 1

(First check)
/FC . /FC = 0
, . /FC = 1.
LAD FBD .
(,
), .
/FC = 0.

15.1

(RLO)
RLO .
CPU () RLO,
RLO , , RLO.
RLO / SAVE BR. RLO ,
, . RLO LAD (RLO = 1 ,
).

STA
. STA , , ( , ,
RLO = 0 MCR ) STA (
) .
FP FN RLO STA. STA = 1.
STA LAD FBD.
OR
OR AND
OR, . OR.

OV
REAL. OV :
, , ,
REAL.
OV .

15


OS OV. , CPU
OV, OS. ,
OV, OS .
REAL, .
OS . OS.
CC0 CC1 ( )
CC0 CC1 , , , .
0 1 (. ).

LAD FBD BR EN/ENO
. ,
BR.

15.2

15.2
0, 1, OV OS, 15.2.
.
15.1
INT
:

OV

OS

< 32 768

(ADD_I, SUB_I)

< 32 768

(MUL_I)

32 768 1

+1 +32 767

> +32 767

(ADD_I, SUB_I)

> +32 767

(MUL_I)

32 768

(DIV_I)

() 65 536

OV

OS

< 2 147 483 648 (ADD_DI, SUB_DI)

< 2 147 483 648 (MUL_DI)

2 147 483 648 1

+1 +2 147 483 647

> +2 147 483 647 (ADD_DI, SUB_DI)

> +2 147 483 647 (MUL_DI)

2 147 483 648

() 4 294 967 296

(DIV_DI, MOD_DI)

OV

OS

REAL

DINT
:

(DIV_DI)

15

15.1 ()
REAL
:

OV

OS

+ ( )

( )

REAL

OV

OS

+1 +32 767

1 32 767

() 32 768

OV

OS

+1 +2 147 483 647

1 2 147 483 647

() 2 147 483 648

OV

OS

OV

OS

NEG_I
:

NEG_D
:

15.2

INT DINT
INT DINT . 0 1 0.
0 = 0 1 = 1 , 0 = 1 1 =
= 0 . OV OS ( 0 1
). , 1, .
REAL
REAL . 0
1 0. 0 = 0 1 = 1 , 0 =
1 1 = 0 . OV OS (
0 1 ). REAL
1 .
REAL ,
. ; REAL 1.175 494 10-38. CPU S7-300 REAL, (. 3.5.4 ).


( ). , OV OS ( REAL):
I_BCD DI_BCD:
INT DINT BCD;
CEIL, FLOOR, ROUND, TRUNC:
REAL DINT.

0 1. .

15


1. 0 OV .

( ),
1 ; 1, 1 . 0 OV .

10

15.3

15.3
LAD:
(NO) (NC) .
15.1 . . NO- NC- , .
LAD_Book (FB 115 Program Flow Control,
).

LAD
>0

>=0

<0

<=0

<>0

==0

UO

OV

OS

BR

FBD

>0


[(CC0 = 0) & (CC1 = 1)]

>=0


[(CC0 = 0)]

<0


[(CC0 = 1) & (CC1 = 0)]

<=0


[(CC1 = 0)]

<>0


[(CC0 = 0) & (CC1 = 1) v (CC0 = 1) & (CC1 = 0)]

==0


[(CC0 = 0) & (CC1 = 0)]

UO

()
[(CC0 = 1) & (CC1 = 1)]

OV


[OV = 1]

OS


[OS = 1]

BR


[BR = 1]

15.1
11

15

FBD: . 1. 0 .
, . FBD_Book (FB 115 Program Flow Control, ).
(Program Element Catalog), View Catalog ( ) [Ctrl + K], Insert
Program Elements ( ), Status Bits ( ).

12

15.4

15.4
15.4.1 BR

LAD:

SAVE

FBD:

SAVE

SAVE (LAD)
RLO SAVE (). SAVE , BR ,
. SAVE ,
.
, SAVE
( /FC 0). , , SAVE,
.
SAVE -.
SAVE (FBD)
SAVE RLO . SAVE RLO 1, BR ; BR . SAVE , .
, SAVE
( /FC 0). , , .
SAVE - .

LAD FBD , ENO
( 15.2). ENO , , BR. (BR ) LAD FBD
:

13

15

BR := 1
MOVE, ;
BR := OV
;
BR := OV 1
;
BR := BR .

ENO ?

EN ?

EN ?

EN = = 1 ?

BR

EN = = 1 ?

BR := 0

BR

BR := 1

BR := 0

BR

15.2
15.4.2 , EN/ENO
LAD FBD EN ENO. 1, .
, 1.
( , ), ENO 0.
EN 0, ENO 0.
EN ENO ( 15.3). , ,
( , I
1.0 )
, .
EN ENO , ,
( ).

EN, , .

14

15.4

(LAD)
DIV_R

Contact0
EN

ENO

MD 10

IN1

OUT

MD 20

IN2

ROUND
EN

ENO

#t_REAL
#t_REAL

#t_DINT
IN

MOVE

Contact1

OUT

EN

ENO

IN

OUT

Coil0
MD 30

#t_DINT

(FBD)
DIV_R
Input0

EN

MD 10

IN1

OUT

#t_REAL
ROUND

MD 20

IN2

ENO

EN

OUT

#t_REAL

IN

ENO

#t_DINT
ROUND

&
Input1
#t_DINT

EN

OUT

IN

ENO

MD 30

Output0
S

15.3 EN ENO
15.4.3 ENO ,
EN ENO.
EN . ENO , , ( 1, ; 0, ).
BR.
ENO BR.
ENO , BR .
, BR 1.
( ,
, ),
/ SAVE 0
, ( 0). , /
RET BR 1, /
.

15

16
16
16.1
16.2
16.3
16.4

................................................................................................................ 4
............................................................................................... 4
............................................................................................................. 6
, RLO = 1....................................................................................................... 7
, RLO = 0....................................................................................................... 8

16

16


.
RLO ( ).

16.1

LAD

FBD

,
RLO = 1

Dest
JMP

,
RLO = 1

Dest
JMP

,
RLO = 0

Dest
JMPN

,
RLO = 0

Dest
JMPN

Dest

Dest

(LAD) (FBD) , , . .
-.
4 , ,
. .
,
. ( LABEL, ).
(Program Elements Catalog), View Catalog ( ) [Ctrl K], Insert Program Elements
( ), Logic Control / Jump (
/ ).

16.1

( ),
(RLO) ( ). , RLO, , RLO, 1 0,
.
(
), .
, ,
. (Master Control
Relay, MCR), MCR- MCR, .
,
.
.

. CPU ( ) ( ).
CPU,
, . , CPU
, .

(001, 002 ..).

16

16.2
, ,
JMP, ( ) (LAD),
(FBD).
, . CPU , . ( 16.1 16.2): 3 (Network 3) 2. CPU
2 5 (Network 5).
4 (Network 4), .

Network 1: , RLO = 1
CMP ==I

M1
JMP

#CompVal1

IN1

#CompVal2

IN2

Network 2: 1
Contact0

Coil0

Network 3:
M2
JMP
Network 4: , RLO = 0
M1
ADD_I
EN

ENO

#CalcVal1

IN1

OUT

#CalcVal2

IN2

M3
JMPN
#CalcRes

Network 5: 2
M2
Contact1

Coil1

Network 6: 3
M3

16.1

(LAD)

Contact2

Coil2

16.3 , RLO = 1

16.3 , RLO = 1
RLO = 1 JMP,
( ) (LAD),
(FBD). ,
, . RLO =
= 1 ( ), CPU , . , CPU
.
( 16.1 16.2): 1 (Network 1) , 4 (Network 4).
, , 2 (Network 2).

Network 1: , RLO = 1
CMP ==I
#CompVal1

IN1

#CompVal2

IN2

1
JMP

Network 2: 1
Output0
=

&

Input0

Network 3:
M2
&
Network 4: , RLO = 0
M1
ADD_I
EN
#CalcVal1

IN1

OUT

#CalcVal2

IN2

ENO

#CalcRes

3
JMPN

Network 5: 2
M2
Input1

&

Output1
=

&

Output2
=

Network 6: 3
M3
Input2

16.2 (FBD)

16

16.4 , RLO = 0
RLO = 0 JMPN, ( ) (LAD), (FBD). ,
, . RLO =
= 0 ( ), CPU
, . ,
CPU .
( 16.1 16.2): 4 (Network 4)
, 6 (Network 6) ( 3).
, , 5 (Network 5).

17
17
17.1
17.2
17.3
17.4

................................................................................................... 4
MCR- .................................................................................................................. 5
MCR- .......................................................................................................................... 6
MCR- ................................................................................................................................ 7
I/O-............................................................................................... 10

17

17


(Master Control Relay,
MCR) ,
.


.
MCR.
- MCR LAD,
FBD , MCR.
LAD

FBD

MCR-

MCRA

MCR-

MCRA

MCR-

MCR<

MCR-

MCR<

MCR-

MCR>

MCR-

MCR>

MCR-

MCRD

MCR-

MCRD

, ( )
(EMERGENCY OFF) !
,
!
MCRA MCRD, , MCR-. MCR<
MCR> , MCR-
. MCR-. (RLO), MCR-,
MCR- .

17.1 MCR-

17.1 MCR-
MCR- . MCR ( ),
0 ( RLO 0, );

( );
SR RS ( );
( ,
).
RLO 0 ( ) -.
LAD FBD (
). ,
MCR- , .
CPU STOP , MCR- :
;
, (, BLOCK_DB);
,
UDT ( ).
MCR- , RLO 0 ( ).
MCR- RLO, 1, ( ),
MCR- MCR-. MCR-
MCR-.
MCR (Program Elements Catalog),
View Catalog ( ) [Ctrl K], Insert Program Elements ( ), Program
Control ( ).
5

17

17.2 MCR-
, , MCR- (MCR area) MCRA () MCRD ( MCR). MCR- MCR- ( ).
/ MCRA / MCRD ( ).
MCR- , MCR-
( 17.1). MCR- / MCRA. , MCR- , , MCR-,
.
Block 1 ( 1)

Block 2 ( 2)

Block 3 ( 3)

MCRA

MCRA
MCRA

MCRD
MCRD

17.1 MCR-

17.3 MCR-

17.3 MCR-
LAD: MCR- (MCR zone) MCR< () MCR> ( MCR-). MCR< ; MCR>
( ). .
MCR- RLO, MCR<. , MCR- ( ); , MCR- .
FBD: MCR- MCR<
MCR> MCR-. MCR<
; MCR>
. MCR-, MCR< RLO. 1, MCR ; 0, MCR- .
MCR- MCR-.
MCR- 8, , .
LAD

FBD

MCRA

MCRA

I 1.1
MCR<
[MCR- 1]

I 1.1

MCR<

MCR-
MCR- 1 MCR- 2

MCR<

MCR-
MCR- 2,
MCR-
MCR- 1

[MCR- 1]

I 1.1
MCR<

I 1.1
[MCR- 2]

[MCR- 2]

MCR>

MCR>

MCR>

MCR>

MCRD

MCRD

17.2 MCR- MCR-

17

MCR- MCR-
RLO . , MCR- , MCR- MCR-.
MCR- MCR-
( 17.2).
MCR- . MCR-, , ( ). ,
MCR- MCR-.
17.3 10.0 11.0 MCR-. 10.0 MCR-
( 0) 11.0.
MCR- 1 10.0 = 1,
MCR- 2 11.0 ( 17.1).
Block 1 ( 1)
LAD

Block 2 ( 2)
FBD

MCRA

[MCR- 1]

M 10.0

MCR<

FBD

MCRA

MCRA

M 10.0
MCR<

LAD

[MCR- 1]

MCRA
[MCR- 1]

[MCR- 1]
M 11.0
MCR<
[MCR- 2]

MCR>
MCRD

MCR<

[MCR- 2]

MCR>

MCR>

MCRD

MCRD

MCR>
MCRD

17.3 MCR-
17.1 MCR- MCR- ()
8

M 11.0

17.3 MCR-

10.0

11.0

MCR-

MCR-

1 0

MCR-
MCR-

17

17.4 I/O-
MCR-, I/O- ( / /), . , ,
I/O-.
SFC 79 SET , SFC 80 RSET
I/O- ( 17.2). MCR. MCR-;
MCR- , SFC .
I/O-
. / (I/O) (
). , SFC ( ) , .
LAD_Book FBD_Book , ,
SFC 79 SFC 80 (FB
117 Program Flow Control, ).
17.2 SFC I/O-
SFC
79

80

10

INPUT

INT

RET_VAL

OUTPUT

INT

SA

OUTPUT

POINTER

INPUT

INT

RET_VAL

OUTPUT

INT

SA

OUTPUT

POINTER

18
18

........................................................................................ 4
18.1 .......................................................................... 4
18.1.1
: ............................................................................ 5
18.1.2
............................................................................................... 6
18.1.3
/ CALL............................................................................... 9
18.1.4
......................................................................................... 10
18.1.5
.................................................................................... 11
18.1.6
.................................................................................. 14
18.2 .................................................................................. 19
18.2.1
....................................................................................... 19
18.2.2
........................................................................................ 20
18.2.3
.............................................................................................. 22
18.2.4
................................................................... 24
18.3 ........................................................................... 26
18.3.1
............................................................................................... 26
18.3.2
............................................................................................... 26
18.3.3
...................................................................................... 27

18

18


,
. .

18.1
(code blocks)
( 18.1). (call box).
, CALL.
, (, ).
RET RLO ( ).
LAD

FBD

FB SFB

FB SFB

DBx
FBx

DBx
FBx

#name

#name

EN

ENO

EN

ENO

EN

OUT1

EN

OUT1

IN1

OUT1

IN1

OUT1

IN1

OUT2

IN1

OUT2

IN2

OUT2

IN2

OUT2

IN2

ENO

IN2

ENO

FC SFC
CALL


CALL

FC SFC
CALL


CALL
FCx

FCx
EN

ENO

IN1
IN2

FCx
CALL

FCx
EN

ENO

OUT1

IN1

OUT1

OUT2

IN2

OUT2


RLO


RLO

RET

18.1
4

CALL

RET

18.1


. ,
. / CALL ,
, ( )
.
, CPU
, ( ). , CPU .
/ CALL RET (Program Elements Catalog),
View Catalog ( ) [Ctrl K], Insert Program Elements ( ), Program Control ( ).
FC/FB/SFC/SFB blocks ( FC/FB/SFC/SFB), Multiple Instances
() Libraries ().
18.1.1 :
, . 18.2 FC 10
1.
, (: FC 10), (enable input) EN,
(enable output) ENO . CPU . . CPU
(: 1) .
, CPU
, (B-). , ,
.
CPU STOP, , , B-, .
. .
.

18
LAD

,
, 1

,
FC 10

:
FC 10
EN

ENO

I 1.0

#IN1
IN1

OUT

#OUT

#IN2

Q 4.0

I 1.1

IN2
,


FBD

,
, 1

,
FC 10

:
FC 10

EN
I 1.0

IN1

OUT

I 1.1

IN2

ENO

Q 4.0

#IN1
#IN2

&
#OUT

18.2
18.1.2
FB, FC, SFB SFC. ( , .)
EN
. EN ( ), , . EN , ,
6

18.1

. ENO
, BR
.

EN == 1



BR = 1

ENO := 1
ENO := 0


ENO := 0

() . BOOL,
(LAD)
(FBD).
.
LAD: , EN ENO. ,
( ).
FBD: , ENO EN . ENO AND OR.
, MCR- . MCR , MCR . MCR- ,
.
. ,
DI. , DI ( ) .
DB , ,
.

18


, FB Blocks ( FB)
(Program Elements Catalog).
. ,
, .
( ) .

.
.

.

. (, ).
Multiple Instances () ; (.
18.1.6 ).


FC Blocks ( FC) .
.
, .
, . , , RET_VAL.

CPU (SFC) (SFB), .
CPU. .

18.1

, , ;

, SFB.
, , .
CPU.
,
,
. System Function Blocks
( ) Standard Library ( ).
, .

.
, , SFC Blocks (
SFC) SFB Blocks ( SFB). , ,
, , .
( ) .
18.1.3 / CALL
/
CALL. . , / CALL,
.
CALL.
LAD: CALL ( ), ( ).
, CALL, , ,
CALL . , , .
FBD: CALL ,
, ,
RLO = 1 CALL.
, , .
, OS;
CC0, CC1 OV .

18

MCR-. MCR , , MCR . , MCR- , .


/ CALL
B-; ,
. .
(, 1
), , ,
.
18.1.4

RET.

LAD:

RET

FBD:

RET

,
. /
RET .
,
. ,
. , CPU
.
, .

== 1

BR := 1
BR := 0

10

18.1

/ RET RLO (
) BR , .
ENO (. 15 ).
18.1.5
, .
; .
, (L-) . CPU
, . L- . , . , L- .
, , . , ,
L- .
, .
File Properties (
), SIMATIC- Edit Object Properties (
), General Part 2
( 2).


:
temp ()
VAR_TEMP END_VAR ,
( ).
18.3 . temp1 INT;
temp2 REAL.
L- .

11

18

Address
()

Declaration
()

Name
()

Type
()

Initial value
( )

0.0

in

Man_on

BOOL

FALSE

2.0

out

Switch_on

BOOL

FALSE

4.0

in_out

Length

INT

6.0

stat

Total

INT

8.0

stat

Setpoint

DINT

L#0

0.0

temp

Deviation

INT

2.0

temp

Intermediate

REAL

Comment
()
Input parameter (
)
Output parameter ( )
I/O parameter ( /
)
Static local data ( )
Temporary local data ( )

18.3

.

() .
, , . , ,
,
.

(:
)
L-
L- CPU. , , . S7-300
, , CPU 314 256 .
S7-400 CPU
. , , ,
.
, ,
, ,
.

12

18.1


, CPU () .
20 . 20 , 21 , 22 23 .
20
.
( ), 20 ( ) , .
. .
Standard Library ( ) Organization Blocks ( ).
, 20 - , ,
( 18.4).
Address
()
0.0

Declaration
()
temp

*1.0

temp

20.0

temp

*1.0

temp

Name
()
SINFO

Type
()
ARRAY [1..20]
BYTE

LByte

ARRAY [1..16]
BYTE

18.4



. . L-,
.
() .
L; L,
LB, LW, LD.
: 16
,
. ,

13

18

0. , 20.
ANY

ANY ().
ANY (. 24.2.5 ANY).
18.1.6
, .
.
, .

CPU .

:
(declaration) stat
VAR END_VAR , ( ).
18.3 18.1.5
.
, , ,
.
.

14

18.1


.
() .
,
, .
: Totalizer , , . (. 18.5).
Total TotalizerData,
Totalizer ( ,
). ; In Total INT.

, , . , Data
Block Name.Operand Name ( . ), .
TotalizerData, Total. .

MOVE

TotalizerData.Total

EN

ENO

IN

OUT

MW 20

MOVE

EN

ENO

IN

OUT

TotalizerData.Total

15

18
FB Totalizer
Address
+ 0.0
+ 2.0

DB TotalizerData

Declaration
in
stat

Name
In
Total

Type
INT
INT

Address
+ 0.0
+ 2.0

Declaration
in
stat

Name
In
Total

Type
INT
INT

LAD

#In
#Total

ADD_I
EN
ENO
IN1
OUT
IN2

#Total

(
data view) ,
.

FBD

#In
#Total

EN
IN1
IN2

ADD_I
OUT
ENO

#Total

FB Evaluation
Address
0.0
0.1
2.0
2.1
4.0

DB EvaluationData

Declaration
in
in
stat
stat
stat

Name
Add
Delete
EM_Add
EM_Del
Memory

Type
BOOL
BOOL
BOOL
BOOL
Totalizer

Address
0.0
0.1
2.0
2.1
4.0
6.0

Declaration
in
in
stat
stat
stat:in
stat

Name
Add
Delete
EM_Add
EM_Del
Memory.In
Memory.Total

Type
BOOL
BOOL
BOOL
BOOL
INT
INT

LAD
#Add

#EM_Add
P
Value2

#Delete

#EM_Del
P

#Memory
EN
ENO
In
MOVE
EN
ENO

MOVE
EN
ENO
0

#Memory.Total

IN

OUT

IN

OUT

#Memory.Total

MOVE
OUT

#Memory.Total

Result2

FBD
#Add

#EM_Add
P
Value2

#Delete

#Memory
EN
ENO
In

#EM_Del
P

EN

#Memory.Total

IN

MOVE
OUT

Result2

ENO

EN
0

IN

ENO

18.5

16

18.1


,
.
.
STEP 7 V2, ,
. ( )
. , 2,
. 8.
( 18.5, ): Evaluation Memory,
Totalizer, . Totalizer Memory,
, Memory
() (Memory Totalizer).
Memory
Evaluation , ,
(Memory) (Total).
EvaluationData, ,
Memory.In Memory.Total, , , EvaluationData. Memory.Total.
FB 6, FB 7 FB 8 Program Flow Control ( ) .
19.5.3 .

, .
.
DI. DI, ,
, ,
. DIX, DIB,
DIW DID.

17

18

, ,
. . !
, . , . ,
. ,
, , . , View Data View ( ).
, Total Totalizer DIW 2,
Totalizer (. TotalizerData), DIW 6, Totalizer Evaluation (. EvaluationData).

18

18.2

18.2
. ,
; ,
,
.
,

, .
:
(global data blocks), ,
(instance data blocks), .
,
.
. , .
.
CPU. 1; DB 0. , .
, ,
, , SFC 22 CREAT_DB.
18.2.1
CPU S7 .
; ,
. , . (fully-addressed access) (
. ), .
.

, . (Global Data Block Register,
DB) (Instance Data

19

18

Block Register, DI). CPU .


( ).
,
LAD FBD DB. /
OPN (. ), DB.
LAD FBD DI; , .
, ,
.
DB, DBW;
, DI, DIW. ( 18.1).
18.1

,
DB

DI

DBX y.x

DIX y.x

DBB y

DIB y

DBW y

DIW y

DBD y

DID y

x = , y =

18.2.2
:
,

.

. , .

,
.

20

18.2

( ),
(
, ;
, , DBB 156 DBB 165,
, )
(
CPU ?).
( ), .
:
1)
, . (,
Motor1) (, DB 51).
2)
( ) . (
).
.

. :
MOTOR1.ACTVAL
DB 51.DBW 20

MOTOR1 , . ACTVAL ,
. MOTOR1.ACTVAL
() , DB 51.DBW 20.

( DB). DB,
.
, . , , ,
.

21

18


,
.
:
, . , ,
( 18.2.4 ). , ,
.
( ), , ; , , , .
18.2.3
, DB OPN
(LAD) OPN (FBD).

LAD:

DB x
OPN

FBD:

DB x
OPN

/ OPN
( ) .
DB. LAD FBD
/ OPN DI. ( DI .)
/ OPN
(Program Elements Catalog) DB
Call ( DB).
.
, / OPN,
,
.
, , ,
() 22

18.2

. :
DB .
: DBW 10 DB 13
DBW 16 DB 14. MOVE
.
, , (. 18.6). .
,
. , , ( 18.2.4 ).
/ CALL
.
.

:
Network 5: DB 13
DB 13
OPN

DB 13
OPN

Network 6: DB 13

DWB 10

EN
IN

MOVE
ENO
OUT

#t_WORD

DWB 10

EN
IN

MOVE
OUT
ENO

#t_WORD

Network 7: DB 14
DB 14
OPN

DB 14
OPN

Network 8: DB 14

#t_WORD

MOVE
EN
ENO
IN
OUT

DWB 16

#t_WORD

MOVE
EN
OUT
IN
ENO

DWB 16

MOVE
OUT

DB 14.
DBW 18

Network 9:
EN
DB 13.
DBW 12

IN

MOVE
ENO
OUT

EN
DB 14.
DBW 18

DB 13.
DBW 12

IN

ENO

18.6

23

18

18.2.4
DB
,
, DB:


, . DB . .

DB: /
(in/out) .

DB ( , )
. , , ,
.
,
.
DB.
DI
DI . DI. ,
(declaration table) , , , .
,
.
, . -

24

18.2

, .
,
, . AR2 . ,
STL.

(Properties) Blocks () Blocks ,
, .
Absolute address has priority ( ) ( STEP 7). , , , .
Symbolic address has priority ( ),
, .
: , DBW 10 DB 1 ActValue.
:
Data.ActValue

DB1.DBW 10

Data DB 1. MaxCurrent
DBW 10, ( )
:
Absolute address has priority ( ):
Data.MaxCurrent

DB1.DBW 10

Symbolic address has priority ( ):


Data.ActValue

DB1.DBW 12


( ),
. 2.5.5 .

25

18

18.3
.
18.2.
SFC 22 CREAT_DB
;
SFC 23 DEL_DB
;
SFC 24 TEST_DB
.
18.3.1
SFC 22 CREAT_DB
. ,
LOW_LIMIT UP_LIMIT. , , . , . DB_NUMBER
. COUNT . .
, . .
.
,
.
, , .
18.3.2
SFC 23 DEL_DB ,
RAM ( ),
DB_NUMBER. , CPU
STOP.
, UNLINKED (), FEPROM SFC 23.
,
.

26

18.3

18.3.3
SFC 24 TEST_DB
( DB_LENGTH)
( WRITE_PROT). DB_NUMBER.
, .
18.2 SFC
SFC
22

23
24

LOW_LIMIT

INPUT

WORD

UP_LIMIT

INPUT

WORD

COUNT

INPUT

WORD

( )

RET_VAL

OUTPUT

INT

DB_NUMBER

OUTPUT

WORD

DB_NUMBER

INPUT

WORD

RET_VAL

OUTPUT

INT

DB_NUMBER

INPUT

WORD

RET_VAL

OUTPUT

INT

DB_LENGTH

OUTPUT

WORD

( )

WRITE_PROT

OUTPUT

BOOL

1 =

27

19
19

............................................................................................................... 4
19.1 ............................................................................ 4
19.1.1
.................................................................................. 4
19.1.2
...................................................................................... 4
19.1.3
........................................................................................ 5
19.1.4
......................................................................................... 7
19.1.5
.............................................................................. 8
19.2 ......................................................................................................... 9
19.3 ...................................................................................................... 13
19.4 .......................................................................................... 18
19.5 ................................................................................................................................ 19
19.5.1
.......................................................... 19
19.5.2
......................................................................................... 20
19.5.3
..................................................................................... 21

19

19


, .

,
,

.
. .

19.1
19.1.1
, . : , ,
. ; ( 19.1).
,
.
(input parameter), .
(, , , ),
(output parameter).
/ (in/out parameter),
, .
.
19.1.2
. ,
; (formal parameters).

19.1

Adder
Number_1

+INT

Number_2
Number_3

(
INT)

Block header ( )
FC 12
Name : Adder

Author : Berger

Family : Book

Version : 01.00

Declaration table ( )
Result

(
INT)

Declaration
in
in
in
out
temp

Name
Number_1
Number_2
Number_3
Result
Memory

Type
INT
INT
INT
INT
INT

Program ()

Number_1
Number_2
Memory
Number_3

ADD_I
Memory
ADD_I
Result

19.1
Adder () .
( 19.2). , ;
(actual parameters).
CPU .
MW 30, MW 32 MW 34 MW 40.
DBW 30, DBW 32 DBW 34 DB 13 DBW 40 DB 14.
19.1.3
. (declaration table).
in (), out (), in_out (/)
(stat)
(temp).
, . .

19


//
MW 30

Adder
Number_1
Result

MW 32

Number_2

MW 34

Number_3

//
DB 13.DBW 30

MW 40

Adder
Number_1
Result

DB 13.DBW 32

Number_2

DB 13.DBW 34

Number_3

DB 14.DBW 40


ADD_I
Number_1

IN1

Number_2

IN2

OUT

Memory

ADD_I
Memory

IN1

Number_3

IN2

OUT

Result



//
MW 30
MW 32
Memory
MW 34

ADD_I
IN1
OUT
IN2
IN1
IN2

//
DB 13.DBW 30
DB 13.DBW 32

IN1
IN2

Memory
DB 13.DBW 34

IN1
IN2

ADD_I
OUT

MW 40

ADD_I
OUT

Memory

ADD_I
OUT

DB 14.DBW 40

19.2

Memory

19.1

19.1
Address
()

Declaration
()

Name
()

Type
()

in
out
in_out
stat
temp

Initial value
(
)

Comment
()
Input parameter (for FCs and FBs) /
( FC FB)
Output parameter (for FCs and FBs) / ( FC FB)
In/out parameter (for FCs and FBs) / / ( FC
FB)
Static local data (for FBs) / ( FB)
Temporary local data (for OBs, FCs and FBs) /
( , FC
FB)

.
24 .
( , ), . . .
,
, (. 3.5 , ).
STEP 7 . CPU (
) (declaration types)
. ,
CPU, , . , CPU , .
.
19.1.4
.
RET_VAL ( ret_val) .
RET_VAL
.
, DATE_AND_TIME, STRING, POINTER, ANY
UDT. ARRAY STRUCT .

19

,
LAD FBD. STL, FUNCTION ()
. FC ;
.
19.1.5

. ,
, . ,
.
.

.

19.2

19.2
.
, ,
, . 19.4 ,
.

POINTER ANY LAD FBD . , , , . , ,
Data Types ( ).
19.2 ()

IN

I_O

OUT

TIMER

COUNTER

BLOCK_FC, BLOCK_FB

BLOCK_DB

BLOCK_SDB



BOOL
BYTE, WORD, DWORD, CHAR, INT,
DINT, REAL, S5TIME, TOD, DATE

DT, STRING
ARRAY, STRUCT

POINTER, ANY
1)

1)

FC

BOOL
BOOL
. /

19

, / , .
, CPU ,
, , .

8, 16 32 (
BOOL). .
/
, /
.

MOVE, 6 .
DT STRING
DT STRING . DT
STRING .
ARRAY STRUCT
ARRAY
STRUCT, .
( ) ,
.
ARRAY STRUCT .

, STRUCT.
UDT, .

10

19.2

. .

UDT .
TIMER
TIMER , 7 .
S5TIME.
COUNTER
COUNTER ,
8 .
WORD.
BLOCK_DB
BLOCK_DB. / OPN / OPN .
CPU
( DB).
BLOCK_FC
FC BLOCK_FC.
/ CALL.
/ CALL
, .
/ CALL , ( ).
FC, , .

11

19

BLOCK_FB
FB
BLOCK_FB. BLOCK_FB LAD FBD .
FB, , .
POINTER ANY
POINTER ANY LAD FBD .

12

19.3

19.3
, ,
, .
. ,
.
.
BOOL (, );
ARRAY , . 19.3 , .
19.3


,
,





TIMER, COUNTER BLOCK_xx


POINTER

,
,

(range pointer) DB

ANY

ANY


.
, . , () , . ,
, . /
.
, ,
.

13

19

. , . :
Station_1
Up. ( ),
Station_1.Up
.

, 19.4, .
19.4

IN

I_O

OUT

( )

I y.x

( )

Q y.x

QB y, QW y, QD y

M y.x

MB y, MW y, MD y

PIB y, PIW y, PID y

PQB y, PQW y, PQD y

DBB y, DBW y, DBD y

DB z.DBX y.x

DB z.DBB y ..

L y.x

LB y, LW y, LD y

DIX y.x

ARRAY
STRUCT

DIB y, DIW y, DID y


IB y, IW y, ID y

x = , y = , z =

, ,
. , (
).
.
.
LAD FBD TRUE FALSE
, .
. (LAD)

14

19.3

(FBD). TRUE FALSE, , 1 0, .


. , 1 0 , .

.
S

.
.

&

.
R

S
.

&

LAD
FBD . ,

. LAD FBD
, .
.
, , .
/ : ( ,
).
, , ( ) . (,
)
, .
.
.
L- () .
,
(. 19.4 ).
; DI, 18.2.4
.

15

19

BOOL, TRUE (
1) FALSE ( 0), , .
.
, , .

.
.
DT STRING .
STRING . STRING
, ;
, STRING 256 . STRING, ,
. : FC STRING , 254 ; STRING .
ARRAY STRUCT .


(UDT). UDT, , ,
.
. () ( UDT), .

TIMER, COUNTER BLOCK_xx
TIMER ,
COUNTER .

16

19.3

BLOCK_FC BLOCK_FB .
BLOCK_DB .
TIMER, COUNTER BLOCK_xx
.
POINTER
() POINTER. (range pointer), DB-.
32- , 48-. .
POINTER .
ANY
ANY
. ,
( ) . ANY- P#[data block.]Operand Datatype Number (P#[
.] ) .
ANY .

17

19

19.4

. . , , .
,
( ). , , ,
. / .
, ,
.

.
, . TIMER, COUNTER BLOCK_xx , .
19.5.
19.5

FC FC

FB FC

FC FB

Input Input

Output Output

In/out Input

In/out Output

In/out In/out

(Elementary)
C (Complex)
(Parameter) TIMER, COUNTER BLOCK_xx

18

FB FB

19.5

19.5
19.5.1
.

, 5 .
,
, ( ).
19.3 ,
.
. ,
, ,
, .
, ,
() , .
Conveyor_Belt . ;
1 (conveyor belt 1), 2 (conveyor belt 2).
,
.
1 BeltData1, 2 BeltData2.
Conveyor
Example ( ) LAD_Book FBD_Book
. FB 21 , . ; DB 21 BeltData1, DB 22
BeltData2. ( FB 21, Conveyor_Belt FB
21).

. , ,
.
( 19.7 ).

19

19
FB Conveyor_belt
BOOL
BOOL
BOOL
BOOL
BOOL
BOOL
BOOL

Start
Continue
Basic_st
Man_on
Stop
End_belt
Mfault

Readyload
Ready_rem
Belt_mot

STAT

FB Parts_counter
BOOL
BOOL
BOOL

BOOL
BOOL
BOOL
COUNTER
WORD
Timer
S5TIME
S5TIME

Set
Acknowl
Lbarrier
Count
Quantity
Tim
Durat1
Durat2

Finished
Fault

STAT
Load
Remove
EM_Rem_N
EM_Rem_P
EM_Loa_N
EM_Loa_P

BOOL
BOOL
BOOL
BOOL
BOOL
BOOL

TEMP
PM_Rem_P
PM_Loa_P

Active
EM_LB_P
EM_LB_N
EM_Ac_P
EM_ST_P

BOOL
BOOL
BOOL
BOOL
BOOL

TEMP
BOOL
BOOL

19.3

PM_LB_P
PM_LB_N
t_BOOL
t_S5TIME

BOOL
BOOL
BOOL
S5TIME

19.4

19.5.2
.
8 .
,
, .
.
19.4 , .
TIMER COUNTER.
.
(Quantity) (Durat1 Durat2) ; .
,
.
LAD_Book FBD_Book
Conveyor Example ( ) .
FB 22 Parts_counter -

20

BOOL
BOOL

19.5

CountDat. , ,
( ) .
19.5.3
, ,
. ,
, Feed (), . FB Conveyor_Belt , FB Parts_counter
. , FB
Feed.
19.5 , (FB Parts_counter ). (Start) Start 1 (belt 1), Ready_rem
Start 2 (belt 2) . , Ready_rem 4 (belt 4) Remove Feed. Remove Continue
Readyload Load.
Belt_mot, Lbarr /Mfault ;
Reset, Start Stop Basic_st,
Man_on Stop.
Feed
/Mfault1
Lbarr1
Belt_mot1

Start
Load

Reset
Man_start
Stop

Start

Ready_rem

/Mfault4
Lbarr4
Belt_mot4

Start

Belt1
Readyload

Ready_rem
Belt4

Continue

Readyload

Continue

Remove

Removed

Basic_st
Man_on
Stop
Belt1, , Belt4 Conveyor_Belt

19.5
21

19

Feed
.
19.5. , Quantity,
Durat1 Durat2 .
,
, . Belt1
Conveyor_Belt, Belt2 ; Check
Parts_counter.
,
. , , ,

. Man_on
Man_on
(). Stop Reset. . (, ,
.)
Feed. ,
. ( , .) , ().
FB Parts_counter ,
.
Feed FB.
Quantity, Durat1 Durat2 Feed . ( ) 100 (, ,
).

22

19.5

19.6 FB Feed
Address
()

Declaration Name
() ()

Type
()

Initial value
(
)

0.0

in

Start

BOOL

FALSE

0.1

in

Removed

BOOL

FALSE

0.2

in

Man_start

BOOL

FALSE

0.3

in

Stop

BOOL

FALSE

0.4

in

Reset

BOOL

FALSE

2.0

in

Count

COUNTER

4.0

in

Quantity

WORD

6.0

in

Tim

TIMER

8.0

in

Durat1

S5TIME

S5T#5s

10.0

in

Durat2

S5TIME

S5T#10s

12.0

out

Load

BOOL

FALSE

12.1

out

Remove

BOOL

FALSE

W#16#200

Comment
()
Start conveyor belts /
Parts have been removed from belt /
Start conveyor belts manually /

Stop conveyor belts /
Set control to the basic setting /
( )
Counter for the parts /
Number of parts /
Timer for the monitor / ( )
Monitoring time for parts /
Monitoring time for gap /
Load new parts onto belt /

Remove parts from belt /

in_out
14.0

stat

Belt1

20.0

stat

Belt2

26.0

stat

Belt3

32.0

stat

Belt4

38.0

stat

Check

Conveyor_
belt
Conveyor_
belt
Conveyor_
belt
Conveyor_
belt
Parts_
counter

Control for belt1 /


1
Control for belt2 /
2
Control for belt3 /
3
Control for belt4 /
4
Control for counting and monitoring /

temp

23

19

#Man_start

#Belt1.Man_on
#Belt2.Man_on
#Belt3.Man_on
#Belt4.Man_on

#Stop

#Belt1.Stop
#Belt2.Stop
#Belt3.Stop
#Belt4.Stop

#Reset

#Belt1.Basic_st
#Belt2.Basic_st
#Belt3.Basic_st
#Belt4.Basic_st

#Belt1
EN

ENO

#Start
Start

Readyload

#Load

Lbarr1
End_belt

Belt_mot

Belt_mot1

/Mfault1
Mfault
#Belt2.Readyload

#Belt1.Continue

#Belt1.Ready_rem

#Belt2.Start

24

19.6
(LAD)

19.5

#Belt2
EN

ENO

Lbarr2
End_belt

Belt_mot

Belt_mot2

/Mfault2

19.6
(LAD)

Mfault
#Belt3.Readyload

#Belt2.Continue

#Belt2.Ready_rem

#Belt3.Start

#Belt3
EN

ENO

Lbarr3
End_belt

Belt_mot

Belt_mot3

/Mfault3
Mfault
#Belt4.Readyload

#Belt3.Continue

#Belt3.Ready_rem

#Belt4.Start

#Belt4
EN

ENO

#Removed
Continue

Ready_rem

End_belt

Belt_mot

#Remove

Lbarr4
Belt_mot4

/Mfault4
Mfault
#Check
EN

ENO

Set

Finished

#Start
Finished

Acknowl
Acknowl

Fault

Fault

Lbarr1
#Count
#Quantity
#Tim
#Durat1
#Durat2

Lbarrier
Count
Quantity
Tim
Durat1
Durat2

25

19

#Man_start

&

#Belt1.Man_on
=
#Belt2.Man_on
=
#Belt3.Man_on
=
#Belt4.Man_on
=

#Stop

#Belt1.Stop
=

&

#Belt2.Stop
=
#Belt3.Stop
=
#Belt4.Stop
=

#Reset

&

#Belt1.Basic_st
=
#Belt2.Basic_st
=
#Belt3.Basic_st
=
#Belt4.Basic_st
=
#Belt1

#Start
Lbarr1
/Mfault1

#Belt2.Readyload

#Belt1.Ready_rem

Start
End_belt
Mfault

Readyload
Belt_mot

&

#Belt1.Continue
=

&

#Belt2.Start
=

#Load
Belt_mot1

19.7 (FBD)

26

19.5

#Belt2
Lbarr2
/Mfault2

#Belt3.Readyload

#Belt2.Ready_rem

End_belt
Mfault

Belt_mot

&

#Belt2.Continue
=

&

#Belt3.Start
=

Belt_mot2

#Belt3
Lbarr3
/Mfault3

End_belt
Mfault

Belt_mot

#Belt4.Readyload

&

#Belt3.Continue
=

#Belt3.Ready_rem

&

#Belt4.Start
=

Belt_mot3

#Belt4
#Removed
Lbarr4
/Mfault4

Continue
End_belt
Mfault

Ready_rem
Belt_mot

#Remove
Belt_mot4

#Belt4
#Start
Acknowl
/Mfault4
#Count
#Quantity
#Tim
#Durat1
#Durat2

Set
Acknowl
Lbarrier
Count
Quantity
Tim
Durat1
Durat2

Finished
Fault

Finished
Fault

19.7 (FBD)

27

19

19.7 ,

Symbol
()

Address
()

BeltData1

DB 21

Data Type
Comment ()
( )
Conveyor belt control /
FB 21

FB 21
Data for conveyor belt1 / 1

BeltData2

DB 22

FB 21

Parts_counter

FB 22

FB 22

CounterDat

DB 29

FB 22

Feed

FB 20

FB 20

FeedDat

DB 20

FB 20

Cycle

OB 1

OB 1

Basic_st

I 0.0

BOOL

Man_on

I 0.1

BOOL

/Stop

I 0.2

BOOL

Start

I 0.3

BOOL

Continue

I 0.4

BOOL

Acknowl

I 0.6

BOOL

Set

I 0.7

BOOL

Lbarr1

I 1.0

BOOL

Lbarr2

I 1.1

BOOL

Lbarr3

I 1.2

BOOL

Lbarr4

I 1.3

BOOL

/Mfault1

I 2.0

BOOL

/Mfault2

I 2.1

BOOL

/Mfault3

I 2.2

BOOL

Conveyor_belt FB 21

28

Data for conveyor belt2 / 2


Counter control and monitor /
( )
Data for parts counter /
Feed with several belts /

Data for Feed /


Main program, cyclic execution / ,
Set controller to the basic state /
Switch on conveyor belt motors /
Stop conveyor belt motors (zero active) /
( )
Start conveyor belt /
Acknowledgement that parts have been removed /
,
Acknowledge fault /
Set counter, activate monitor / ,
(Light barrier) End of belt sensor signal for conveyor belt 1 /
( )
1
(Light barrier) End of belt sensor signal for conveyor belt 2 /
( )
2
(Light barrier) End of belt sensor signal for conveyor belt 3 /
( )
3
(Light barrier) End of belt sensor signal for conveyor belt 4 /
( )
4
Motor protection switch conveyor belt 1 (zero active) / 1 ( )
Motor protection switch conveyor belt 2 (zero active) / 2 ( )
Motor protection switch conveyor belt 3 (zero active) / 3 ( )

19.5

19.7
Symbol
()

Address
()

/Mfault4

I 2.3

Readyload

Q 4.0

Ready_rem

Q 4.1

Data Type
Comment ()
( )
Motor protection switch conveyor belt 4 (zero active) / BOOL
4 ( )
Load new parts onto belt / BOOL

BOOL
Remove parts from belt /

Finished

Q 4.2

BOOL

Number of parts reached /

Fault

Q 4.3

BOOL

Belt_mot1

Q 5.0

BOOL

Belt_mot2

Q 5.1

BOOL

Belt_mot3

Q 5.2

BOOL

Belt_mot4

Q 5.3

BOOL

Quantity

MW 4

WORD

Durat1

MW 6

S5TIME

Durat2

MW 8

S5TIME

Count

C1

COUNTER

Monitor activated /
Switch on belt motor for conveyor belt 1 /
1
Switch on belt motor for conveyor belt 2 /
2
Switch on belt motor for conveyor belt 3 /
3
Switch on belt motor for conveyor belt 4 /
4
Number of parts /
Monitoring time for light barrier covered /

Monitoring time for light barrier not covered /
Counter for parts /

Monitor

T1

TIMER

Timer for monitor /

29


.
(main program) . CPU .
PLC.
,
. ,
CPU, ,
.
(interrupt servicing). ( , , , , )
, , , .
, , .
CPU (start-up
program), ,
.
(error handling)
. STEP 7 , , ,
. .

20


; ; ; ; ;
;

21


; ; ;
; ;

22


, , ; ; ; ;

23


( , );
; ;

20
20

............................................................................................................. 4
20.1 ....................................................................................................... 4
20.1.1
.................................................................................................... 4
20.1.2
............................................................................................... 5
20.2 ....................................................................................... 8
20.2.1
......................................................................................... 8
20.2.2
.................................................................... 10
20.2.3
, ........................ 11
20.2.4
............................................................................................................... 13
20.2.5
................................................................................................ 14
20.3 ........................................................................................................ 17
20.3.1
.......................................................................................... 17
20.3.2
........................................................................................ 18
20.3.3
................................................................................ 18
20.3.4
CPU ..................................................................................................... 20
20.3.5
..................................................................................................... 20
20.3.6
..................................................................... 21
20.4 / ..................................................... 23
20.4.1
/ ............................................................ 23
20.4.2
/ ............................................. 28
20.4.3
/ .................................... 42
20.5 ................................................................................... 47
20.5.1
........................................................................................................................... 47
20.5.2
GD- ..................................................................... 51
20.5.3
GD- ............................................................ 53
20.6 SFC- .............................................................................................................. 55
20.6.1 SFC- ........................................................................... 55
20.6.2
.............................................. 56
20.6.3 SFC- ................................................................................. 58
20.6.4
SFC- ..................................... 60
20.7 SFB- .............................................................................................................. 65
20.7.1
........................................................................................................................... 65
20.7.2
................................................................................. 67
20.7.3
................................................................................. 69
20.7.4
....................................................................................... 71
20.7.5
................................................................................................... 71
20.7.6
.................................................................................................. 73

20

20


;
.
.
, .
1.
. CPU
RUN RUN-P. RUN-P CPU . RUN
, ; RUN,
.

20.1
20.1.1

.
. .
,
.
(
). , , , , .
. :

1. . STEP 7
.
.
,
.
1, ,
. . 4

20.1

, OB 1.
, . ,
, , (
).
, , , . (),
, , .
( )
.
LAD FBD ,
( ). 3 SIMATIC S7
, .

18 . ( )
. 19
.
20.1.2

(CPU) , .
. , , , ( ) (-)
.

( ) CPU. CPU 314, ,
, , ( 1),
( ). , CPU STOP, Block overflow
( ).

20

(SFB)
(SFC).
,
, , ( ).
-
1 , .
, .
,
.
, ,
.
-
. ,
. , ( ).
- . .
, , , .
. 20.1
: , . Feeding Conveyor 1 ( 1),
Feeding Conveyor 2 ( 2), Process ()
Discharging Conveyor ( )
.
. 1;
, . . Feeding Conveyor 1 Feeding Conveyor 2 ; FB 20 DB 20 Feeding Conveyor 1

20.1

DB 21 Feeding Conveyor 2
. FC 20
() (
);
FB 20.
FB 101 .
, DB 20. FB 29. FB 50, DB 50, , FB 29 ( )
DB 60. FC 51 .
FB 51 ( DB 51), SFB 8,
SFB 9 SFB 62. SFB
DB 51.
OB 1

Main program /
FB 10
DB 10

Operating modes /

FB 20
DB 20

Feed 1 / 1
FC 20

Interlocks /

FB 101

Belt control 1 / 1

FB 101

Belt control 2 / 2

..
FB 29

Data acquisition /

FB 20
DB 21

Feed 2 / 2

FB 30
DB 30

Process /

FB 40
DB 40

Discharge /

FB 50
DB 50

Data processing /
DB 60

Conveyor data /

FC 51

Data preparation /

FB 51
DB 51

Communication /
SFB 8

USEND

SFB 9

URCV

SFB 62

CONTROL

20.1

20

20.2
20.2.1
CPU ( 1.1.4
CPU). I/O (/) , CPU. CPU .
,
. CPU , ,
,
.
( I)
( Q), process-image input table process-image output table.
CPU OB 1
. 1,
, . 1
( 20.2).
, ,
, 85 Program Execution Error ( ). 85 ,
CPU STOP.

CPU, , 9 16.
, ,
.
.
, 1 8 15,
0. 0
CPU .
CPU,
.

20.2

CPU 1998 .

PII

PIO PII

CPU 1998 .

PIO

PII

PIO

PII

SPIIn SPIOn

PII


0
PIO

0
SPIIn n
SPIOn n

20.2
SFC 26 UPDAT_PI
SFC 27 UPDAT_PO

. SFC 26 UPDAT_PI,
SFC 27 UPDAT_PO.
20.1 SFC. SFC 0.
, SFC
. ,
( ),
, ,
9

20

,
.
. , ,
, SFC.
20.1 SFC

SFC

PART

26

27

INPUT

BYTE

(0 15)

RET_VAL

26

27

OUTPUT

INT

FLADDR

26

27

OUTPUT

WORD


:
,

20.2.2
1 (scan cycle monitor)
(scan cycle watchdog).
(scan cycle monitoring time) 150 .
1 6
CPU.
,
, CPU 80 (Timeout, ). 80 , CPU STOP.

1.
, (
). , ,
GD- PG CPU ( !)
.
, CPU (Cyclic load from communication, Cycle/Clock
memory bits, / ).

CPU, PLC Module Information (PLC ) , .
Cycle Time ( ) ,
. -

10

20.2


.
, PLC
1.
SFC 43 RE_TRIGR

SFC 43 RE_TRIGR ; ,
CPU. SFC 43 .

.
:
(no-load cycle,
), ;
; ;
; ;
.
CPU
CPU
. , CPU ,
CPU.
()
CPU.
20.2.3 ,
CPU , . ( ) , CPU ,
1.
0 ,
. -

11

20

1 6 Cycle/Clock memory bits,


(/ ) CPU.
90

CPU 90 Background scanning
( ). 20.3.
90 . 1,
90 . 1 .
90 , ,
, 90, .
1.
1 , 90.
90 .

CPU 1998 .


90

PII

PIO

90

PII


CPU 1998 .


90

PIO

PII

90

20.3

12

PIO

PII

20.2

90 , CPU RUN.
, 1. ( 1) ,
90 ( ):
#16#91
CPU;
B#16#92
, 90;
B#16#93
() 90 RUN;
B#16#95
90
.
20.2.4
1
, (response time),
( ). , .
(limit switch)
0 1.
, 1 ,
.
, , .
, , ; .

.
( 20.4).
, .
,
. .

(, , , , , MPI- ).

13

20


PIO

PII

PIO

PII

PIO

PII

20.4
, ,
. , .

/, .
20.2.5
CPU 20 OB 1.
.
Standard Library, Organization Blocks ( ).
20.2 1,
. .
, 20 (, 20- ).
SIMATIC S7 , . 1, ,
B#16#11, OB. , , , , .
.
INT, , . DATE_AND_TIME -

14

20.2

,
1.
, , . , ,
SFC RD_SINFO .
20.2 1

OB1_EV_CLASS

BYTE

OB1_SCAN_1

BYTE

OB1_PRIORITY

BYTE

B#16#11 =
B#16#01 =
B#16#02 =
B#16#03 =
B#16#01

OB1_OB_NUMBER

BYTE

B#16#01

OB1_RESERVED_1

BYTE

OB1_RESERVED_2

BYTE

OB1_PREV_CYCLE

INT

OB1_MIN_CYCLE

INT

OB1_MAX_CYCLE

INT

OB1_DATE_TIME

INT




()

SFC 6 RD_SINFO

(
) ,
, SFC 6
RD_SINFO ( 20.3).
TOP_SI 12
, START_UP_SI 12
.
(time stamp).
SFC 6 RD_SINFO ,
,
. SFC
, , , TOP_SI -

15

20

. TOP_SI START_UP_SI .
20.3 SFC 6 RD_SINFO
SFC
6

RET_VAL

OUTPUT

TOP_SI

OUTPUT

START_UP_SI
.EV_CLASS
.EV_NUM
.PRIORITY
.NUM
.TYP2_3
.TYP1
.ZI1
.ZI2_3

16

OUTPUT

,

(
, START_UP_SI)

STRUCT
BYTE
BYTE
BYTE
BYTE
BYTE
BYTE
WORD
DWORD

.
ID ()

( )

ID 2_3
ID 1
1
2_3

20.3

20.3
CPU Hardware Configuration
PLC
, .
20.3.1
(real-time clock) CPU :
SFC 0 SET_CLK

SFC 1 READ_CLK

SFC 48 SNC_RTCB
CPU
20.4 .
CPU ,
( ) CPU . CPU
, .
SFC 48 SNC_RTCB CPU
.
SFC 0 SET_CLK .
20.4 SFC
SFC

PDT

INPUT

DT

()

RET_VAL

OUTPUT

INT

RET_VAL

OUTPUT

INT

CDT

OUTPUT

DT

()

RET_VAL

OUTPUT

INT

1
48

17

20

20.3.2
(system clock) CPU
. , CPU
RUN. CPU STOP HOLD, .
CPU S7-400, , .
( ) .
TIME, ,
:
TIME#0ms TIME#24d20h31m23s647ms.
0. CPU 3xx ( CPU 318) 10 , CPU 318 CPU 4xx
.
SFC 64 TIME_TCK

SFC
64 TIME_TCK. RET_VAL
TIME.
, , CPU , ,
SFC 64. TIME DINT.
20.3.3
(run-time meter) CPU .
, CPU ,
CPU.
CPU .
STOP HOLD, ; CPU ,
.
32767 .
SFC.

18

20.3


:
SFC 2 SET_RTM

SFC 3 CTRL_RTM

SFC 4 READ_RTM

20.5 .
NR BYTE.
(
). PV ( INT) . S
SFC 3 ( 1) (
0) . CQ , ( 1) ( 0). CV INT.
20.5 SFC
SFC

NR

INPUT

BYTE

PV

INPUT

INT

RET_VAL

OUTPUT

INT

NR

INPUT

BYTE

INPUT

BOOL

RET_VAL

OUTPUT

INT

NR

INPUT

BYTE

RET_VAL

OUTPUT

INT

CQ

OUTPUT

BOOL

CV

OUTPUT

INT

,
( B#16#01
B#16#08)


( B#16#01
B#16#08)
( 1) ( 0)


( B#16#01
B#16#08)

(1) (0)

19

20

20.3.4 CPU
,
, CPU RAM,
. Compress ()
CPU, , .
Compress ()
, CPU, SFC 25
COMPRESS. SFC 25 20.6.
. SFC
BUSY = 1, , .
DONE = 1 , . SFC , , Delete Block ( ) PG , ( , Block
Status).
, , CPU, ,
CPU . Compress (), PG, CPU STOP.
20.6 SFC 25 COMPRESS
SFC

25

RET_VAL

OUTPUT

INT

BUSY

OUTPUT

BOOL

( 1)

DONE

OUTPUT

BOOL

( 1)

20.3.5
SFC 47 WAIT .
SFC 47 WAIT WT INT,
(s).
32767 ; , CPU. SFC 47
. S7-300
.
SFC 46 STP , CPU STOP. SFC 46 STP .

20

20.3

20.3.6
S7-400 ( ).
CPU , P-
K-.
S7-400 ,
Hardware Configuration CPU .
; CPU ,
CPU.
Multicomputing ( ).
CPU PLC,
CPU.
.
Addresses () CPU Assignment ( CPU) ( 20.5). , ,
CPU. View Filter CPU No. x-modules (
CPU x-) , CPU,
.
CPU .
,
;
RUN ;
HOLD,
CPU;
STOP, CPU .
, CPU 86. CPU
; . SFC 35 MP_ALM CPU 60 Multiprocessor interrupt
( ) ( 21.6 ).

21

20

20.5

22

20.4 /

20.4 /
, CPU, (,
DP-) DP-. DP- (DP master) DP-
(DP slaves) DP-. S7- DP-.
, DP- / (I/O-) CPU ( ). DP-
, , DP-; CPU
DP-, , DP- . DP-
DP- DP-,
CPU.
DP-, :
,
. DP S7 (DP S7 slaves).
DP V0 (DP V0 standard slaves) EN 50170, 2, PROFIBUS. , .
/ (distributed I/O)
. DP DP-.
.
( )
/; , DP-, 4 , S7-,
DP- ,
.
20.4.1 /
DP- : , ( 20.6).

(node) PROFIBUS , ( ) , .
PROFIBUS .

23

20

P-

CPU


3
PROFIBUS DP

32

DP-
32

48
56

DP-
1022

DP-
48
56

2
1022


(32)

DP- 1

( DP 1,
4, 5)

20.6 DP-
,
1 (, DP- ). STEP 7
.

DP-
. ID () DP- (
) PROFIBUS ( ).
DP- ,
( S7-300 4).
,

( )
DP- DP-.
. DP- 1, 2 4 ,
MOVE. ,
. .

24

20.4 /

3 4 ( ), SFC 14 DPRD_DAT SFC 15


DPWR_DAT. SFC ,
, RECORD, RECORD.
20.7 . DP-
DP- ; 32 4
(DP- 1) 48
8 (DP- 2).
DP- 1
DP- P- CPU , ,
CPU Load Transfer ( ) ( MOVE), , .
DP- 2
DP-, (48 ) P-.
() ,
Hardware Configuration . SFC 14 15 DP- 2
, CPU, , .

CPU
n
n+1
n+2
n+3
x
x+1
x+2
x+3
x+4
x+5
x+6
x+7

CPU


SFC 14
SFC 15

32
33
34
35
48
49
50
51
52
53
54
55

DP
P-

32
33
34
35
48
49
50
51
52
53
54
55


DP-
PROFIBUS DP


DP-

32
33
34
35

DP- 1:

- 4

48
49
50
51
52
53
54
55

DP- 2:

- 8

20.7 /

25

20

Load Transfer (
) MOVE,
;
48 55 . , SFC
14/15 , , .
DP-
DP- / (I/O-) CPU (
CPU).
( ) CPU
/ DP-. ,
DP- (transfer memory), .
CPU DP- DP- .
DP-.
: CPU , DP-,
CPU DP- DP-. : 342-5DP DP- ,
DP-.
DP- (,
CPU)
() S7-. CPU , DP-.
,
.
.
Load/Transfer/MOVE
( , )
SFC 14/15 CPU, CPU.
CPU SFC 7 DP_PRAL,
CPU .
20.8 .
CPU 1, , Transfer/MOVE ( , ). CPU 1 ,

26

20.4 /

Load/MOVE , . 2 8
CPU SFC 15 CPU SFC 14.

DP-

n
n+1
n+2
n+3
x
x+1
x+2
x+3
x+4
x+5
x+6
x+7

Transfer
DP
CPU

SFC 14


CPU

Q 96
Q 97
Q 98
Q 99
I 16
I 17
I 18
I 19
I 20
I 21
I 22
I 23


CPU

I 32
I 33
I 34
I 35
Q 48
Q 49
Q 50
Q 51
Q 52
Q 53
Q 54
Q 55

Load

CPU

SFC 15


CPU

n
n+1
n+2
n+3

1:

- 4

x
x+1
x+2
x+3
x+4
x+5
x+6
x+7

2:

- 8


CPU

20.8 DP-

DP- DP- .
.
DP V0 SFC 13
DPNRM_DG , DP S7 SFC 59 RD_REC DS 1, . SFC 13 DPNRM_DG
( 20.9). DS 1,
SFC 59 RD_REC, 4 , , , 82 (
DS 0).
, ,
,
, , , DP- .

27

20


DP V0


DP S7

02

1, 2 3

45

ID

6n

03

DS 0 (
OB 82)

4n

20.9

DS 1
. STEP 7
, / CPU. Hardware Configuration
.
20.4.2 /

/, ,
, .
DP- ( PROFIBUS) DP-. :
1)

SIMATIC-, .

2)

SIMATIC- PROFIBUS , , .

3)

SIMATIC-, (-) , DP-, , S7400.


DP-,
, S7-300.
Hardware Configuration -.

4)

28

Hardware Configuration DP- .


, , CPU DP-.

20.4 /

PROFIBUS DP-,
DP-. . .
5)

S7- DP-,
Hardware Configuration (plug-in) DP, , CPU S7-300 DP- 200 147/CPU. DP-
DP-, PROFIBUS DP- DP- ( ).
. .
, DP-.

6)

DP- PROFIBUS ( DP-)


(Hardware Catalog) DP-.
, ,
.

7)

DP-, ( PROFIBUS DP Already configured stations, )


DP-.
DP-
(Connect, ),
DP- ( CPU). DP-.

8)

. DP- . DP-.

DP Network Configuration. Network Configuration, , . View DP Slaves ( DP-), . DP- (, ,


PROFIBUS) Network Configuration.
, Hardware Configuration. DP- ,
DP-.

29

20

DP-
, SIMATIC-
S7-. S7- (. 2.3
).
DP-. , , CPU DP. DP- DP ( - ).
DP- PROFIBUS,
DP-, ,
DP-.
PROFIBUS.
DP- (
), , DP- Insert DP Master System ( DP). PROFIBUS
Properties () General () , Edit Object Properties ( ).
CP 342-5DP DP-
CP 342-5DP DP-, , Edit Object Properties (
). Mode () DP Master (DP).
Addresses () , CPU. CPU CP 342-5DP 16 .
DP- DP S7,
DP-, CP 342-5DP DP-.
DP- (Hardware
Catalog) PROFIBUS-DP CP 342-5DP as DP master (CP 342-5DP DP). DP.
(DP-) 240 . FC 1 DP_SEND FC 2 DP_RECV
( Standard Library Communication Blocks).
.

30

20.4 /

DP-
FC 3 DP_DIAG (, , ). FC 4 DP_CTRL CP 342-5DP (
, SYNC/FREEZE CLEAR
CP 342-5DP).
View Address Overview ( )
CPU CP 342-5DP , / . .
DP-
DP- (Hardware Catalog)
PROFIBUS-DP , , 200.
DP- DP.
;
. DP- ,
.
,
. /.
, .
DP ( ).
DP-
DP- (Hardware Catalog)
PROFIBUS-DP , , 200.
( )
DP-. ; . DP , .
, (Hardware Catalog) (!).
.

31

20

, DP-
DP- . , CPU 315-2DP, DP-, 122 122
( 8- 200
: 8 16 = 128 ), 200, DP-, 104 104 .
CPU
DP- DP-
CPU DP-, DP-.
DP- DP-
.
; S7- , SIMATIC-, Hardware (). Hardware Configuration .
DP- CPU; .
CPU, PROFIBUS.
DP-, .
PROFIBUS , ,
New (). ,
.
, DP-
Edit Object Properties ( ), . Mode () DP Slave (DP). Configuration () DP-
( 20.10); 20.4.1 /
DP-.
CPU. CPU 315-2DP,
, 32
, . 32 . 122 122 .
, , CPU.
DP-.
.
CPU DP- , .

32

20.4 /

20.10
DP
33

20

DP-
Station Save and Compile ( ). DP- DP- .
147/CPU DP-
DP- 200,
SIMATIC- SIMATIC 300 Hardware.
Hardware Configuration (Hardware
Catalog) MB147/CPU, PROFIBUS-DP 200,
.
DP- PROFIBUS (
DP-). ,
SIMATIC 300. CPU 147 200. CPU MPI-, MPI- ( 147/CPU
MPI- ).
CPU ;
DP- . DP. 147 128;
32 32 .
. 127; DP- .
200 ,
S7-300 .
, (Hardware Catalog) 147/CPU.
DP-
Station Save and Compile ( ). DP- DP- .
IM 151/CPU DP-
200S DP-, SIMATIC- SIMATIC 300
Hardware.
IM151/CPU, (Hardware Catalog) PROFIBUS-DP2 ET200S,
, . DP, PROFIBUS (
DP-). ,

34

20.4 /

SIMATIC 300. CPU


IM 151 200S. CPU
MPI- (IM 151/CPU MPI-
).
CPU CPU;
DP- .

DP-. IM 151/CPU 64 .
.
DP- .
200S ,
S7-300 .
, (Hardware Catalog) IM151/CPU.
DP- Station
Save and Compile ( ). DP- DP- .
S7 c CP 342-5
DP-
SIMATIC- S7-300, Hardware S7-300.
,
CP 342-5DP.
DP-; ,
DP-, DP-, .
, CP 342-5DP Edit
Object Properties ( ) CP 3425DP. Mode () DP Slave (DP-).
Addresses ()
CPU ( 16 ). CP 342-5DP, DP-,
86 , -.
Station Save and Compile ( ) DP-.

35

20

DP- DP-
, DP DP- ( , , DP). DP- DP-
PROFIBUS.
(-); DP- ( - ) , , Insert DP Master System ( DP-). (Hardware Catalog) PROFIBUS-DP Configured Stations
( ) , : CPU31x-2DP S7-300 DP, X-BM147 / CPU 200 BM147/CPU, ET200S/
CPU DP- ET200S S7-300 CP342-5 DP
S7-300 CP342-5 DP. DP.
CPU, ET200X ET200S DP-
DP- DP-
. , PROFIBUS,
Connection ().
Connect (). .
General () DP .
Configuration () DP-. . 20.4.1
/ DP-
.
CP 342-5DP DP-
DP- DP-
.
PROFIBUS Connection ().
Connect ().
.
DP-,
. : (Hardware Catalog) ( CP) Universal
submodule ( ), -

36

20.4 /

Universal submodule
( ).
() ;
32.
, ,
Edit Object Properties
( ) :
, .
.
CPU.
64 ; 86 .
CP 342-5DP DP-, , CP 342-5DP .
, , 0. CPU FC 1 DP_SEND FC 2
DP_RECV ( Standard Library
Communication Blocks).
.
General () DP .
FC 3 DP_DIAG ( ). 20.4.1 / DP
.
GSE
- DP-,
. , . (GSE-, ). Hardware Configuration
Options Install New GSE ( GSE) GSE- .
, STEP 7 DP-. STEP 7 GSE- (Hardware Catalog) Additional Filed Devices ( ).
GSE, S7-,
Options Import Station GSE (
GSE).

37

20

STEP 7 GSE- \Step7\S7data\gsd. GSE-, , \gsd\bkpx. Options Install New GSE ( GSE).
PROFIBUS PA
- PROFIBUS PA
PA SIMATIC
PDM. Hardware Configuration DP- DP/PA-Link ( DP/PA): (Hardware Catalog) DP-
IM 157. DP- PA PROFIBUS (45,45 /);
- .
DP/PA-
; .
PA DP-. DP STEP 7 Hardware Configuration GSE-. PA (Hardware Catalog)
PROFIBUS-DP Other Field Devices ( ).
DP/AS-i-Link
DP/AS-Interface-Link ( DP/AS-) DP-. ,
DP-, DP/AS-i-Link 20, (Hardware Catalog) PROFIBUS-DP DP/AS-i. (setpoint) ( 16
20 ), .
DP/AS-i-Link 20 16 /
4 .
Hardware Configuration 16
4 ,
, 512.
DP- Edit Object Properties (
) DP-, ,
, Hardware Configuration, , CPU.
DP- Edit Object Properties (
) DP-,
. Parameterize () AS-i- 4 .

38

20.4 /

AS-i- AS-i- Hardware Configuration .


SYNC/FREEZE
SYNC DP- () .
FREEZE
() DP-, , DP . UNSYNC UNFREEZE SYNC FREEZE .
, DP- DP- . ,
; DP-, Edit Object
Properties ( ), SYNC/FREEZE Capabilities ( SYNC/FREEZE) General ().
DP- 8 SYNC/FREEZE,
SYNC FREEZE,
. DP-;
CP 342-5DP DP- () .
SFC 11 DPSYC_FR, (. 20.4.3 /). DP- DP- .
SYNC/FREEZE
DP- ( DP- DP-).
DP- ( - )
Edit Object Properties ( ). Group Properties ( ) , DP- Group Assignment ( )
( 20.11).
, DP-
, , . DP , , FREEZE, , , , ,
FREEZE.
SYNC/FREEZE.
,
() 7 8 .

39

20

20.11 SYNC FREEZE

40

20.4 /


DP- DP- , . S7, ,
PROFIBUS,
. , , ,
DP-. DP- 1 PROFIBUS.
DP User-Defined ( ).
PROFIBUS, ,
PROFIBUS Edit Object Properties ( )
. Network Settings ( ) Options (). Constant Bus Cycle
Time ( ) (
) Activate constant bus cycle time / Recalculate constant bus cycle time
( / ). ,
, . Details ()
. ,
PROFIBUS DP- DP-.

SYNC/FREEZE, :
DP- 7 DP-
SYNC/FREEZE ;
;
8
DP-; , 8 .

( )
DP- DP. , ,
( , ) PROFIBUS, , DP- () .
. DP-
.

41

20


Hardware Configuration (Properties) DP- (),
PROFIBUS .
DP-, Edit Object Properties
( ). Communication () DP- DP-. DX (direct data exchange ) Mode
(). , ,
PROFIBUS DP Partner ( PROFIBUS DP) Address ().
DP PROFIBUS. , 1 , , 2.
20.4.3 /
SFC / (I/O):
SFC 7 DP_PRAL

SFC 11 DPSYN_FR
SYNC/FREEZE
SFC 12 D_ACT_DP
/ DP-
SFC 13 DPNRM_DG
DP-
SFC 14 DPRD_DAT
DP-
SFC 15 DPWR_DAT
DP-
20.7 SFC.
SFC 7 DP_PRAL

SFC 7 DP_PRAL DP, , .

42

20.4 /

20.7
SFC, /

REQ

INPUT


BOOL

IOID

INPUT

BYTE

LADDR

INPUT

WORD

AL_INFO

INPUT

DWORD

RET_VAL

OUTPUT

INT

REQ = 1
B#16#54 = ID
B#16#55 = ID

ID (
)

BUSY

OUTPUT

BOOL

BUSY = 1, DP-

REQ

INPUT

BOOL

REQ = 1

LADDR

INPUT

WORD

DP-

GROUP

INPUT

BYTE

DP- ( Hardware Configuration)

MODE

INPUT

BYTE

(. )

RET_VAL

OUTPUT

INT

BUSY

OUTPUT

BOOL

BUSY = 1,

REQ

INPUT

BOOL

MODE

INPUT

BYTE

LADDR

INPUT

WORD

RET_VAL

OUTPUT

INT

/ REQ = 1

0 , DP-
1 DP-
2 DP-
3 /
DP

BUSY

OUTPUT

BOOL

BUSY = 1,

REQ

INPUT

BOOL

REQ = 1

LADDR

INPUT

WORD

DP-

RET_VAL

OUTPUT

INT

RECORD

OUTPUT

ANY

BUSY

OUTPUT

BOOL

BUSY = 1,

LADDR

INPUT

WORD

( I-)

RET_VAL

OUTPUT

INT

RECORD

OUTPUT

ANY

LADDR

INPUT

WORD

RECORD

INPUT

ANY

RET_VAL

OUTPUT

INT

( Q-)
- ,

SFC
7

11

12

13

14

15

43

20

AL_INFO ID , , () , DP- ( OBxx_POINT_ADDR).


REQ = 1; RET_VAL BUSY
. , DP.
DP- DP-
,
CPU.
.
( ).
SFC 7 IOID LADDR CPU (ID / ). , CPU.
SFC 11 DPSYN_FR
SYNC/FREEZE
SFC 11 DPSYN_FR, SYNC, UNSYNC,
FREEZE UNFREEZE SYNC/FREEZE, Hardware Configuration. (SEND) REQ = 1 , BUSY = 0.
GROUP 1 ( 0 1 7
8). MODE :
UNFREEZE, 2 = 1;
FREEZE, 3 = 1;
UNSYNC, 4 = 1;
SYNC, 5 = 1.
, SYNC FREEZE DP- .
DP- DP-, DP- ; DP-
.
DP- , FREEZE.
, , DP-.
FREEZE, DP-
, DP-
UNFREEZE.

44

20.4 /

DP-
, SYNC
. DP- .
DP-. SYNC;
DP-
. DP-, ,
SYNC DP- UNSYNC.
SFC 12 D_ACT_DP
/ DP-
SFC 12 D_ACT_DP ( ) DP-, DP- . .
; , , . 85 ( ,
) 86 ( ) .
DP- ,
/.
SFC 12 D_ACT_DP DP. DP- ,
. 85 86 . BUSY 0
, DP- .
SFC 13 DPNRM_DG

SFC 13 DPNRM_DG DP-.
REQ = 1 ,
BUSY. RET_VAL
. 6 240 . 240 ,
240 ,
.
RECORD , . ARRAY

45

20

STRUCT, ANY BYTE


(, P#DBzDBXy.zBYTEnnn).
SFC 14 DPRD_DAT

SFC 14 DPRD_DAT 3
4 DP-.
DP-.
LADDR DP- ( ).
RECORD , . ARRAY
STRUCT, ANY BYTE
(, P#DBzDBXy.zBYTEnnn).
SFC 15 DPWR_DAT

SFC 15 DPWR_DAT 3
4 DP-.
DP-.
LADDR DP- ( ).
RECORD , . ARRAY
STRUCT, ANY BYTE
(, P#DBzDBXy.zBYTEnnn).

46

20.5

20.5
20.5.1
(global data communication, GD-)
,
CPU ,
, MPI-. , ,
( ),
,
,
, .
, CPU MPI-
K- ( C-) S7-400. ,
GD-, CPU STEP 7.
GD- : S7-400, GD-.
, CPU ( )
. , ,
, , . ,
CPU, GD- (GD circles) CPU.

. ( ), CPU .
, ( , ).
CPU, GD-, (GD-, GD packets).
GD-
(CPU), GD-, GD-.

47

20

CPU

CPU

MPI

SFC

SFC

CPU

SFC

CPU
SFC

MPI

20.12
GD- :
CPU, GD- CPU, .
CPU, CPU
GD- .

48

20.5

CPU,
CPU GD- CPU ( CPU S7400).
GD- 15 CPU.
CPU GD-.
20.8 CPU.
20.8 CPU
GD-

GD- CPU
GD-
CPU
GD-

GD-
CPU
GD-

GD

CPU 312
CPU 313
CPU 314
4

CPU 315
CPU 316

CPU 318

CPU 416
CPU 417

CPU 412
CPU 413
CPU 414
8

16

16

32

16

32

32

64

64

64

32

16

32

16

GD-
GD- (GD-):
(8 ),
ID GD- (2 ),
GD- ( ),
ID GD- (2 ),
GD- ( ),
.
GD- . ( ) 3 , 4 , 6 .

49

20
15 CPU
CPU (1)

CPU (2)

CPU (3)

CPU (4)

CPU (5)

MPI

GD- 1

1
1

GD- 2
2
1
2

GD- 3

3
GD- 4

20.13 GD-
1 ; ,
, .
4 GD-.
GD- . , 0:15
0 15, DB20.DBW14:8
, DB 20, DBW 14
8 .
GD- 32 S7-300 64 S7400.
GD-, 22 S7-300 54
S7-400.

GD-. GD- , CPU, , 20.8.
GD- , ,
, .

50

20.5

20.5.2 GD-

, MPI S7-. ,
, CPU. MPI- MPI-, CPU,
, Properties () MPI-
General () CPU ( :
CPU Hardware Configuration MPI-).

GD- .
MPI SIMATIC- Hardware
Configuration, Options Define Global Data (
) .
Edit CPU ( CPU). , , ,
CPU. CPU .
CPU, GD-. (GD-) 15 .
CPU,
CPU , ( ) ( RETURN).
Edit Sender ( ) ,
> . CPU , ( Receiver, ).
; .
, ( 20.9). GD Table Compile (GD ).
( 1) GD-
. GD- (GD-status) (
GD-) , GD- .

51

20

20.9 GD-
GD
GST

417 \
CPU417 (3)

414 \
CPU414 (4)

416 \
CPU416 (5)

MD100

MD100

MD100

315
\
CPU315 (7)
DB10.DBD200

MD92

DB10.DBD204

DB10.DBD204

44

MW90

DB10.DBW208

DB10.DBW208

44

>MW98

DB10.DBW220

DB10.DBW220

GDS 1.1

DB9.DBD0

SR 1.1

44

GD 1.1.1

>DB9.DBW10

GDS 2.1

MD96

MD96

SR 2.1

44

23

GD 2.1.1

>10:10

DB3.DBW20:10

GDS 3.1
SR 3.1

314
\ CPU314 (10)
DB10.DBD200

MD96
0

GD 3.1.1

GD ID
STEP 7
GD ID (GD-). GD ID ,
GD-, GD- GD-.
, GD ID GD 2.1.3 GD- 2, GD- 1, GD-
3. ( GD-) CPU
CPU .
GD-

View GD Status ( GD). (GST)
. (GDS)
( GD-).
.

GD- CPU MPI. ,
(scan rate). ,
( GD-) .
, .
52

20.5

( )
View Scan Rates ( ),
(SR) GD- CPU. , CPU ( ) GD-
10 . ,
.
1 255. , CPU . , , CPU
,
S7-300 60 , S7-400 10 . CPU
, CPU,
- GD-.
0 ,
SFC.
GD- GD- . STEP 7
System data ( ). GD- ,
GD- CPU PLC Download to Module (PLC ).
GD- (),
System data ( ),
, .
20.5.3 GD-
S7-400 GD- . GD-,
SFC:
SFC 60 GD_SND
GD-
SFC 61 GD_RCV
GD-
SFC 20.10.
. STEP 7 GD Identifier (GD-) GD- GD-,
.
53

20

20.10 SFC GD-

SFC

,
GD-
GD-,

CIRCLE_ID

60

61

INPUT

BYTE

BLOCK_ID

61

INPUT

BYTE

RET_VAL

60

61

OUTPUT

INT

SFC 60 GD_SND GD- CPU ; SFC 61 GD_RCV GD- . , GD- GD-, ,


.
GD- SFC 60 61, SFC 60 SFC 61

.
SFC ; . , SFC 60 GD_SND GD-, .

54

20.6 SFC-

20.6 SFC-
20.6.1 SFC-

SFC-
SIMATIC-. , , SFC CPU.
, SFC . (connection table) ( , Communication via non-configured connections, ).
SFC- , ,
PROFIBUS-DP CPU
CPU, ( 20.14).

SFC

CPU

SFC

PROFIBUS

20.14 SFC-
,
/ (I/O-):
LADDR , IOID , .

55

20


(). -
, , Temporary lack of resources ( ).
.
.
. SFC
. , SFC , CPU STOP;
.
,
SFC 76 . CPU
, . S7-300 8
, CPU 412/413 16 , CPU 414/416 32 .
CPU ,
CPU.

SFC-
SFC- , ,
. PROFIBUS
SIMATIC-, Project ()
Insert Subnetwork PROFIBUS ( PROFIBUS), Network Configuration (. 2.4 ).
: / CPU
315-2DP ( CPU). CPU
315-2DP . SFC- .
20.6.2
CPU
:
SFC 72 I_GET

56

20.6 SFC-

SFC 73 I_PUT

SFC 74 I_ABORT

SFC 20.11.
20.11 SFC

SFC

,
REQ = 1
CONT = 1:
B#16#54 =
B#16#55 =

REQ

72

73

74

INPUT

BOOL

CONT

72

73

INPUT

BOOL

IOID

72

73

74

INPUT

BYTE

LADDR

72

73

74

INPUT

WORD

VAR_ADDR

72

73

INPUT

ANY

73

INPUT

ANY

RET_VAL

72

73

74

OUTPUT

INT

BUSY

72

73

74

OUTPUT

BOOL

RD

72

OUTPUT

ANY

SD

CPU-

CPU,


, BUSY =
= 1

CPU, (
)

SFC 72 I_GET

REQ = 1 BUSY = 0 ( ).
, BUSY 1. REQ
. BUSY 0. REQ = 1
-, .
, CPU- . SFC ( ) .
RET_VAL .
CONT = 0, . CONT = 1, . ,
STOP.
RD VAR_ADDR , , , , . ,

57

20

, ANY.
.
SFC 73 I_PUT

REQ = 1 BUSY = 0 ( ).
, BUSY 1. REQ . , BUSY 0. REQ = 1
-, .
,
- .
VAR_ADDR. BUSY 0. , STOP.
RD VAR_ADDR , , , , . ,
, ANY. .
SFC 74 I_ABORT

REQ = 1 .
I_ABORT, ,
I_GET I_PUT.
, BUSY 1. REQ
. , BUSY
0. REQ 1, .
20.6.3 SFC-

SFC- SIMATIC S7. MPI. , , (SFC)


CPU. SFC . ( -

58

20.6 SFC-

, Communication via non-configured connections, ).


SFC- , ,
.
,
, MPI. MPI- ( DEST_ID).
, , , . ,
, (Temporary lack
of resources). . .
CPU RUN STOP (
SFC, X_RECV) .
, . SFC . , SFC, CPU STOP;
.
,
SFC 76 . , , . S7-300
8 , CPU 412/413 16 ,
CPU 414/416 32 .
CPU X_GET X_PUT,
CPU. SEND/RECEIVE .
SFC-
SFC- ,
,

59

20

. PROFIBUS .
: (CR2) S7-400 CPU
416 . , S7-300 CPU 314 MPI S7-400. CPU
Hardware Configuration, ,
MPI. SFC , .
20.6.4 SFC-
:
SFC 65 X_SEND

SFC 66 X_RCV

SFC 67 X_GET

SFC 68 X_PUT

SFC 69 X_ABORT

SFC 20.12.
SFC 65 X_SEND

REQ = 1 BUSY = 0 ( ).
, BUSY 1; REQ .
, BUSY 0. -
REQ = 1, .
, -CPU.
BUSY 1. , BUSY 0, .

60

20.6 SFC-

CONT = 0, , CPU
. CONT = 1,
. REQ_ID ID () , SFC
X_RCV.
SD , , . , , ANY. .
20.12 SFC

SFC

INPUT
BOOL

REQ

65

67

68

69

CONT

65

67

68

INPUT

DEST_ID

65

67

68

69

INPUT

REQ_ID

65

INPUT

REQ = 1
CONT = 1: BOOL

(MPIWORD
)
DWORD

67

68

INPUT

ANY

65

68

INPUT

ANY

66

INPUT

BOOL

RET_VAL

65

66

67

68

69

OUTPUT

INT

CPU-
CPU,
1: ( )

BUSY

65

67

68

69

OUTPUT

BOOL

, BUSY = 1

REQ_ID

66

OUTPUT

DWORD

NDA

66

OUTPUT

BOOL

RD

66

67

OUTPUT

ANY

VAR_ADDR
SD
EN_DT

1:
CPU, ( )

SFC 66 X_RCV

.
.
EN_DT = 0 ,
; ( ), NDA 1, RET_VAL , REQ_ID , SFC 65 X_SEND. EN_DT = 1 SFC () ; NDA 1,
RET_VAL . EN_DT
1, , NDA 0. .

61

20

,
EN_DT = 0, ; , .

SFC

SFC

CPU

CPU

SFC

SFC

MPI

SFC

CPU

CPU

SFC

MPI

20.15 SFC-
RD , . , , ANY.

62

20.6 SFC-

.
, RD X_RCV ANY ( NIL).
SFC 67 X_GET

REQ = 1 BUSY = 0 ( ).
, BUSY 1; REQ .
, BUSY 0. REQ
1, .
, CPU- , VAR_ADDR. SFC
, RD.
RET_VAL .
CONT = 0, . CONT = 1, . , STOP.
RD VAR_ADDR , ,
,
. , ANY .
.
SFC 68 X_PUT

REQ = 1 BUSY = 0 ( ).
, BUSY 1; REQ .
, BUSY 0. REQ
1, .
, -, SD,
, CPU-. CPU- , VAR_ADDR. BUSY 0.
RD VAR_ADDR , ,
,
. , -

63

20

ANY .
.
SFC 69 X_ABORT

REQ = 1 . SFC X_ABORT ,


CPU SFC X_SEND, X_GET
X_PUT.

64

20.7 SFB-

20.7 SFB-
20.7.1
SFB-, SIMATIC S7. ; MPI, PROFIBUS Ethernet. ;
( , Communication via configured connections, ).

SFB, CPU S7-400. (user memory).
SFB-,
SFB Standard Library ( ), System Function Blocks
( ) Blocks (),
SFB . SFB
(Program Element Catalog),
.
SFB-

.
(ID) . STEP 7
. SFB
ID, SFB
- ID.
/. , ID ID
, .

SFB- , .
CPU, Active connection buildup = Yes ( = ). SFB, , , ( ) :

65

20

REQ = FALSE
ID = ID ( WORD
W#16#xxxx)
PI_NAME = , P_PROGRAM ASCII- (,
ARRAY[1..9] OF CHAR).



SFB

DB

SFB

CPU
CP

CPU
CP

SFB

DB
SFB

MPI, PROFIBUS, Ethernet







.

SFB

DB

CPU
CP

SFB

MPI, PROFIBUS, Ethernet

20.16 SFB-
66

CPU
CP

20.7 SFB-

SFB , DONE
1. ERROR STATUS
.
( ADDR_x, RD_x SD_x).
SFB , REQ EN_R.
20.7.2
(SEND)
(RECEIVE) . , .
,
.
SFB:
SFB 8 USEND
, CPU;
SFB 9 URCV
, CPU;
SFB 12 BSEND
64 ;
SFB 13 BRCV
64 .
SFB 8 SFB 9 SFB 12 SFB 13 .
SFB 20.13.
SFB 8 USEND SFB 9 URCV

SD_x RD_x ,
. SD_x RD_x. , 1. (
FB, SFB-).
SFB 9 ; .

67

20

20.13 SFB

SFB

REQ

12

INPUT

BOOL

EN_R

13

INPUT

BOOL

12

INPUT

BOOL

ID

12

13

INPUT

WORD

ID

R_ID

12

13

INPUT

DWORD

ID

DONE

12

OUTPUT

BOOL

NDR

13

OUTPUT

BOOL

ERROR

12

13

OUTPUT

BOOL

STATUS

12

13

OUTPUT

WORD

SD_1

12

IN_OUT

ANY

SD_2

IN_OUT

ANY

SD_3

IN_OUT

ANY

SD_4

IN_OUT

ANY

RD_1

13

IN_OUT

ANY

RD_2

IN_OUT

ANY

RD_3

IN_OUT

ANY

RD_4

IN_OUT

ANY

LEN

12

13

IN_OUT

WORD

REQ (request, ) ,
R (reset, ) . 1 EN_R (enable receive, )
.
ID, ID , STEP 7
, ( ). R_DI ,
ID , . ( ID).
ID R_ID . ( ) .
1 DONE NDR, ,
. , ,
ERROR. STATUS, , (ERROR = 0), (ERROR = 1). DONE, NDR, ERROR STATUS .

68

20.7 SFB-

SFB 12 BSEND SFB 13 BRCV



SD_1
RD_1 ( );
LEN.
64 ; (
),
.
REQ (request, ) ,
R (reset, ) . 1 EN_R (enable receive, )
. ID, ID ,
STEP 7 , (
).
R_DI , ID ,
.
(
ID).
ID R_ID . ( ) .
1 DONE NDR, ,
. , ,
ERROR. STATUS, , (ERROR = 0), (ERROR = 1). DONE, NDR, ERROR STATUS .
20.7.3
SFB CPU. CPU- .
SFB:
SFB 14 GET
, CPU;
SFB 15 PUT
, CPU.
20.14 SFB.

69

20

20.14 SFB

SFB

REQ

14

15

INPUT

BOOL

ID

14

15

INPUT

WORD

ID

NDR

14

OUTPUT

BOOL

DONE

15

OUTPUT

BOOL

ERROR

14

15

OUTPUT

BOOL

STATUS

14

15

OUTPUT

WORD

ADDR_1

14

15

IN_OUT

ANY

CPU-

ADDR_2

14

15

IN_OUT

ANY

CPU-

ADDR_3

14

15

IN_OUT

ANY

CPU-

ADDR_4

14

15

IN_OUT

ANY

CPU-

RD_1

14

IN_OUT

ANY

RD_2

14

IN_OUT

ANY

RD_3

14

IN_OUT

ANY

RD_4

14

IN_OUT

ANY

SD_1

15

IN_OUT

ANY

SD_2

15

IN_OUT

ANY

SD_3

15

IN_OUT

ANY

SD_4

15

IN_OUT

ANY

CPU- ,
SFB 14; CPU- ,
SFB 15. ()
CPU- .
REQ (request, ) .
ID (ID) , STEP 7
.
1 DONE NDR . , ,
1 ERROR.
STATUS, ,
(ERROR = 0), (ERROR = 1).
DONE, NDR, ERROR STATUS .
ADDR_n CPU, . ADDR_n , SD_n RD_n.
, 1. ( FB, SFB ).

70

20.7 SFB-

20.7.4
SFB 16 PRINT CP 441. 20.15
SFB.
20.15 SFB 16 PRINT

REQ

INPUT

BOOL

ID

INPUT

WORD

ID

DONE

OUTPUT

BOOL

ERROR

OUTPUT

BOOL

STATUS

OUTPUT

WORD

PRN_NR

IN_OUT

BYTE

FORMAT

IN_OUT

STRING

SD_1

IN_OUT

ANY

SD_2

IN_OUT

ANY

SD_3

IN_OUT

ANY

SD_4

IN_OUT

ANY

REQ , ID PRN_NR.
DONE 1. 1
ERROR. STATUS
(ERROR = 0), (ERROR = 1). DONE, ERROR STATUS .
FORMAT STRING.
, SD_1, , SD_4. ,
1; .
420 ( FORMAT ) .
20.7.5
SFB:
SFB 19 START
-;
SFB 20 STOP
- STOP;

71

20

SFB 21 RESUME
-.
SFB ; - .
SFB 20.16.
20.16 SFB -

SFC

REQ

19

20

21

INPUT

BOOL

ID

19

20

21

INPUT

WORD

ID

DONE

19

20

21

OUTPUT

BOOL

ERROR

19

20

21

OUTPUT

BOOL

STATUS

19

20

21

OUTPUT

WORD

PI_NAME

19

20

21

IN_OUT

ANY

(P_PROGRAM)

ARG

19

21

IN_OUT

ANY

IO_STATE

19

20

21

IN_OUT

BYTE

REQ . ID (ID) , STEP 7 .


1 DONE ,
. , , 1 ERROR. STATUS, ,
(ERROR = 0), (ERROR = 1). DONE, ERROR STATUS .
PI_NAME , P_PROGRAM (ARRAY [1..9]
OF CHAR). ARG IO_STATE ,
.
SFB 19 START CPU-. :
CPU- STOP, RUN RUN-P.
SFB 20 STOP CPU- STOP. : CPU-
STOP .
SFB 21 RESUME CPU-. : STOP CPU-,
RUN RUN-P, .

72

20.7 SFB-

20.7.6
:
SFB 22 STATUS
;
SFB 23 USTATUS
;
SFC 62 CONTROL
SFB.
20.17 SFB, SFC 62 20.18.
:
1 ERROR. STATUS , ,
(ERROR = 0), (ERROR = 1).
20.17 SFB

SFB

REQ

22

INPUT

BOOL

EN_R

23

INPUT

BOOL

ID

22

23

INPUT

WORD

ID

NDR

22

23

OUTPUT

BOOL

ERROR

22

23

OUTPUT

BOOL

STATUS

22

23

OUTPUT

WORD

PHYS

22

23

IN_OUT

ANY

LOG

22

23

IN_OUT

ANY

LOCAL

22

23

IN_OUT

ANY

CPU S7

SFB 22 STATUS
-
SFB 22 STATUS CPU-
PHYS ( ), LOG ( ) LOCAL ( , CPU S7).
REQ (request, ) .
ID (ID) , STEP 7
.

73

20

1 NDR,
. NDR, ERROR STATUS
.
SFB 23 USTATUS
-
SFB 23 USTATUS ,
. PHYS, LOG
LOCAL.
1 EN_R (enable receive, ) . ID, ID
, STEP 7 .
1 NDR . NDR, ERROR STATUS
.
20.18 SFC 62 CONTROL

EN_R

INPUT

BOOL

I_DB

INPUT

BLOCK_DB

OFFSET

INPUT

WORD

RET_VAL

OUTPUT

INT

ERROR

OUTPUT

BOOL

STATUS

OUTPUT

WORD

I_TYP

OUTPUT

BYTE

I_STATE

OUTPUT

BYTE

I_CONN

OUTPUT

BOOL

(1 = )

I_STATUS

OUTPUT

WORD

STATUS SFB

SFC 62 CONTROL
SFB
SFC 62 CONTROL SFB . SFB
I_DB. SFB , OFFSET (, , 1
, 2 ).
1 EN_R (enable receive, )
. ID, ID , STEP 7 .
74

20.7 SFB-

1 NDR . NDR, ERROR


STATUS .
I_TYP, I_STATE, I_CONN I_STATUS
SFB.

75

21
21

....................................................................................................... 4
21.1 ................................................................................................................... 4
21.2 ....................................................................................................... 7
21.2.1
.................................................................... 7
21.2.2
...................................................................... 8
21.2.3
STEP 7 ............................ 9
21.3 .................................................................................................... 10
21.3.1
......................................................................... 10
21.3.2
STEP 7 ........................ 12
21.4 ............................................................................................ 13
21.4.1
................................................................. 13
21.4.2
STEP 7................. 15
21.4.3
......................................... 15
21.5 .......................................................................................... 18
21.5.1
................................................................ 18
21.5.2
STEP 7 ............... 19
21.5.3
........................................ 19
21.6 ...................................................................................... 22
21.7 ........................................................................................................ 24

21

21


.
, . ,
. ().
. ,
,
. .
.
, ,
, .
. , .

21.1
SIMATIC S7 ():
(Hardware interrupt)
, , ;
(Watchdog interrupt)
, ;
(Time-of-day interrupt)
,
, ;
(Time-delay interrupt)
, ;
(SFC) ,
;
(Multiprocessor interrupt)
, CPU .
,
, ,
. 23 .
4

21.1

. (main program)
( 1), ( 26), .
. S7-300
, S7-400 CPU.
3.1.2 .


SFC 39
DIS_IRT SFC 40 EN_IRT
SFC 41 DIS_AIRT SFC 42 EN_AIRT (. 21.7 ).

,
/ (
,
)
/ ( ).
/
MOVE.

/ .
, CPU S7-400 . . SFC 26 UPDAT_PI SFC 27 UPDAT_PO
(.
20.2.1 ).
CPU S7-400
( -

21

) .
,
21.1 . S7-300
256 . S7-400 ( ) CPU ( local data,
), , CPU. , , , 20,
.
.
21.1

60

40 47

30 38


20 23


(WORD)

(DWORD)

()
(DT)


(WORD)
-

(INT)

(WORD)
-

8..9

(INT)
-

10..11

12..19


()
(DT)

6..7


(INT)


(TIME)


()
(DT)


()
(DT)



10 17


()
(DT)

21.2

21.2
(hardware interrupts) , . STEP 7 OB 40 OB 47
. ,
CPU.

. SFC 55 WR_PARM, SFC 56
WR_DPARM SFC 57 PRAM_MOD ()
CPU RUN.
21.2.1
.
, ,
, - ,
.
. ( ),
, , (
) . ,
SFC.
DP- CPU SFC 7 DP_PRAL.
() , , , .
S7-300
, ,
, , .
, ,
, .
, .

21

,
.
S7-400
, , ,
. ,
, , .
21.2.2

, , 6 7 OB .
, 5 B#16#54;
B#16#55.
, 8 11 ; .

.
CPU RUN. .

,
, 85
( ).
. 85 , CPU
STOP.
CPU ,
. CPU
STOP.

21.2

, ,
SFC 39 DIS_IRT SFC 40 EN_IRT,
SFC 41 DIS_AIRT SFC 42 EN_AIRT.
21.2.3
STEP 7
. CPU Edit Object
Properties ( ) Interrupts ().
S7-300 ( CPU 318) 40 16
. S7-400 CPU 318
2 24 ( CPU); 0 . , , 12
.
. , CPU.
STEP 7 System Data ( ) Blocks (). CPU, STOP.
CPU ; ,
, .

21

21.3
(watchdog interrupt) , ,
.
.
STEP 7
30 38; CPU.

CPU.
21.3.1
S7-300
S7-300
35, 12. CPU
1 1 1
.
S7-400
CPU.
: , . . 1 1 1 ; 2 24 CPU ( ,
).
STEP 7 , 21.2,
.


, .
.

START-UP () RUN .

10

21.3

,
.
21.2

30

31

32

33

500

10

34

200

11

35

100

12

36

50

13

37

20

14

38

10

15

21.1 , . 1 , 2 1. - 2 2 1
. , ,
.

RUN

21.1

. CPU RUN.

11

21


, 80
( ). , CPU
STOP.
, , .
,
, .
, CPU,
, . CPU STOP.
, ,

SFC 39 DIS_IRT SFC 40 EN_IRT,
SFC 41 DIS_AIRT SFC 42 EN_AIRT.
21.3.2
STEP 7

. CPU
Edit Object Properties ( )
Cyclic Interrupt ( ).
S7-300 ( CPU 318)
12. S7-400 CPU 318 2 24 ( CPU) ; 0
, .
, ,
12 .
Execution (),
Phase Offset ( ).
STEP 7 System Data ( ) Blocks (). CPU, STOP.
CPU .

12

21.4

21.4
(time-of-day interrupts) ,
, , , , . STEP 7 10 17 ;
CPU.

,
. CPU.
21.4.1

, , .
SFC. ,
CPU.
:
:

:
, , , ,
.
(). (cancel)
SFC 29 CAN_TINT.
,
, .
, SFC 31 QRY_TINT.

13

21



, SFC. , , .
CPU .

SFC 31 .
RUN CPU.

, ,
85 ( ).
85 , CPU STOP.
CPU , . CPU STOP.
, ( ), 80 ( ). 80 , CPU
STOP.
, ( ),
,
.
, , 80 ( ). .
, , .
, () , 80 (
). 80 , .

14

21.4

, ,
SFC 39 DIS_IRT SFC 40 EN_IRT, SFC 41 DIS_AIRT SFC 42 EN_AIRT.
21.4.2
STEP 7

. CPU
Edit Object Properties ( )
Time-of-day ( ).
S7-300 ( CPU 318)
2. S7-400 CPU 318 2 24 ( CPU) ;
0 . ,
, 12 .
Active () . Execution () ,
, , .
( ).
STEP 7 System Data ( ) Blocks (). CPU, STOP.
.
21.4.3

:
SFC 28 SET_TINT
;
SFC 29 CAN_TINT
;
SFC 30 ACT_TINT
;
SFC 31 QRY_TINT
.

15

21

21.3.
21.3 SFC
SFC

28

OB_NR

INPUT

INT

SDT
PERIOD

INPUT
INPUT

DT
WORD

RET_VAL

OUTPUT

INT

,
DATE_AND_TIME
, :
W#16#0000 =
W#16#0201 =
W#16#0401 =
W#16#1001 =
W#16#1201 =
W#16#1401 =
W#16#2001 = (412)
W#16#1801 =

OB_NR

INPUT

INT

RET_VAL

OUTPUT

INT

OB_NR

INPUT

INT

RET_VAL

OUTPUT

INT

OB_NR

INPUT

INT

RET_VAL

OUTPUT

INT

STATUS

OUTPUT

WORD

29
30
31

SFC 28 SET_TINT

, SFC 28 SET_TINT. SFC 28 ;
,
SFC 30 ACT_TINT. SDT DATE_AND_TIME, , DT#1997-06-03-08:30. . ,
.
,
.

16

21.4

SFC 30 ACT_TINT

SFC
30 ACT_TINT. , ,
. , , , SFC 30 .

.
. , ( ).
SFC 29 CAN_TINT

SFC 29 CAN_TINT , .
.
, ,
.
SFC 31 QRY_TINT

SFC 31 QRY_TINT.
STATUS.
1, :
0

()

( - ).

17

21

21.5
(time-delay interrupt) . STEP 7
20 23 . CPU.
; .
21.5.1

SFC 32 SRT_DINT;
. , .
,
.
SFC 34
QRY_DINT.


.
RUN CPU, .
SFC 32.
, CPU RUN,
.
CPU ,
.

,
85 ( ). 85 , CPU STOP.

18

21.5

, , 80 ( ) STOP,
80.
, CPU,
, . CPU
STOP.
, ,
SFC 39 DIS_IRT SFC 40 EN_IRT,
SFC 41 DIS_AIRT SFC 42
EN_AIRT.
21.5.2
STEP 7
. CPU Edit
Object Properties ( )
Interrupts ().
S7-300 ( CPU 318)
3. S7-400 CPU 318 2
24 ( CPU) ; 0
. ,
, 12 .
STEP 7 System Data ( ) Blocks (). CPU, STOP.
.
21.5.3
:
SFC 32 SRT_DINT
;
SFC 33 CAN_DINT
;

19

21

SFC 34 QRY_DINT
.
21.4.
21.4 SFC
SFC
32 OB_NR

33
34


INPUT
INT

DTIME
SIGN

INPUT
INPUT

TIME
WORD

RET_VAL

OUTPUT

INT

,
, ,
; : T#1 ,, T#1

, ( )

OB_NR

INPUT

INT

RET_VAL

OUTPUT

INT

OB_NR

INPUT

INT

RET_VAL

OUTPUT

INT

STATUS

OUTPUT

WORD

SFC 32 SRT_DINT

SFC
32 SRT_DINT. SFC
. CPU
. SIGN SFC 32; 6 7
.
1 . 1 . ,
, . SFC 32. SFC.
SFC 33 CAN_DINT

,
SFC 33 CAN_DINT. .

20

21.5

SFC 34 QRY_DINT

SFC 34 QRY_DINT
.
, STATUS.
1, :
0

()

( - ).

21

21

21.6
(multiprocessor interrupt)
CPU . SFC 35 MP_ALM.
60, 25.

SFC 35 MP_ALM . CPU , 60 . 60
CPU, CPU, SFC 35,
, 60, CPU .

; CPU
. , , Local
Data ( ) CPU 25 ( , 20).

RUN. SFC 35
32929 (W#16#80A1).

60 , SFC 35, 32928
(W#16#80A0). 60 CPU.
OB 60 CPU , SFC 35
.
, ,

SFC 39 DIS_IRT SFC 40 EN_IRT, SFC 41 DIS_AIRT SFC 42 EN_AIRT.

22

21.6

SFC 35 MP_ALM

SFC
35 MP_ALM. 21.5.
JOB . 6 7 60 CPU.
21.4 SFC 35 MP_ALM

JOB

INPUT


BYTE

RET_VAL

OUTPUT

INT

,

B#16#00 B#16#0F

23

21

21.7

:
SFC 39 DIS_IRT
;
SFC 40 EN_IRT
;
SFC 41 DIS_AIRT
;
SFC 40 EN_AIRT
.
21.6 .
. SFC 36 SFC 38 .
21.6 SFC
SFC

39

MODE

INPUT

BYTE

(. )

OB_NR

INPUT

INT

(. )

RET_VAL

OUTPUT

INT

MODE

INPUT

BYTE

(. )

OB_NR

INPUT

INT

(. )

RET_VAL

OUTPUT

INT

41

RET_VAL

OUTPUT

INT

()

42

RET_VAL

OUTPUT

INT

40

SFC 39 DIS_IRT

SFC 39 DIS_IRT
. .
,
; , CPU
STOP.

24

21.7

SFC 40 EN_IRT. .
MODE OB_NR , . MODE = B#16#00
. MODE = B#16#01 , OB_NR.
, MODE = B#16#01 OB_NR = 40 ;
= 80 . MODE = B#16#02 , OB_NR.

.
SFC 40 EN_IRT

SFC 40 EN_IRT ,
SFC 39 DIS_IRT. ,
, ; , CPU STOP ( 81, ).
MODE OB_NR ,
. MODE = B#16#00 . MODE = B#16#01 ,
OB_NR. MODE = B#16#02
, OB_NR.
SFC 41 DIS_AIRT

SFC 41 DIS_AIRT . ,
,
, .
SFC 41, ( ) ; .
SFC
42 EN_AIRT.
SFC 41 . RET_VAL
. SFC 42 ,

25

21

SFC 41,
.
SFC 42 EN_AIRT

SFC 42 EN_AIRT
, SFC 41 .
SFC 42 , SFC 41 (
). RET_VAL ;
RET_VAL = 0, . SFC 42 SFC 41, RET_VAL
32896 (W#16#8080).

26

22
22

.......................................................................................................... 4
22.1 ................................................................................................................... 4
22.1.1
............................................................................................................. 4
22.1.2
HOLD .................................................................................................................. 5
22.1.3
....................................................................................... 6
22.1.4
................................................................................ 6
22.2 .................................................................................................. 8
22.2.1
STOP.................................................................................................................... 8
22.2.2
.................................................................................................................. 8
22.2.3
................................................................................................................ 9
22.2.4
............................................................................................ 10
22.3 ....................................................................................................................... 11
22.3.1
STURT-UP () ......................................................................................... 11
22.3.2
.................................................................................................... 11
22.3.3
............................................................................................................ 13
22.3.4
......................................................................................................... 14
22.4 ................................................................................................ 16
22.5 .................................................................................................... 19

22

22

22.1
22.1.1
, CPU , , ( ). START-UP
() CPU STOP
RUN. CPU
START-UP , .
22.1. c CPU
STOP. CPU
RUN RUN-P, CPU START-UP d, RUN
e. CPU START-UP RUN , STOP, CPU
STOP f g.

(breakpoints) , CPU
HOLD (). RUN,
START-UP, ,
h i. HOLD CPU STOP j.

2
STARTUP

7
STOP

RUN
8

HOLD

22.1 CPU
CPU Restart ()
,
Ready () , CPU

22.1

, , CPU.
SIMATIC S7 ,
(cold restart), (complete restart) (warm restart).
.
.
CPU S7, 1998 .,
. .
START-UP.
STEP 7 102 ( ),
100 ( ) 101 ( ) . : ,
CPU,
.
22.1.2 HOLD
CPU HOLD,
( ). STOP , RUN
.
HOLD . , out . HOLD.
HOLD , , . , , , , ,
. :
.
,
,
, , .
HOLD CPU ,
.
CPU HOLD, CPU,
, STOP. CPU .

22

22.1.3
STOP HOLD ( OD output disable, ). ,
, .
(variable table) Isolate
PQ ( PQ) STOP.
. , . ,
( !), .
,
( MOVE
PQ), . CPU Disable (),
.
( 102) ( 100)
. 102
100, , . ( , , MOVE PI I), . ,
( 1) , . ( ), .
, STOP,
101 .
( ,
).
CPU
.
1 CPU (Disable), .
22.1.4
CPU 102;
100. 100
102 CPU .
CPU 101
. 101 , CPU .

22.1


.
22.1 100. ( 1):
B#16#81

( 100);

B#16#82

( 100);

B#16#83

( 101);

B#16#84

( 101);

B#16#85

( 102);

B#16#86

( 102).


( , , ). , .
22.1

OB100_EV_CLASS

BYTE

OB100_STRTUP

BYTE

(. )

OB100_PRIORITY

BYTE

OB100_OB_NUMBER

BYTE

OB100_RESERVED_1

BYTE

OB100_RESERVED_2

BYTE

6..7

OB100_STOP

WORD

8..11

OB100_STRT_INFO

DWORD

12..19

OB100_DATE_TIME

DT

22

22.2
22.2.1 STOP
CPU STOP :
CPU;
RUN
STOP;
;
SFC 46 STP;
(

CPU).
CPU STOP .
CPU
, .
STOP . CPU , CPU, .
STOP CPU GD-
. .
STOP CPU, , , MPI-, CPU.
22.2.2
CPU .
STOP
: MRES
3 , 3
MRES 3 .
CPU ,
RAM. ( , , )
.

22.2

CPU , , . MPI-. , CPU, , MPI.


, .
- EPROM, CPU . CPU
.
22.2.3
(
), , , CPU STOP RUN ( ).
, ,
S7-300 . CPU. Retentivity CPU.
(system data
blocks, SDB) , . RAM-,
, .
, .
. , RAM - EPROM, .
- EPROM , S7-300 S7-400 -. S7-300 , , S7-400 .
S7-300 . , S7-300
CPU, .
S7-300
S7-400 , .
, . , SFC 22
CREAT_DB, . , , , .

22

22.2.4
Restart () CPU :

,
.
( )
CPU S7-300 .
PIQ
CPU S7-400
.

.
POWER UP ( )
.

, CPU STOP. (
).

, CPU STOP.
. (
CPU
,
,
.)


STOP RUN , CPU STOP.
0 , .

10

22.3

22.3
22.3.1 STURT-UP ()
CPU :
;
STOP
RUN RUN-P;
( CPU).
, .
, ,
; .
. , RUN ( ).
CPU , . ,
. .
, ,
, . . ,
. ,
.
22.2 , CPU .
22.3.2
CPU , , ( ), 102 1.

, SFC; , , . (
RAM ).

11

22

OB 101

OB 1

OB 100

OB 102

()

RUN


2


OB 1

STOP

22.2 CPU
12

22.3


:
CPU, MRES , , 3
STOP RUN RUN-P.
PG SFB
CPU; RUN RUN-P.
, CPU .

.
,
CPU STOP, ;
RUN RUN-P;
CPU ;
Automatic cold restart on power up ( ).
, CPU
. CPU ,
. -EPROM.
22.3.3
CPU
, , 100 1 .

:
CPU STOP
RUN RUN-P ( CPU S7-400 -

13

22

CRST).
PG SFB
CPU; RUN RUN-P.
, CPU
.

. ,
CPU STOP, ;
RUN RUN-P;
CPU ;
Automatic complete restart on power up ( ).
, CPU
. CPU ,
. -EPROM.
22.3.4
S7-400.
STOP CPU ,
CPU, . ,
, . , . () .
,
CPU ,
. () .
.
, , , , CPU STOP.

14

22.3

CPU CPU ( 100


1 ). , .

RUN ( STOP ) RUN
( 101 ).


RUN RUN-P, CPU
STOP
, , WRST
( CPU );
PG SFB
CPU; RUN RUN-P.
, CPU
Restart () . STOP , ;
, CPU STOP.

. CPU
:
STOP;
CPU RUN
RUN-P;
Automatic warm restart on power up ( );
, .

.

15

22

22.4
, SFC:
SFC 5 GADR_LGC
;
SFC 50 RD_LGADR
;
SFC 49 LGC_GADR
.
22.2 SFC.
SFC IOID LADDR (= /). IOID B#16#54,
(PI), B#16#55, (PQ). LADDR
/ (I/O-) PI PQ, . 0, .
( ) ( /) ,
SFC.
SFC 5 GADR_LGC

SFC 5 GADR_LGC ,
( ). SUBNETID , /,
B#16#00, . RACK
, /, .
, SUBSLOT B#16#00. SUBADDR (W#16#0000, ,
).
SFC 49 LGC_GADR

SFC 49 LGC_GADR , . (
SUBADDR)
. AREA ,
( 22.3).

16

22.4

22.2 SFC,
SFC

SUBNETID

INPUT

BYTE

RACK

INPUT

WORD

SLOT

INPUT

WORD

SUBSLOT

INPUT

BYTE

SUBADDR

INPUT

WORD

RET_VAL

OUTPUT

INT

IOID

OUTPUT

BYTE

LADDR

OUTPUT

WORD

IOID

INPUT

BYTE

LADDR

INPUT

WORD

RET_VAL

OUTPUT

INT

PEADDR

OUTPUT

ANY

WORD PI-

PECOUNT

OUTPUT

INT

PI-

PAADDR

OUTPUT

ANY

WORD PQ-

PACOUNT

OUTPUT

INT

PQ-

IOID

INPUT

BYTE

LADDR

INPUT

WORD

RET_VAL

OUTPUT

INT

AREA

OUTPUT

BYTE

RACK

OUTPUT

WORD

SLOT

OUTPUT

WORD

SUBADDR

OUTPUT

WORD

50

49

SFC 50 RD_LGADR

S7-400 ( ).
SFC 50 RD_LGADR , .
PEADDR PAADDR WORD ( ANY , , P#DBzDBXy..x WORD nnn).
SFC 50 PECOUNT PACOUNT.

17

22

22.3 SFC 49 LGC_GADR


AREA

18

RACK, SLOT SUBADDR

S7-400

S7-300

/ (I/O)

RACK =
SLOT =
SUBADDR =

S5 P

RACK, SLOT SUBADDR

S5 Q

S5 IM3

S5 IM4

RACK =
SLOT =
SUBADDR = S5

22.5

22.5
:
SFC 54 RD_DPARM
;
SFC 55 WR_PARM
;
SFC 56 WR_DPARM
;
SFC 57 PARM_MOD
;
SFC 58 WR_REC
(, data record) ;
SFC 59 RD_REC
(, data record) .
22.4.
22.4 ,

54 55 56 57 58 59 REQ

INPUT

BOOL

54 55 56 57 58 59 IOID

INPUT

BYTE

54 55 56 57 58 59 LADDR

INPUT

WORD

1 = ()
B#16#54 = (PI)
B#16#55 = (PQ)

54 55 56

58 59 RECNUM

INPUT

BYTE

()

54 55

58

INPUT

ANY

()

54 55 56 57 58 59 RET_VAL

OUTPUT

INT

54 55 56 57 58 59 BUSY

OUTPUT

BOOL

1,

OUTPUT

ANY

()

SFC

RECORD

59 RECORD

19

22

2 127

128 255


S7- , , . , . System Data ( )
Blocks () PLC, .
CPU :
;
(S7-400);
(return) /.
.
Hardware Configuration.
SFC. ,
SFC, , ( CPU) Hardware Configuration.
:
0, 1. SFC 57 PARM_MOD,
0 1 SFC 56 WR_DPARM 1
SFC 55 WR_PARM.
CPU.
S7-400
, 2 (Operating mode, ) 2 0 RUN ( SFC 59
RD_REC).
, ( LADDR) , , ( IOID).
, . /
, , (Read) (Write).
20

22.5

RECORD ANY BYTE. ARRAY, STRUCT UDT (,


), ANY- BYTE (,
P#DBzDBXy.x BYTE nnn). ,
; .
SFC 54 RD_DPARM

SFC 54 RD_DPARM , RECNUM, SDB
, RECORD.
, ,
SFC 58 WR_REC.
SFC 55 WR_PARM

SFC 55 WR_PARM ,
RECORD, , IOID LADDR. RECNUM . ,
SDB, .
SFC ;
. BUSY 1.
SFC 56 WR_DPARM

SFC 56 WR_DPARM , RECNUM, SDB
, IOID LADDR.
;
BUSY 1.
SFC 57 PARM_MOD

SFC 57 PARM_MOD , Hardware Configuration.

21

22

;
BUSY 1.
SFC 58 WR_REC

SFC 58 WR_REC , RECORD
RECNUM, , IOID LADDR. 1 REQ . SFC .
;
BUSY 1.
SFC 59 RD_REC

REQ 1, SFC 59 RD_REC , RECNUM, RECORD. , ,
. , RET_VAL
.
;
BUSY 1.
S7-300, 1997 : SFC
, . .

22

23
23

............................................................................................................... 4
23.1 .............................................................................................................. 4
23.2 ........................................................................................... 7
23.2.1
............................................................................................................ 7
23.2.2
............................................................................. 9
23.2.3
....................................................................... 10
23.2.4
.............................................................................................. 10
23.2.5
....................................................................................... 10
23.3 .......................................................................................................... 12
23.4 ....................................................................................................... 17
23.4.1
.............................................. 17
23.4.2
.................................... 18
23.4.3
....................................................................... 19
23.4.4
............................................................................. 19

23

23


CPU , CPU,
:
(,
REAL) ( , OV
);

( ) 121 122;
,
, ( ) 80 87.
CPU , . () ( OP) CPU STOP.
CPU STOP, , CPU,
(B-), (I-)
(L-) .
/
. CPU (, STOP) .
STOP,
.
CPU CPU .

23.1
CPU , , .
, CPU STOP.
:
, 121
, 122.
4

23.1


.
23.1

OB12x_EV_CLASS

BYTE

OB12x_SW_FLT

BYTE

B#16#25 = 121
B#16#29 = 122
(. 23.2.1 )

12x_PRIORITY

BYTE

OB12x_OB_NUMBER
OB12x_BLK_TYPE

BYTE
BYTE

OB121_RESERVED_1

BYTE

(B#16#79 B#16#80)
( S7-400)
OB: B#16#88, FB: B#16#8E, FC: B#16#8C
(B#15#xy):

OB122_MEM_AREA

()

3
()
0
0 / (I/O) PI
PQ
1 I
2
Q
3

4
DB
5
DI
6
L
7
V

OB121_FLT_REG
OB122_MEM_ADDR

WORD

OB12x_BLK_NUM

WORD

121:
( /)
( )
, /
122: ,
, ( S7-400)

OB12x_PRG_ADDR

WORD

, ( S7-400)

OB12x_DATE_TIME

DT

, ,
.
, ( ) .

23

, , 20 L- , ,
, .
S7-400
. 3
CPU S7-400 4 CPU S7-300.
SFC 36 MSK_FLT SFC 37 DMSK_FLT.

23.2

23.2

:
SFC 36 MSK_FLT
( );
SFC 37 DMSK_FLT
( );
SFC 38 READ_ERR
(error register).
SFC 36, 37 38.
23.2.
23.2.1

.
;
. , , ,
. , , 1 , ,
.
23.3;
122_SW_FLT 122.
23.4; OB121_SW_FLT 121.
CPU S7-400 :
. ,
150 , / (PZF). CPU / (I/O access
error), ,
, ( /) ( ).
, , .

23

23.2 SFC
SFC

36

PRGFLT_SET_MASK

INPUT

DWORD

ACCFLT_SET_MASK

INPUT

DWORD

RET_VAL

OUTPUT

INT

PRGFLT_MASKED

OUTPUT

DWORD

ACCFLT_MASKED

OUTPUT

DWORD

37

38

PRGFLT_RESET_MASK INPUT

DWORD

ACCFLT_RESET_MASK INPUT

DWORD

RET_VAL

OUTPUT

INT

PRGFLT_MASKED

OUTPUT

DWORD

ACCFLT_MASKED

OUTPUT

DWORD

PRGFLT_QUERY

INPUT

DWORD

ACCFLT_QUERY

INPUT

DWORD

RET_VAL

OUTPUT

INT

PRGFLT_CLR

OUTPUT

DWORD

ACCFLT_CLR

OUTPUT

DWORD

,
()

()
W#16#0001 =



,
,

W#16#0001 = ( )


,
,

W#16#0001 =
( )


23.3

B#16#42

B#16#43

B#16#44

B#16#45

/
S7-300:
S7-400:
()
/
S7-300:
S7-400:
()
S7-400:
/
(PZF) ( ) ,

S7-400:
/
(PZF) ( ) ,

23.2

23.4

B#16#21

B#16#22

( )

B#16#23

( )

B#16#24

( )

B#16#25

( )

B#16#26

B#16#27

B#16#28

B#16#29

16

B#16#30


( < > 0 ,
)
( < > 0 ,
)
, (, )

17

B#16#31

, (, )

18

B#16#32

( DB)

19

B#16#33

( DI)

20

B#16#34

(FC)

21

B#16#35

(FB)

26

B#16#3

(DB)

28

B#16#3

(FC)

30

B#16#3

(FB)

BCD ( )

23.2.2
SFC 36 MSK_FLT
. 1
, ( ).
,
. SFC 36 , , () ,
(W#16#0001).
SFC 36 1
.
, , . ( ). , -

23

,
, .
23.2.3
SFC 37 DMSK_FLT
. 1,
, (
). , ,
. SFC 37 W#16#0001 , () , .
SFC 37 1
.
, , . ( ).
23.2.4
SFC 38 READ_ERR .
1 , , . SFC 38 W#16#0001 , , ,
, () .
SFC 38 1 ,
, , . , , ( ).
23.2.5
SFC 44 REPL_VAL 1
. SFC 44 ,
( , ).
SFC 44, 122 ( ) . SFC 44,
;
. SFC 44 23.5.
SFC 44 ( 121
122).

10

23.2

23.5 SFC 44 REPL_VAL


SFC

44

VAL

INPUT

DWORD

RET_VAL

OUTPUT

INT

11

23

23.3
, .
, :
80

(Timing error);

81

(Power supply error);

OB 82

(Diagnostic interrupt);

83

/ (Insert/remove module interrupt);

84

CPU (CPU hardware fault);

85

(Program execution error);

86

(Rack failure);

87

(Communication error).

82 ( ) 23.4
.
S7-400H :
70

/ (I/O redundancy errors);

71

CPU (CPU redundancy errors);

72

(Communications redundancy errors);


SFC 39 DIS_IRT SFC
40 EN_IRT, SFC 41
DIS_AIRT SFC 42 EN_AIRT.

80
:
( ) ;

12

23.3

( , );
( ,
RUN).
80 , , CPU STOP. CPU STOP, .

81,
:
,
;
;
24 .
81 . 81 ,
CPU .
/

. RUN, STOP
START-UP .
, 83,
CPU RUN. 83 , /
CPU STOP.
/
.
, , .
, CPU , ,
CPU. 83,
.

13

23

CPU
84,
( MPI, PROFIBUS DP). 84 ,
CPU STOP.

85,
:
, ;
, (,
, (SFB));
/ () .
CPU S7-400 CPU 318 85 / ( ), . .
CPU S7-300 ( CPU 318) /
85 . ; .
CPU CPU 85
/ :
85 . .
85 (incoming). ; . ,
85 (outgoing);
.
85 .

.
85 , CPU STOP.

14

23.3


( , , IM), / 86.
.
86 CPU .
86 , CPU STOP.

87. :
, ;
;
;
GD .
87 , CPU STOP, .
/
CPU H 70 PROFIBUS DP, , DP DP-.
70 , CPU / .
CPU
CPU H 72,
:
CPU;
(, RAM PIQ);

15

23

;
;
SYNC;
.
72 , CPU CPU
.

16

23.4

23.4
23.4.1
, , .
, . :
;
CPU ;
.
. , ,
() .
, , .
, ,
CPU;
CPU;
, , ( ).
,
CPU, .
CPU,
. ,
CPU. , .
. CPU System Diagnostics ( ) , ( ). ,
, CPU STOP, MPI.

17

23

23.4.2
SFC 52 WR_USMSG ,
MPI. 23.6
SFC 52.
23.6 SFC 52 WR_USMSG
SFC

52

SEND

INPUT

BOOL

1,

EVENTN

INPUT

WORD

ID

INFO1

INPUT

ANY

INFO2

INPUT

ANY

RET_VAL

OUTPUT

INT

1 ( )
2 ( )


, , .
ID ( EVENTN)
( INFO1 INFO2).
ID ( 23.1). 8 ( ), 9 ( ), (
).
(INFO1) 7 8
( ), (INFO2) 9 12 ( ). .
ID
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0


1 - , 0 -
1 -
1 -
1 -
:
1000
1001
1010
1011

23.1 ID

18

23.4

, SEND
1. ( , , , ), ( 9 ID ).
23.4.3
,
82. 82 , CPU STOP. 82 SFC 39 DIS_IRT SFC 40
EN_IRT, SFC 41 DIS_AIRT SFC 42
EN_AIRT.
B#16#39 , B#16#38 .
(B#16#54 , B#16#55 ); INT ,
. ,
.
, OB 82 SFC 59 RD_REC ( ).
, 82 , . 82 .
DS 0 DS 1.
DS 0 , . , 8 11 82.
DS 1 DS 0 , , .
23.4.4
(system status list, SSL)
. , , , . ( ) SFC 51
RDSYSST. ; ,
CPU . SFC 51 23.7.
REQ = 1 , BUSY = 0 .

; CPU. SFC 51

19

23

(W#16#8085),
.
23.7 SFC 51 RDSYSST
SFC

51

REQ

INPUT

BOOL

1:

SSL_ID

INPUT

WORD

ID

INDEX

INPUT

WORD

RET_VAL

OUTPUT

INT

BUSY

OUTPUT

BOOL

1:

SSL_HEADER

OUTPUT

STRUCT

DR

OUTPUT

ANY

SSL_ID INDEX CPU.


SSL_HEADER STRUCT LENGTHDR (
WORD) N_DR (WORD) . LENGTHDR , N_DR .
DR , SFC
51 . , P#DB200.DBX0.0 WORD 256
256 DB 200, DBB 0. , . .
.

20

LAD FBD, STEP 7 (STEP 7


Block Libraries) LAD FBD.
LAD/FBD (block
protection). ( ) STL.
STL, (indirect addressing), LAD FBD; . LAD_Book FBD_Book
(Sample Message
Frame), .
STEP 7 (block
libraries) ,
(SFC
SFB).
LAD FBD.

LAD_Book FBD_Book. SIMATIC- File Retrieve ( ).
() .
. ,
\STEP7\S7LIBS; ,
, \STEP7\S7PROJ, .
Retrieve - Options ( - ) Restore full path ( ).
LAD_Book FBD_Book ,
LAD FBD. , (
) ( ).
1,93 .
, , , , ,
.
.

24


; ;

25


; ; IEC; S5-S7; TI-S7;
PID;

26

LAD
LAD

27

FBD
FBD

24
24

........................................................ 4
24.1 ........................................................................................................................... 4
24.2 .............................................................................................................. 6
24.2.1
: ......................................................................................... 6
24.2.2
.......................................................................................................... 6
24.2.3 DB-................................................................................................................... 8
24.2.4
ANY- ............................................................................................................... 8
24.2.5
ANY-................................................................................... 10
24.3 ........................................................... 11

24

24

24.1
KNOW_HOW_PROTECT.
, . . ( ) KNOW_HOW_PROTECT. , , ,
( !).
KNOW_HOW_PROTECT STL,
. , :
1)

LAD FBD .
Blocks ()
. () ( ), , , ( ) .
.

2)

. S7 program (S7-)
Source Files ( ) ( ,
Blocks), . S7 program
Source Files Insert S7 Software Source
Directory ( S7
).

3)

STL. ( , , Blocks )
File Generate Source File (
). ,
Source Files Object
Name ( ). .
Blocks; (),
. .

4)

(,
SIMATIC- File
Open, ). ASCII- LAD/FBD-. ,
.

24.1

(FUNCTION, FUNCTION_BLOCK, ORGANIZATION_BLOCK) .


( TITLE=) ( //).
( ,
(Properties) ; , ).
() (
VAR_xxx, , END_VAR); ,
, , .
, BEGIN , ( , END_FUNCTION_BLOCK).
:
(DATA_BLOCK) .
( , (Properties) ; , ).
( STRUCT
END_STRUCT) , , .
, BEGIN
END_DATA_BLOCK.
5)

KNOW_HOW_PROTECT
. ,
. .

6)

, File Compile (
). (
STL ;
, KNOW_HOW_PROTECT
, ). () Blocks
() .

24

24.2
STL ,
. LAD FBD: , , SFC 20
BLKMOV.
, .
24.2.1 :
, ,
, , .
(pointer). .
:
(area pointers); 32 , ;
DB- (DB pointers); 48 , ;
ANY- (ANY pointers); 80
DB- , ,
.
24.2.2
, , .
(area-internal); , (area-crossing).
:
P#y.x

, , P#22.0;

P#Zy.x

, , P#M22.0,

= , y = , Z = .
(ID) . 31 .
24.1 ,
STEP 7.

24.2

n

n+1

n+2

n+3

0 0 0 0 0 0 0 0

0 0 0 0 0 y y y

y y y y y y y y

y y y y y x x x

n+1

n+2

n+3

1 0 0 0 0 Z Z Z

0 0 0 0 0 y y y

y y y y y y y y

y y y y y x x x


ANY-

n
n+1

n+3

16#10

16#0000

16#0000

n+4

n+5

n+6

n+2

n+3

n+7

n+4

n+8

n+9

n+5

16#00

ANY-:

0
0
0
0
1
1
1
1

0
0
1
1
0
0
1
1

1)

01 BOOL
02 BYTE
03 CHAR
04 WORD
05 INT
06 DWORD
07 DINT
08 REAL
09 DATE
0A TOD
0B TIME
0C S5TIME

2)

/ (P)
(I)
(Q)
(M)
(DBX)
(DIX)
(L) 1)

(V) 2)

16#0000

:
0
1
0
1
0
1
0
1

ANY-

16#10

n+1
n+2

ANY-
/

16#10

DB-

0E DT
13 STRING

17 BLOCK_FB
18 BLOCK_FC
19 BLOCK_DB
1A BLOCK_SDB
1C COUNTER
1D TIMER

00 NIL

24.1 STEP 7
7

24

, , , ; 0
. : P#M22.0,
() 22.0, , ,
22, MW 22 MD 22.
24.2.3 DB-
DB- INT. ,
.
.
.
, :
P#DataBlock.DataOperand (P#.).
: P#DB 10.DBX 20.5

POINTER .
.
24.2.4 ANY-
DB- ANY- . .
ANY- :
.
, ANY- DB-, .
ANY- ,
DB- .
(n + 6); (n + 7) B#16#00. W#16#0000.
ANY- ID; STEP 7 10hex. , ANY. , DT STRING
1.
ANY ARRAY STRUCT (
UDT), ANY- .
ANY- ID BYTE (02hex)
.
. , ANY- WORD. : , CHAR, CHAR (03hex).

24.2

ANY-
ANY, . :
P#[DataBlock.]Operand Type Quantity (P#[.] )
:
P#DB 11.DBX 30.0 INT 12
12 DB 11, DBB 30;
P#M 16.0 BYTE 8
8 , MB 16;
P#E 18.0 WORD 1
IW 18;
P#E 1.0 BOOL 1
I 1.0.
:
L#Number Type Quantity (L# )
:
L#10TIMER 1
10;
L#2 COUNTER 1
2.
ANY-, . , ANY- .
ANY- ,
, .
ANY. ,
P#1 1.0 BOOL 1 I 1.0 .
() ANY , 10hex ID
00hex . () ANY- (
) : P#P0.0 VOID 0.

24

24.2.5 ANY-
SFC 20
( , P#DB127.DBX0.0
BYTE 32), . (
).
, ANY.
ANY ANY. ANY- ( ), ANY ANY-
- . ANY
, ANY-; () .
SFC 20 BLKMOV,
ANY .
LAD_Book FBD_Book
Message Frame Example ( ), ,
, ANY-.

10

24.3

24.3
.
:
; ;
; ;
; SFC 20
BLKMOV ;
; ANY-;
;
.
24.2 .

,

.
: (Send mailbox) ,
(Receive mailbox)
() . ,
(UDT). , .
(Send) (Receive) , frame (). , , ,
, frame ().

(
, , ).

CPU .
SFC 1 READ_CLK,

11

24

DATE_AND_TIME DT.
, IEC-
FC 8 DT_TOD. TIME_OF_DAY
TOD DT.

DB 64
Measured_values
Values1[1..4]
Values2[1..4]
Values3[1..4]
Values4[1..4]

FB 51 Generate_Frame
DB 51 Generate_DB
ID
ConsecNumb
SFC 1
READ_CLK
FC 8
DT_TOD

ID
Numb

FC 51
CPU_Time

FB 52 Store_Frame
DB 52 DB_Store

DB 62
Rec_mailb
ID
Numb

Calculating Entry

Tim_day
FC 52
CopyData

DB 61
Send_mailb

Tim_day

DB 63
Buffer
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]

24.2

BR ( )
RET_VAL. , BR =
0; ( 15 ). IEC- . . ,
. . , ,
, .

12

24.3


SFC 1
FC 8 . STEP 7. . ( ,
CPU, , . ; CPU. , IEC-, .)
Standard Library File
Open Library ( ) SIMATIC-
System Function Blocks ( ). Blocks
() .
, , Window Arrange Vertically ( ), ( SFC, ,
Blocks ). FC 8. IEC Function Blocks ( IEC). FC 8 ;
SFC 1.
Libraries () (Program Element Catalog)
, Blocks .

. (, FC 8) ( ) .
, (, FC 98).
F1, ( FC
98),
FC 8.
, , .

, .
, . ( ).

13

24


Send_Mailb .
, ID ,
. ;
(Send) BLKMOV.
CPU.
(network) FB Generate_Frame ID, , . 1 .
READ_CLK,

TIME_OF_DAY.

SFC 20 BLKMOV . , . :
. 1 14.
FB Generate_Frame , .

ANY-
.
I_Copy ,
. ANY- ( 24.2.4 ANY). ; (SFC 20 BLKMOV , I_Copy).
SoPointer
DesPointer ANY. ANY-
SFC 20 BLKMOV. SoPointer , , DesPointer . 24.3 SoPointer; DesPointer . , ANY .

14

24.3
0

16#10

SoType

SoNum

SoDB

SoArea

SoByte

SoBit

24.3 SoPointer

I_Copy ( ).
Rec_Mailb
Buffer. Entry ;
.
Entry 0 7.
, Entry 7 . , Entry 1
, 0. Entry, 16, (
Message frame 16 ).
I_Copy,
(Receive) ( DB 62) ( DB 63),
3 (Network 3).

15

25
25
25.1
25.2
25.3
25.4
25.5
25.6
25.7

.............................................................................................................. 4
........................................................................................................ 4
..................................................................................... 6
IEC ............................................................................................... 11
S5-S7............................................................................................... 13
TI-S7 ............................................................................................... 16
PID- ......................................................................................................... 17
.................................................................................................. 17

25

25


STEP 7 Standard Library, :
(Organization Blocks);
(System Function Blocks);
IEC (IEC Function Blocks);
S5-S7 (S5-S7 Converting Blocks);
TI-S7 (TI-S7 Converting Blocks);
PID- (PID Control Blocks);
(Communication Blocks).
.

25.1
( = )

10
11
12
13
14
15
16
17

2
2
2
2
2
2
2
2

0
1
2
3
4
5
6
7

20
21
22
23

3
4
5
6

0
1
2
3

30
31

7
8

0 (5 )
1 (2 )

25.1

32
33
34
35
36
37
38

9
10
11
12
13
14
15

2 (1 )
3 (500 )
4 (200 )
5 (100 )
6 (50 )
7 (20 )
8 (10 )

40
41
42
43
44
45
46
47

16
17
18
19
20
21
22
23

0
1
2
3
4
5
6
7

60

25

70
72
73

25
28
25

/ 1)
CPU

80
81
82
83
84
85
86
87

26
26
26
26
26
26
26
26

1)
1)
1)
/ 1)
CPU 1)
1)
DP 1)
1)

90

29

100
101
102

27
27
27

121
122

1)

= 28

25

25.2
IEC- IEC-
SFB
0
1
2

CTU
CTD
CTUD

( )
( )
/

3
4
5

TP
TON
TOF


SFB
8
9
12
13
14
15
16

USEND
URVC
BSEND
BRCV
GET
PUT
PRINT

19
20
21
22
23

START
STOP
RESUME
STATUS
USTATUS


STOP


SFC
62

CONTROL

CPU 312/314/614

SFB
29
30
38
39

HS_COUNT
FREQ_MES
HSC_A_B
POS

41
42
43

CONT_C
CONT_S
PULSEGEN

25.2

SFC
63

AB_CALL


SFC
6
51
52

RD_SINFO
RDSYSST
WR_USMSG


SYS ST

,
SFB
33
34
35
36
37

ALARM
ALARM_8
ALARM_8P
NOTIFY
AR_SEND

SFC
9
10
17
18
19

EN_MSG
DIS_MSG
ALARM_SQ
ALARM_S
ALARM_SC



,
,

CPU
SFC
0
1

SET_CLK
READ_CLK

2
3
4

SET_RTM
CTRL_RTM
READ_RTM

48

SNC_RTCB

64

TIME_TCK

SFC
32

DRUM

25


SFC
20
21
22
23
24

BLKMOV
FILL
CREAT_DB
DEL_DB
TEST_DB

25

COMPRESS

44

REPL_VAL

81

UBLKMOV

GADR_LGC
LGC_GADR
RD_LGADR


SFC
5
49
50

/
SFC
7
11
12

DP_PRAL
DPSYN_FR
D_ACT_DP


SYNC/FRRZE
DP-

13
14
15

DPNRM_DG
DPRD_DAT
DPWR_DAT

SFC
43

RE_TRIGR

46

STP

STOP

47

WAIT

25.2


SFC
54
55
56
57

RD_DPARM
WR_PARM
WR_DPARM
PARM_MOD

58
59

WR_REC
RD_REC


SFC
26
27

UPDAT_PI
UPDAT_PO

79
80

SET
RSET

/
/


SFC
28
29
30
31

SET_TINT
CAN_TINT
ACT_TINT
QRY_TINT

32
33
34

SRT_DINT
CAN_DINT
QRY_DINT

35

MP_ALM

36
37
38

MSK_FLT
DMSK_FLT
READ_ERR

39
40
41
42

DIR_IRT
EN_IRT
DIS_AIRT
EN_AIRT

25


SFC
65
66
67
68
69

X_SEND
X_RCV
X_GET
X_PUT
X_ABORT

72
73
74

I_GET
I_PUT
I_ABORT


SFC
60
61

GD_SND
GD_RCV

GD-
GD-

SFC
90

H_CTRL

H-CPU

H-CPU

10

25.3 IEC

25.3 IEC

FC
9
28
14
12
23
18

EQ_DT
NE_DT
GT_DT
GE_DT
LT_DT
LE_DT

DT
DT
DT
DT
DT
DT

10
29
15
13
24
19

EQ_STRING
NE_STRING
GT_STRING
GE_STRING
LT_STRING
LE_STRING

STRING
STRING
STRING
STRING
STRING
STRING


FC
3

D_TOD_DT

DATE TOD DT

6
7
8

DT_DATE
DT_DAY
DT_TOD

DATE DT
DT
TOD DT

33
40

S5TI_TIM
TIM_S5TI

S5TIME TIME
TIME S5TIME

1
35
34

AD_DT_TM
SB_DT_TM
SB_DT_DT

TIME DT
TIME DT
DT DT


FC
22
25
27
26

LIMIT
MAX
MIN
SEL

11

25

12

FC
21
20
32
26
2
17
4
31
11

LEN
LEFT
RIGHT
MID
CONCAT
INSERT
DELETE
REPLACE
FIND

STRING
STRING
STRING
STRING
STRING
STRING
STRING
STRING
STRING

16
5
30

I_STRING
DI_STRING
R_STRING

INT STRING
DINT STRING
REAL STRING

38
37
39

STRING_I
STRING_DI
STRING_R

STRING INT
STRING DINT
STRING REAL

25.4 S5-S7

25.4 S5-S7

FC
61

GP_FPGP

62

GP_GPFP

63
64
65
66
67
68

GP_ADD
GP_SUB
GP_MUL
GP_DIV
GP_VGL
GP_RAD


FC
85
86
87
88
89

ADD_32
SUB_32
MUL_32
DIV_32
RAD_16

32-
32-
32-
32-
16-

90
91
92
93

REG_SCHB
REG_SCHW
REG_FIFO
REG_LIFO



(FIFO)
(LIFO)

94
95
96
97
98
99

DB_COPY1
DB_COPY2
RETTEN
LADEN
COD_B8
COD_32

()
()
(S5-155U)
(S5-155U)
BCD , 8
BCD, 8


FC
81
82
83
84

COD_B4
COD_16
MUL_16
DIV_16

BCD , 4
BCD, 4
16-
16-
13

25


FC
69
70
71

MLD_TG
MLD_TGZ
MLD_EZW

72

MLD_EDW

73
74
75

MLD_SAMW
MLD_SAM
MLD_EZ

76

MLD_ED

77

MLD_EZWK

78

MLD_EZDK

79

MLD_EZK

80

MLD_EDK




/ Initial value single blinking wordwise

/ Initial value double blinking wordwise


/ Initial
value single blinking
/ Initial value
double blinking

( ) / Initial value single blinking (wordwise) memory bit
( ) / Initial value double blinking
(wordwise) memory bit
/
Initial value single blinking memory bit
/ Initial value double blinking memory bit

14

FC
100
101
102
103
104
105
106
107

AE_460_1
AI_460_2
AI_463_1
AE_463_2
AE_464_1
AE_464_2
AE_466_1
AE_466_2

460
460
463
463
464
464
466
466

108
109

RLG_AA1
RLG_AA2

110
111

PER_ET1
PER_ET2

/ 100
/ 100

25.4 S5-S7


FC
112
113
114
115

SINUS
COSINUS
TANGENS
COTANG

116
117
118
119

ARCSIN
ARCCOS
ARCTAN
ARCCOT

120
121
122

LN_X
LG_X
B_LOG_X


10

123
124
125

E_H_N
ZEHN_H_N
A2_H_A1


10

15

25

25.5 TI-S7

16

FB
80
81
82
83
84
85
86

LEAD_LAG
DCAT
MCAT
IMC
SMC
DRUM
PACK

(Lead/lag algorithm)





/

FC
80
81
82
83

TONR
IBLKMOV
RSET
SET

84
85
86
87
88
89
90
91

ATT
FIFO
TBL_FIND
LIFO
TBL
TBL_WRD
WSR
WRD_TBL

92
93
94
95

SHRB
SEG
ATH
HTA


7-
ASCII
ASCII

96
97
98

ENCO
DECO
BCDCPL

99

BITSUM

100
101

RSETI
SETI

PQ
PQ

102
103
104
105
106

DEV
CDT
TBL_TBL
SCALE
UNSCALE

25.7

25.6 PID-
FB
41
42
43

CONT_C
CONT_S
PULGEN

25.7
FC
1
2
3
4

DP_SEND
DP_RECV
DP_DIAG
DP_CTRL

17

26
26
26.1
26.2
26.3

LAD............................................................................................................ 4
.................................................................................................................... 4
................................................................................................................. 7
................................................................................... 10

26 LAD

26

LAD

26.1

SR

SR
S

RS

RS
R


N

POS

M_BIT

26.1

NEG
Q
M_BIT


NO-
NC-
NOT-


NOT


S_PULSE
S
TV

Q
BI
BCD


SP

NO-
NC-

:
S_PULSE
SP

S_PEXT
SE

S_ODT
SD

S_ODTS
SS

S_OFFDT
SF

26 LAD


MOVE

MOVE
EN

ENO

IN

OUT


S_CUD
CU

CD
S
PV

CV
CV_BCD


CU


CD


CU

NO-
NC-

:
S_CUD
/
S_CU

S_CD

26.2

26.2

CMP ==I

IN1
IN2


DINT
REAL
==D
==R

INT
==I

<>I

<>D

<>R

>I

>D

>R

>=I

>=D

>=R

<I

<D

<R

<=I

<=D

<=R


ADD_I

EN

ENO

IN1

OUT

IN2


INT
DINT
REAL
ADD_I
ADD_DI
ADD_R

SUB_I

SUB_DI

SUB_R

MUL_I

MUL_DI

MUL_R

DIV_I

DIV_DI

DIV_R

MOD_DI

SIN
EN

ENO

IN

OUT

26 LAD

SIN

COS

TAN

ASIN

ACOS

ATAN

SQR

SQRT

EXP

LN

I_DI

INT DINT

I_BCD

INT BCD

DI_BCD

DINT BCD

DI_R

DINT REAL

BCD_I

BCD INT

BCD_DI

BCD DINT

I_BCD
EN

ENO

IN

OUT

REAL DINT

CEIL

FLOOR

ROUND

TRUNC

INV_I

INT

INV_DI

DINT

NEG_I

INT

NEG_DI

DINT

NEG_R

REAL

ABS

REAL

26.2

SHL_W
EN

ENO

IN

OUT

SHL_W

SHL_DW

SHR_W

SHR_DW

SHR_I

SHR_DI

ROL_DW

ROR_DW

WAND_W
EN

ENO

IN1

OUT

IN2

WAND_W

AND

WOR_W

OR

WXOR_W

OR

WAND_DW

AND

WOR_DW

OR
OR

WXOR_DW

26 LAD

26.3

>0

>=0

<0

<=0

<>0

==0


()

UO


()

OV

OS

BR

SAVE
()

SAVE


,
RLO = 1

Dest
JMP

,
RLO = 0

Dest
JMPN

10

Dest

26.3

(MCR)

MCR-

MCRA

MCR-

MCRD

MCR-

MCR<

MCR-

MCR>


DB x


( )

FB x
EN

ENO

IN1

OUT1

IN2

OUT2
DB x


( )



( )

SFB x
EN

ENO

IN1

OUT1

IN2

OUT2
#name

EN

ENO

IN1

OUT1

IN2

OUT2
FC x

EN

ENO

IN1

OUT1

IN2

OUT2
SFC x


EN

ENO

IN1

OUT1

IN2

OUT2

11

26 LAD

12

FC x
CALL

SFC x
CALL

RET
( )

RET

DB x
OPN

27
27
27.1
27.2
27.3

FBD ............................................................................................................ 4
.................................................................................................................... 4
................................................................................................................. 7
................................................................................... 10

27 FBD

27

FBD

27.1

SR

SR
S
R

RS

RS
R
S


RLO


RLO

POS
M_BIT

NEG
M_BIT

27.1


&

AND
OR

>=1

OR

XOR


1

0


S_PULSE
S
TV
R

BI
BCD
Q


SP
TV

R

:
S_PULSE
SP

S_PEXT
SE

S_ODT
SD

S_ODTS
SS

S_OFFDT
SF

27 FBD


MOVE

MOVE
EN

OUT

IN

ENO


S_CUD
CU
CV
CD CV_BCD
S
Q
PV
R

CU

CD

SC
PV

R

:
S_CUD
/
S_CU

S_CD

27.2

27.2

CMP ==I

IN1
IN2


DINT
REAL
==D
==R

INT
==I

<>I

<>D

<>R

>I

>D

>R

>=I

>=D

>=R

<I

<D

<R

<=I

<=D

<=R


ADD_I

EN
IN1

OUT

IN2

ENO


DINT
REAL
ADD_DI
ADD_R

INT
ADD_I

SUB_I

SUB_DI

SUB_R

MUL_I

MUL_DI

MUL_R

DIV_I

DIV_DI

DIV_R

MOD_DI

27 FBD

SIN

COS

TAN

ASIN

ACOS

ATAN

SQR

SQRT

EXP

LN

SIN
EN

OUT

IN

ENO

I_DI

INT DINT

I_BCD

INT BCD

DI_BCD

DINT BCD

DI_R

DINT REAL

BCD_I

BCD INT

BCD_DI

BCD DINT

I_BCD
EN

OUT

IN

ENO

REAL DINT

CEIL

FLOOR

ROUND

TRUNC

INV_I

INT

INV_DI

DINT

NEG_I

INT

NEG_DI

DINT

NEG_R

REAL

ABS

REAL

27.2

SHL_W

SHL_DW

SHR_W

SHR_DW

SHR_I

SHR_DI

ROL_DW

ROR_DW

SHL_W
EN
IN

OUT

ENO

WAND_W
EN
IN1

OUT

IN2

ENO

WAND_W

AND

WOR_W

OR

WXOR_W

OR

WAND_DW

AND

WOR_DW

OR
OR

WXOR_DW

27 FBD

27.3

>0

>=0

<0

<=0

<>0

==0


()

UO


()

OV

OS


BR

BR


BR

SAVE


,
RLO = 1

Dest
JMP

,
RLO = 0

Dest
JMPN

10

Dest

27.3

(MCR)

MCR-

MCRA

MCR-

MCR<

MCR-

MCR>

MCR-

MCRD


DB x


( )

FB x
EN

OUT1

IN1

OUT2

IN2

ENO
DB x


( )



( )

SFB x
EN

OUT1

IN1

OUT2

IN2

ENO
#name

EN

OUT1

IN1

OUT2

IN2

ENO
FC x

EN

OUT1

IN1

OUT2

IN2

ENO
SFC x


EN

OUT1

IN1

OUT2

IN2

ENO

11

27 FBD

12

FC x
CALL

SFC x
CALL

RET

DB x
OPN