You are on page 1of 28

13 SFC

S7-300 S7-400
A5E00261410-01

13-1

13 SFC

13.1
CPU
.
.
, STEP 7.
,
, SFC "RD_SINFO" "RDSYSST".

13-2

S7-300 S7-400
A5E00261410-01

13 SFC

13.2 SFC6
"RD_SINFO"

SFC6 "RD_SINFO" (read start information [


]) ,
:
,
, .
. OB100
OB101 OB102,
.

RET_VAL

OUTPUT

INT

I, Q, M, D, L

TOP_SI

OUTPUT

STRUCT

D, L


OB

START_UP_SI

OUTPUT

STRUCT

D, L


OB

TOP_SI START_UP_SI
TOP_SI START_UP_SI
(. ).

EV_CLASS

BYTE

EV_NUM

BYTE

0 3:
4 7:

PRIORITY

BYTE

NUM

BYTE

TYP2_3

BYTE

TYP1

BYTE

ZI1

WORD

2_3: ,
ZI2_3
1: ,
ZI1
1

ZI2_3

DWORD

2_3

,
OB .
,
.
,
, .

S7-300 S7-400
A5E00261410-01

13-3

13 SFC

4 7 EV_CLASS .
:
1: OB
2: OB
3: OB
PRIORITY ,
OB (. 0).
, NUM. NUM
OB OB .

80.
OB 100.

TOP_SI SFC 6 "RD_SINFO"
OB 80.
TOP_SI

EV_CLASS

OB 80

BYTE

OB80_EV_CLASS

BYTE

EV_NUM

BYTE

OB80_FLT_ID

BYTE

PRIORITY

BYTE

OB80_PRIORITY

BYTE

NUM

BYTE

OB80_OB_NUMBR

BYTE

TYP2_3

BYTE

OB80_RESERVED_1

BYTE

TYP1

BYTE

OB80_RESERVED_2

BYTE

ZI1

WORD

OB80_ERROR_INFO

WORD

ZI2_3

DWORD

OB80_ERR_EV_CLASS

BYTE

OB80_ERR_EV_NUM

BYTE

13-4

OB80_OB_PRIORITY

BYTE

OB80_OB_NUM

BYTE

S7-300 S7-400
A5E00261410-01

13 SFC


START_UP_SI SFC 6 "RD_SINFO"
OB 100.
START_UP_SI

OB 100

EV_CLASS

BYTE

OB100_EV_CLASS

BYTE

EV_NUM

BYTE

OB100_STRTUP

BYTE

PRIORITY

BYTE

OB100_PRIORITY

BYTE

NUM

BYTE

OB100_OB_NUMBR

BYTE

TYP2_3

BYTE

OB100_RESERVED_1

BYTE

TYP1

BYTE

OB100_RESERVED_2

BYTE

ZI1

WORD

OB100_STOP

WORD

ZI2_3

DWORD

OB100_STRT_INFO

DWORD


SFC6 "RD_SINFO" ,
.
" SFC".

S7-300 S7-400
A5E00261410-01

13-5

13 SFC

13.3
SFC51 "RDSYSST"

SFC51 "RDSYSST" (read system status [


])
.
, SFC51 REQ
1. , SFC
BUSY 0. BUSY
1, (. 0).

SFC51 "RDSYSST" OB
SSL-ID W#16#00B1 W#16#00B2 W#16#00B3
, ,
.


(
SSL_ID W#16#00B4, W#16#4C91, W#16#4092, W#16#4292, W#16#4692,
, , W#16#00B1, W#16#00B3)
, ,
.
, RET_VAL.
, .
"" SFC51
CPU. /70/ /101/.

REQ

INPUT

BOOL

SSL_ID

INPUT

WORD

INDEX

INPUT

WORD

RET_VAL

OUTPUT

INT

I, Q, M, D, L,

I, Q, M, D, L

BUSY

OUTPUT

BOOL

I, Q, M, D, L


,
(
27).

.
SFC
, RET_VAL
.
TRUE: .

SSL_HEADER

OUTPUT

STRUCT

D, L

. .

DR

OUTPUT

ANY

I, Q, M, L, D


SSL
SSL:

SSL,
DR,
SSL_HEADER.
,
LENGTHDR N_DR ,
DR.

13-6

I, Q, M, D, L,

I, Q, M, D, L,

REQ=1: .

S7-300 S7-400
A5E00261410-01

13 SFC

SSL_HEADER
SSL_HEADER ,
:
SSL_HEADER: STRUCT
LENGTHDR: WORD
N_DR:
WORD
END_STRUCT
LENGTHDR - SSL
SSL.
SSL, N_DR
.
N_DR ,
.


(W#16#...)

0000

0081

8082

. ( ,
, . SLZ
).
REQ=0: ; BUSY
0.
REQ=1: ; BUSY
1.
(REQ ):
; BUSY 1.
(
).
SSL_ID CPU SFC.

8083

INDEX.

8085

-
(, - ).
- (,
, ).
,
.
,
.
,
.
DP ( 2) ( ).

7000
7001
7002
8081

8086
8087
8088
8089
80A2
80A3
80A4
80C5
80C6
80D2
8xyy

DP /
( ).
( CPU
DP).
( ).
-
( ).
, ..
.
, .
RET_VAL

S7-300 S7-400
A5E00261410-01

13-7

13 SFC

SSL_ID

, SFC51
"RDSYSST",
/70/ S7-300
S7-400.
SSL_ID (W#16#...)

INDEX (W#16#...)

(ID)
0111

0001

CPU

0006

0012

0112

0007

MC7

0000

0100

0200

MC7

0300

0F12


SSL

0113

0001


0014

0F14


SSL

0015

0019

(
CPU, . /102 /).

0F19


SSL

001C

011C

13-8

CPU

0001

(ID) CPU

0003

0002

S7-300 S7-400
A5E00261410-01

13 SFC

SSL_ID (W#16#...)

0F1C

INDEX (W#16#...)
0004

0006

SSL


0222

OB


0132

0232

0005

0008


CPU

H CPU

0071

H-

0F71


SSL
(
CPU, . /102 /).

0174
SSL_ID (W#16#...)

LED ID
INDEX (W#16#...)

DP-
0090
0190
0F90

0091
0191
0291
0391
0591
0991
0A91
0C91
4C91

DP-,
CPU
DP-

SSL
(
27 )

/
/





master DP

,
DP
,
DP

S7-300 S7-400
A5E00261410-01

0000
ID
DP-
0000







master- DP

13-9

13 SFC

SSL_ID (W#16#...)
0D91


/ DP

0E91

0092


/ master- DP
master- DP,
DP

/ master- DP
master-
DP,
DP

/ master DP,
DP
master-
DP,
DP
( 21
)
,

,


SSL

4092
0292
4292
0692

4692

00A0
01A0
0FA0

00B1
00B2
00B3
00B4

13-10


( 0)
( 220
, 1) ( DP)
( 220
, 1)
DP-

INDEX (W#16#...)
(ID)
master DP ID
master- DP

0 / ID master- DP
ID master- DP
0 / ID master- DP
ID master- DP
0 / ID master- DP

ID master- DP

S7-300 S7-400
A5E00261410-01

13 SFC

13.4 ,
,
SFC52 "WR_USMSG"

SFC 52 WR_USMSG (write user element in diagnosis buffer


[ ])

. ,
.
, RET_VAL
.



SFC 52.

.

.
,
.
SFC 51 RDSYSST SSL_ID = W#16#0132 INDEX =
W#16#0005. ,
(1) (0).
CPU

SEND=
TR U E
SFC 52


., P G , O P

2
..

..

S7-300 S7-400
A5E00261410-01

13-11

13 SFC



, . ,
,
CPU.
, :
, ,
,
RET_VAL ,
(RET_VAL = W#16#8092).



(SEND = TRUE) ,

,
RET_VAL ,
(RET_VAL = W#16#8091 W#16#8091. W#16#8091
CPU).

12

(ID)

56

78

9, 10, 11 12

13 20

(ID)
ID .


.
.
,
.

,
( )
.

13-12

S7-300 S7-400
A5E00261410-01

13 SFC


Date_and_Time.

SEND

INPUT

BOOL

I, Q, M, D, L,

EVENTN

INPUT

WORD

INFO1

INPUT

ANY

I, Q, M, D, L,

I, Q, M, D, L

INFO2

INPUT

ANY

I, Q, M, D, L

RET_VAL

OUTPUT

INT

I, Q, M, D, L




(ID)
. .
1

SEND
SEND = TRUE,
.
, ,
.
.

EVENTN
EVENTN (ID)
.
W#16#8xyz, W#16#9xyz, W#16#Axyz, W#16#Bxyz.
W#16#8xyz W#16#9xyz
, W#16Axyz
W#16#Bxyz .
x = 1,
x = 0. A B "yz" ,
, .
ID 26.1.

INFO1
INFO1 . INFO1
:
WORD
INT
ARRAY [0 to 1] OF CHAR
INFO1
, , .

S7-300 S7-400
A5E00261410-01

13-13

13 SFC

INFO2
INFO2 . INFO2
:
DWORD
DINT
REAL
TIME
ARRAY [0 to 3] OF CHAR
INFO2
, , .

13-14

S7-300 S7-400
A5E00261410-01

13 SFC


(W#16#...)

0000

0091
8083

(
)
INFO1

8084

INFO2

8085

EVENTN

8086

INFO1

8087

INFO2

8091

( CPU).
(
).
, (
).

8092
8xyy

, .
RET_VAL

S7-300 S7-400
A5E00261410-01

13-15

13 SFC

13.5 OB
SFC78 "OB_RT"

SFC78 OB_RT
(runtime) OB .

SFC78
OB, , OB
. SFC78 ,
("" /"warm"/ ).

OB_NR

INPUT

INT

I, Q, M, D, L

OB,
.
-
OB,
CPU, OB 121 OB 122. ,

,
,
OB,
. OB
121 122, ,
CPU,
.
OB_NR=0,
OB,
SFC. SFC78
OB 121 OB 122
OB_NR=0,
OB,

OB 12x.

RET_VAL

OUTPUT

INT

I, Q, M, D, L


,

. , RET_VAL
OB,
.

PRIO

OUTPUT

INT

I, Q, M, D, L

OB
PRIO

13-16

S7-300 S7-400
A5E00261410-01

13 SFC

LAST_RT

OUTPUT

DINT

I, Q, M, D, L

LAST_ET

OUTPUT

DINT

I, Q, M, D, L

S7-300 S7-400
A5E00261410-01

( )

OB.
OB,
,
SFC78
OB
LAST_RT
OB.

SFC78
OB, LAST_RT
DW#16#FFFF FFFF,
OB
SFC78 ( OB_NR=0).

OB, OB
SFC78 OB_NR=0.
:
, OB
,
LAST_RT.
( )

OB,

OB.
OB,

,
SFC78
OB LAST_ET
LAST_ET

OB
OB.

SFC78
OB, LAST_ET
DW#16#FFFF FFFF,
OB
SFC78 ( OB_NR=0).


OB
OB,
OB SFC78
OB_NR=0.
:
, OB
,
LAST_ET.

13-17

13 SFC

CUR_T

OUTPUT

DINT


I, Q, M, D, L

OB (
)
OB.
CUR_T = 0, OB
.
: ,
0 2.147.483.647 ().
.

CUR_RT

OUTPUT

DINT

I, Q, M, D, L

()
OB. CUR_RT = 0, OB
.

LAST_RT, CUR_RT
0. :
, OB
,
CUR_RT.

CUR_ET

OUTPUT

DINT

I, Q, M, D, L

,

OB ( )
(runtime). CUR_ET = 0, OB
.

LAST_ET, CUR_ET
0. :
, OB
,
CUR_ET.

NEXT_ET

OUTPUT

DINT

I, Q, M, D, L


OB
,
NEXT_ET
-

( ) NEXT_ET = 0,
,

OB.
WinLC RTX
.
:
, OB
,
NEXT_ET.

13-18

S7-300 S7-400
A5E00261410-01

13 SFC


(OB 121, OB 122).

OB OB_NR,
CPU, OS
OB, CPU, RET_VAL
OB, PRIO (
, ) OB
LAST_RT DW#16#FFFF FFFF.

1 102

OB, .

W#16#8080

OB_NR .

W#16#8xyy

, .
RET_VAL

S7-300 S7-400
A5E00261410-01

13-19

13 SFC

13.6
SFC87 "C_DIAG"

SFC87 "C_DIAG"
S7- S7- (
).
,
S7-, S7-

.


.


SFC87 "C_DIAG" , ,
.
SFC87 REQ = 1.
, SFC 0
BUZY. BUZY = 1, .

SFC87?
S7- SFC87 OB
, , 10
.
,

,
, (
MODE=B#16#02, . ).

SFC87?
SFC87 "C_DIAG" 4 ,
, . .

13-20

S7-300 S7-400
A5E00261410-01

13 SFC

MODE
(B#16#...)

00
01
02

03

SFC

,

,

SFC


SFC87 ( MODE = B#16#00, 01 02)
.

SFC87 OB
" " (MODE = B#16#02), ,

CPU.
SFC87 OB 102 " "
(MODE = B#16#01).

REQ

INPUT

BOOL

MODE

INPUT

BYTE

I, Q, M, D, L,

I, Q, M, D, L,


REQ = 1:
,
.
:
B#16#00: SFC
,
.
B#16#01:
SFC

,

.
B#16#02:
SFC

( ,
),

.
B#16#03:
SFC

,

.

S7-300 S7-400
A5E00261410-01

13-21

13 SFC

( )

RET_VAL

OUTPUT

INT

I, Q, M, D, L

BUSY

OUTPUT

BOOL

I, Q, M, D, L

N_CON

OUTPUT

INT

I, Q, M, D, L

CON_ARR

OUTPUT

ANY

I, Q, M, D, L

(
).
BUSY = 1: .
CON_ARR
, .DIS_PCON
.DIS_CON TRUE ().

N_CON
CON_ARR.
:
CON_ARR (index) 1.

.
BYTE.
.
,
,
CPU.

CON_ARR
- .
.
.
.

,
.

CON_ARR[i].
CON_ID

13-22

WORD

,
NETPRO .
W#16#FFFF: , ..,
.
CON_ARR[i].DIS_PCON CON_ARR[i].DIS_CON (.
) ,

SFC 87.

S7-300 S7-400
A5E00261410-01

13 SFC

CON_ARR[i].
STAT_CON

CON_ARR[i].
PROD_CON
CON_ARR[i].
STBY_CON

BYTE

BYTE
BYTE

S7-
:
B#16#00: S7-
B#16#10: S7-
B#16#01: S7-
B#16#11: S7-

B#16#02: S7-
B#16#12: S7- (
)
B#16#13: S7- (
)
.
: 0, 1, 2, 3.

(B#16#FF: )
: 0, 1, 2, 3.
:
.


(W#16#...)
0000

MODE=B#16#00, 01 02:

8000

( STAT_CON) .
.
MODE=B#16#03: .
MODE=B#16#00, 01 02:
( STAT_CON)
. .
MODE=B#16#03: RET_VAL W#16#0001 :
REQ=0. , MODE,
. BUSY 0.
REQ=1. , MODE,
. BUSY 1.
(REQ ).
. BUSY 1.
MODE.

8001

CON_ARR.

8002

CON_ARR .
SFC .

8xyy

, .
RET_VAL

0001

7000
7001
7002

S7-300 S7-400
A5E00261410-01

13-23

13 SFC

13.7
DP- SFC103 "DP_TOPOL"

SFC103 "DP_TOPOL"
(diagnostics repeaters)
DP- (DP master system).
, DP (DP master system), (
), SFC103.


DP- (DP master system).


.

DP- (DP master system),
SFC103.
DP-
:


(repeater function)

(diagnostics
repeater)

(result) (PROFIBUS-
)
(topology table). STEP 7.
SFC103 OB1 OB
(watchdog interrupt). S7-300 OB
.
SFC103

DPR DPRI.
DP (DP master system) , SFC DPR
DPRI , ,
. SFC13
"DPNRM_DG"

STEP 7,

. DPR DPRI NULL,


.

13-24

S7-300 S7-400
A5E00261410-01

13 SFC


SFC103 "DP_TOPOL" , ,
SFC. SFC103
REQ = 1
DP- R=1 - .
() (job status)
RET_VAL BUSY, . REQ, RET_VAL BUSY
SFC.


DP_ID .
SFC103 "DP_TOPOL"
, SFC ,
: DP_ID
, , SFC

W#16#7002 RET_VAL. -
, CPU .

REQ

INPUT

BOOL

I, Q, M, D, L,
constant

REQ=1:

INPUT

BOOL

I, Q, M, D, L,
constant

R=1:

DP_ID

INPUT

INT

I, Q, M, D, L,
constant

ID DP (DP master system),


RET_VAL

OUTPUT

INT

I, Q, M, D, L


,
.

BUSY

OUTPUT

BOOL

I, Q, M, D, L

BUSY=1:
.

S7-300 S7-400
A5E00261410-01

13-25

13 SFC

DPR

OUTPUT

BYTE

I, Q, M, D, L

PROFIBUS-
(diagnostics repeater),

DPRI

OUTPUT

BYTE

I, Q, M, D, L


(diagnostics repeater),
:

0 = 1: DP2

1 = 1: DP3

4 = 1: (temporary)
DP3

5 = 1: (permanent)
DP3

(Permanent errors):
(permanent network errors),
. SFC13 "DPNRM_DG"
STEP 7, .
(Temporary errors):
(temporary network errors),
. (recurring
error).
.


"" ("real") (
W#16#8xyz) ,
(event):
(Temporary errors): ( W#16#80A2 80A4,
80C3, 80C5):
,
SFC ( ,
).
: (W#16#80C3).
(Permanent errors): ( W#16#8082, 80B0,
80B2):
. SFC
, .
: DP- (DP master) / CPU
(W#16#80B0).

13-26

S7-300 S7-400
A5E00261410-01

13 SFC


(W#16#...)

0000

7000

REQ=0. . BUSY = 0.

7001

REQ=1. . BUSY = 1.

7002

(REQ ):
. BUSY = 1.

7010

. ,
DP_ID. BUSY = 0.

7011

R=1.
. BUSY = 1.

7012

: .
BUSY = 1.

7013

: . BUSY = 0.

8082

DP- (DP master system)


DP_ID .

80A2

;
DPR DPRI.

80A3

: "
" ("Watchdog timeout")

80A4

K-

80B0

DP- (DP master) / CPU .

80B2

:
(diagnostics repeater) DP-
(DP master system).

80C3

. :
(
) H CPU
(connecting) .

80C5

DP- (DP master system)


.

8xyy

, .
RET_VAL

S7-300 S7-400
A5E00261410-01

13-27

13 SFC

13-28

S7-300 S7-400
A5E00261410-01