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

20 SFC

S7-

S7-300 S7-400
A5E00261410-01

20-1

20 SFC S7-

20.1 SFC
REQ
REQ (request to activate [ ])
, .
( ).
SFC (
REQ = 1), .
SFC ,
, .
, (
), SFC REQ.

REQ_ID ( SFC 65 SFC 66)


REQ_ID
. CPU SFC
66 "X_RCV" CPU .
REQ_ID

SFC 65 "X_SEND"
REQ_ID CPU
;
SFC 65 "X_SEND"
CPU .
REQ_ID
.

RET_VAL BUSY
SFC ; ,
SFC.
RET_VAL BUSY . .
" REQ, RET_VAL BUSY SFC".

20-2

S7-300 S7-400
A5E00261410-01

20 SFC S7-

CONT
CONT (continue []) .
, ,
, .
CONT=0,
.
.
,
.
CONT=1,
.
, ,
.

, CONT= 1,
SFC69 "X_ABORT" SFC74 "I_ABORT".

S7-300 S7-400
A5E00261410-01

20-3

20 SFC S7-

20.2 SFC
S7-


"" SFC 65SFC 74
" SFC
65SFC 74" :
(W#16#)
809
80
80
80

CPU, SFC.
.
.
.

SFC 65 SFC 74.



(W#16# ...)
0000

00xy

7000

7001
7002

20-4

()

( SFC)

. SFC69 "X_ABORT" SFC74


"I_ABORT": REQ=1
.
SFC66 "X_RCV": EN_DT=1 RD=NIL
SFC66 "X_RCV" NDA=1
RD<>NIL: RET_VAL
( EN_DT=0)
, RD
( EN_DT=1).
SFC67 "X_GET": RET_VAL
.
SFC72 "I_GET": RET_VAL
.
SFC65 "X_SEND", SFC67 "X_GET",
SFC68 "X_PUT", SFC69 "X_ABORT",
SFC72 "I_GET", SFC73 "I_PUT"
SFC74 "I_ABORT": REQ = 0
( ), BUSY
0,
.
SFC66 "X_RCV": EN_DT=0/1 NDA=0
REQ=1:
; BUSY
1.
(REQ
SFC69 "X_ABORT" SFC74
):
"I_ABORT":
; BUSY REQ=1
1.

S7-300 S7-400
A5E00261410-01

20 SFC S7-


(W#16# ...)
8090

8092

8095
80A0

80A1
80B0
80B1
80B2

80B3

()

( SFC)


,
:
IOID

MPI (> 126)
SD RD, :

.

SFC65 "X_SEND", :
SD
SD=NIL .
SFC66 "X_RCV", :

, ,
, RD
RD BOOL,
.
SFC67 "X_GET" SFC72 "I_GET",
:
RD
RD

RD=NIL .
SFC68 "X_PUT" SFC73 "I_PUT",
:
SD
SD=NIL .
-


.
. SFC68 "X_PUT" SFC73 "I_PUT":
, SD
CPU,
.
: SFC

.
, ,
SFC67 "X_GET"
DB.
SFC68 "X_PUT" SFC72 "I_GET"
SFC73 "I_PUT".
ANY.

.
SFC67 "X_GET"
:
SFC68 "X_PUT" SFC72 "I_GET"
.
SFC73 "I_PUT".

.


.

.

SDB.
,
SFC67 "X_GET"
, , SFC68 "X_PUT" SFC72 "I_GET"
DB, .
SFC73 "I_PUT".

S7-300 S7-400
A5E00261410-01

20-5

20 SFC S7-


(W#16# ...)
80B4

80B5
80B6
80B7

80B8
80B9

80BA
80C0
80C1

80C2

80C3

20-6

()

ANY,
.

( SFC)
SFC67 "X_GET" SFC68 "X_PUT"
SFC72 "I_GET" SFC73 "I_PUT":
, VAR_ADDR,
.
SFC65 "X_SEND".

-
.

.
/ SFC68 "X_PUT"
SFC73 "I_PUT".
CPU ,
.
SFC65 "X_SEND":
SFC66 "X_RCV"
(RD=NIL).
SFC65 "X_SEND":

( SFC66
"X_RCV" EN_DT=0),
,

STOP.

.

.
CPU,
SFC,
:


.
,
, .

, :


.
, ,
.. .

( ).
,
:
S7
MPI.
MPI
.

.

.

S7-300 S7-400
A5E00261410-01

20 SFC S7-

20.3 ,
S7, SFC65
"X_SEND"

SFC65 "X_SEND"
S7.
SFC66 "X_RCV".

REQ_ID. (ID) .
,
.
SFC REQ=1.
, , SD (
CPU) ,
, RD ( ). SD
BOOL, RD BOOL.

REQ

INPUT

BOOL

CONT

INPUT

BOOL

I, Q, M, D, L,

DEST_ID

INPUT

WORD

I, Q, M, D, L,

REQ_ID

INPUT

DWORD

I, Q, M, D, L,

SD

INPUT

ANY

I, Q, M, D

RET_VAL

OUTPUT

INT

I, Q, M, D, L

BUSY

OUTPUT

BOOL

I, Q, M, D, L

I, Q, M, D, L,

S7-300 S7-400
A5E00261410-01


" ".
. " SFB/FB
SFC/FC
S7".

"". . "
SFB/FB SFC/FC
S7".
"ID ".
MPI-
.
STEP 7.
.

.
.

: BOOL, BYTE, CHAR, WORD,
INT, DWORD, DINT, REAL, DATE,
TOD, TIME, S5_TIME,
DATE_AND_TIME
, BOOL.
,
, ,

.
BUSY=1: .
BUSY=0:
.
20-7

20 SFC S7-

REQ_ID
REQ_ID .
CPU SFC66
"X_RCV" CPU .
REQ_ID :
SFC65 "X_SEND"
REQ_ID CPU
.
,
CPU, SFC65 "X_SEND".
REQ_ID,
.


. " SFC
S7-".

20-8

S7-300 S7-400
A5E00261410-01

20 SFC S7-

20.4 ,
S7, SFC66 "X_RCV"

SFC66 "X_RCV" ,
SFC65 "X_SEND",
S7.
SFC66 "X_RCV"
, .
.
""
.

EN_DT

INPUT

BOOL

I, Q, M, D, L,

RET_VAL

OUTPUT

INT

I, Q, M, D, L

REQ_ID

OUTPUT

DWORD

I, Q, M, D, L

S7-300 S7-400
A5E00261410-01

"
".
0 , ,
,
. EN_DT = 1
""
,
RD.

,

. ,
RET_VAL :
W#16#7000, EN_DT=0/1
NDA=0.
.
"" ,
,
,
EN_DT=0 NDA=1.
,
RD,
,
EN_DT=1 NDA=1.
SFC "X_SEND",
,
, ""
.
, REQ_ID 0.

20-9

20 SFC S7-

NDA

OUTPUT

BOOL

RD

OUTPUT

ANY

I, Q, M, D, L

I, Q, M, D

"
".
NDA=0:
.
NDA=1:
, ,
.
( SFC66 EN_DT=0).
""

.
( SFC66 EN_DT=1).
.
:
BOOL, BYTE, CHAR, WORD, INT,
DWORD, DINT, REAL, DATE, TOD, TIME,
S5_TIME, DATE_AND_TIME
, BOOL.

"" ,
RD NIL.

EN_DT=0
,
, .
,
, SFC66 EN_DT=0 NDA
:
NDA=0 , .
REQ_ID , RET_VAL W#16#7000.
NDA=1 , , ,
, .
RET_VAL ,
, REQ_ID. RET_VAL ,
REQ_ID .
, REQ_ID RET_VAL
"" .

20-10

S7-300 S7-400
A5E00261410-01

20 SFC S7-

"X_RCV"

EN_DT REQ_ID
NDA
RD

,
t2

,
t1

t
t1

t2

EN_DT=1
SFC66 "X_RCV" EN_DT=1,
, RD.
RD
SFC65 "X_SEND", SD.
SD BOOL, RD
BOOL.
, REQ_ID ( SFC EN_DT = 0)
RD ( EN_DT=1).
, RET_VAL
,
.

X_RCV
1

EN_DT REQ_ID
ND A
RD


, RD NIL
(. /232/).
(RET_VAL SFC65 "X_SEND"
W#1680B8). RET_VAL SFC66 "X_RCV" 0.


, .
,
( ).
S7-300 S7-400
A5E00261410-01

20-11

20 SFC S7-

STOP
CPU STOP,

, ,
.
STOP ,
.
STOP ( S7-300
S7-400H), , ,
,
STOP (
SFC66 "X_RCV" EN_DT=0).
.
.


, ,
, .
: ,
, SFC66 "X_RCV" EN_DT=0,
EN_DT=1.


. " SFC
S7-".

20-12

S7-300 S7-400
A5E00261410-01

20 SFC S7-

20.5
S7 SFC68 "X_PUT"

SFC68 "X_PUT" ,
S7.
SFC.
SFC REQ=1.
SFC ,
BUSY=0.
, SD (
CPU) ,
VAR_ADDR ( ). SD
VAR_ADDR .

REQ

INPUT

BOOL

I, Q, M, D, L,

CONT

INPUT

BOOL

I, Q, M, D, L,

DEST_ID

INPUT

WORD

I, Q, M, D, L,

VAR_ADDR INPUT

ANY

I, Q, M, D

SD

INPUT

ANY

I, Q, M, D

RET_VAL

OUTPUT

INT

I, Q, M, D, L

BUSY

OUTPUT

BOOL

I, Q, M, D, L

S7-300 S7-400
A5E00261410-01

"
".
. " SFC
S7".
"".
. " SFC
S7".
"ID ".
MPI-
.
STEP 7.
CPU ,

.
,
.
CPU,
.

: BOOL, BYTE, CHAR, WORD,
INT, DWORD, DINT, REAL, DATE,
TOD, TIME, S5_TIME,
DATE_AND_TIME
, BOOL.
SD ,
VAR_ADDR
. SD
VAR_ADDR
.
,
, ,

.
BUSY=1:
.
BUSY=0:
.

20-13

20 SFC S7-

STOP
CPU STOP, SFC68 "X_PUT"
. .

CPU, .

STOP
CPU STOP,
SFC68 "X_PUT".
, STOP.


. " SFC
S7-".

20-14

S7-300 S7-400
A5E00261410-01

20 SFC S7-

20.6 ,
S7, SFC67 "X_GET"

SFC67 "X_GET" ,
S7.
SFC.
SFC REQ=1.
SFC , BUSY=0
. RET_VAL
.
, RD (
CPU) , , ,
( ), VAR_ADDR.
RD VAR_ADDR .

REQ

INPUT

BOOL

I, Q, M, D, L,

CONT

INPUT

BOOL

I, Q, M, D, L,

DEST_ID

INPUT

WORD

I, Q, M, D, L,

VAR_ADDR

INPUT

ANY

I, Q, M, D

RET_VAL

OUTPUT

INT

I, Q, M, D, L

BUSY

OUTPUT

BOOL

I, Q, M, D, L

S7-300 S7-400
A5E00261410-01

"
".
. " SFC
S7".
"".
. " SFC
S7".
"ID ".
MPI-
.
STEP 7.
CPU ,
.
,

.
,
, ,

.
, RET_VAL
,

RD,
.
BUSY=1: .
BUSY=0:
.

20-15

20 SFC S7-

RD

OUTPUT

ANY

I, Q, M, D

(
).
: BOOL,
BYTE, CHAR, WORD, INT, DWORD,
DINT, REAL, DATE, TOD, TIME,
S5_TIME, DATE_AND_TIME
,
BOOL.
RD ,
, ,

VAR_ADDR ,
. RD
VAR_ADDR

STOP
CPU STOP, SFC67 "X_GET"
. ,
,
:
( S7-300 S7-400H)
, RD.
.

STOP
CPU STOP,
SFC67 "X_GET".
, STOP.


. " SFC
S7-".

20-16

S7-300 S7-400
A5E00261410-01

20 SFC S7-

20.7
, S7,
SFC69 "X_ABORT"

SFC69 "X_ABORT" ,
SFC X_SEND, X_GET X_PUT ,
S7. ,
X_SEND, X_GET X_PUT, (BUSY = 0), SFC69
"X_ABORT" , ,
. , X_SEND, X_GET X_PUT,
(BUSY = 1), , ,
SFC REQ = 0 CONT = 0
BUSY = 0.
. SFC69 "X_ABORT" ,
SFC "X_SEND", "X_PUT" "X_GET".
SFC REQ=1.

REQ

INPUT

BOOL

I, Q, M, D, L,

DEST_ID

INPUT

WORD

I, Q, M, D, L,

RET_VAL

OUTPUT

INT

I, Q, M, D, L

BUSY

OUTPUT

BOOL

I, Q, M, D, L

"
".
. " SFC
S7".
"ID ".
MPI-
.
STEP 7.
,
, ,

.
BUSY=1:
.
BUSY=0:
.

STOP
CPU STOP, ,
SFC69 "X_ABORT", .

STOP
CPU STOP,
SFC69 "X_ABORT".
.


. " SFC
S7-".
S7-300 S7-400
A5E00261410-01

20-17

20 SFC S7-

20.8 ,
S7, SFC72
"I_GET"

SFC72 "I_GET"
S7.
, .
,
CPU STEP 7.
SFC.
SFC REQ=1.
SFC , BUSY=0
. RET_VAL
.
, RD (
CPU) , , ,
( ),
VAR_ADDR. RD VAR_ADDR
.

REQ

INPUT

BOOL

CONT

INPUT

BOOL

I, Q, M, D, L,

IOID

INPUT

BYTE

I, Q, M, D, L,

LADDR

INPUT

WORD

I, Q, M, D, L,

VAR_ADDR

INPUT

ANY

I, Q, M, D

20-18


I, Q, M, D, L,

"
".
. " SFC
S7".
"".
. " SFC
S7".

:
B#16#54= (PI)
B#16#55= (PQ)
,

,
. ,
B#16#54.
.
,
.
CPU ,
.
,
.

S7-300 S7-400
A5E00261410-01

20 SFC S7-

RET_VAL

OUTPUT

INT

BUSY

OUTPUT

BOOL

I, Q, M, D, L

RD

OUTPUT

ANY

I, Q, M, D

I, Q, M, D, L

,
, ,

.
, RET_VAL
,
RD,

.
BUSY=1: .
BUSY=0:
.
(
).
: BOOL,
BYTE, CHAR, WORD, INT, DWORD,
DINT, REAL, DATE, TOD, TIME,
S5_TIME, DATE_AND_TIME
,
BOOL.
RD ,
, ,

VAR_ADDR ,
. RD
VAR_ADDR .

STOP
CPU STOP, SFC72 "I_GET"
. ,
,
:
( S7-300 S7-400H)
, RD.
.

STOP
CPU STOP,
SFC72 "I_GET".
, STOP.


. " SFC
S7-".
S7-300 S7-400
A5E00261410-01

20-19

20 SFC S7-

20.9 ,
S7, SFC73
"I_PUT"

SFC73 "I_PUT" ,
S7.
,
. ,
CPU STEP 7.
SFC.
SFC
1 REQ.
, SD (
CPU) ,
VAR_ADDR ( ). SD
VAR_ADDR .

REQ

INPUT

BOOL

I, Q, M, D, L,

CONT

INPUT

BOOL

I, Q, M, D, L,

IOID

INPUT

BYTE

I, Q, M, D, L,

LADDR

INPUT

WORD

I, Q, M, D, L,

VAR_ADDR

INPUT

ANY

I, Q, M, D, L

20-20

"
".
. " SFC
S7".
"" .
. " SFC
S7".

:
B#16#54= (PI)
B#16#55= (PQ)
,
,
.
,
B#16#54.
.
,
.

,
. ,

.

S7-300 S7-400
A5E00261410-01

20 SFC S7-

SD

INPUT

ANY

I, Q, M, D

RET_VAL

OUTPUT

INT

I, Q, M, D, L

BUSY

OUTPUT

BOOL

I, Q, M, D, L

CPU,
.
:
BOOL, BYTE, CHAR, WORD, INT,
DWORD, DINT, REAL, DATE, TOD,
TIME, S5_TIME, DATE_AND_TIME
,
BOOL.
SD ,
VAR_ADDR
. SD VAR_ADDR
.
,
, ,

.
BUSY=1: .
BUSY=0:
.

STOP
CPU STOP, SFC73 "I_PUT"
. .

CPU, .

STOP
CPU STOP,
SFC73 "I_PUT".
, STOP.


. " SFC
S7-".

S7-300 S7-400
A5E00261410-01

20-21

20 SFC S7-

20.10
,
S7, SFC74 "I_ABORT"

SFC74 "I_ABORT" ,
SFC72 "I_GET" SFC73 "I_PUT"
S7. , I_GET I_PUT,
(BUSY = 0), SFC74 "I_ABORT"
, , .
, I_GET I_PUT, (BUSY =
1), , ,
SFC REQ = 0 CONT = 0 BUSY = 0.
.
SFC74 "I_ABORT" ,
SFC "I_PUT" "I_GET" ( ).
SFC REQ=1.

REQ

INPUT

BOOL

I, Q, M, D, L,

IOID

INPUT

BYTE

I, Q, M, D, L,

LADDR

INPUT

WORD

I, Q, M, D, L,

RET_VAL

OUTPUT

INT

I, Q, M, D, L

BUSY

OUTPUT

BOOL

I, Q, M, D, L

20-22

"
".
. " SFC
S7".

:
B#16#54= (PI)
B#16#55= (PQ)
,

,
. ,
B#16#54.
.
,
.
,
, ,

.
BUSY=1:
.
BUSY=0:
.

S7-300 S7-400
A5E00261410-01

20 SFC S7-

STOP
CPU STOP, ,
SFC74 "I_ABORT", .

STOP
CPU STOP,
SFC74 "I_ABORT".
.


. " SFC
S7-".

S7-300 S7-400
A5E00261410-01

20-23

20 SFC S7-

20-24

S7-300 S7-400
A5E00261410-01