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

14 SFC SFB

S7-300 S7-400
A5E00261410-01

14-1

14 SFC SFB

14.1
SFC26 "UPDAT_PI"

SFC 26 UPDAT_PI (update process image [


]) OB1 (=
0 ) ,
STEP 7.

/ ,
SFC26
.
SFC26
, ,
:


0
1 .

,
STEP 7,
OB1.
SFC26
OB1 ,
.

PART

INPUT

BYTE

I, Q, M, D, L,

,
.
: 0 15 (0

OB1; n, 1 <n < 15,
n )

RET_VAL

OUTPUT

INT

I, Q, M, D, L

FLADDR

OUTPUT

WORD

I, Q, M, D, L

,
,
.

14-2

S7-300 S7-400
A5E00261410-01

14 SFC SFB



(W#16#...)

0000

8090

PART.

8091


CPU.

8092

,

/. SFC26
"UPDAT_PI"

80A0

8xyy

, .
RET_VAL

S7-300 S7-400
A5E00261410-01

14-3

14 SFC SFB

14.2
SFC27 "UPDAT_PO"

SFC27 "UPDAT_PO" (update process outputs [


])
OB1 (= 0 )
, STEP 7, .

,
STEP 7,
OB1.
SFC27
OB1 ,
OB .

PART

INPUT

BYTE

RET_VAL

OUTPUT

INT

I, Q, M, D, L

FLADDR

OUTPUT

WORD

I, Q, M, D, L


I, Q, M, D, L,


.
: 0 15
(0 OB1,
n n
, 1 n 15).
.
,
,
.


(W#16#...)
0000

8090

PART.

8091


CPU.
.

80A0
8xyy

14-4

, .
RET_VAL

S7-300 S7-400
A5E00261410-01

14 SFC SFB

14.3 SFC79 "SET"

SFC79 "SET" (set range of outputs [ ])


:

/, N SA.

,
.

/, .
,
SFC79 .
RET_VAL .

SFC79 /
.
, N SA,
, SFC79
:
,
/
,
.
,
.
, ,
, .
N 0, SFC79
.
, SFC79 .

INPUT

INT

I, Q, M, D, L,

RET_VAL

OUTPUT

INT

I, Q, M, D, L

SA

OUTPUT

POINTER


RET_VAL,
2.
SFC. SFC79 RET_VAL -
.

S7-300 S7-400
A5E00261410-01

14-5

14 SFC SFB

14.4
SFC 126 "SYNC_PI"

SFC 126 "SYNC_PI"


.
, DP-, SFC
,
(process image partition).
SFC 126 OB 61,
62, 63 64.
SFC 126,
( S7-400):
DP- (DP clock cycle) > 5.0
(slave) < DP- - 4.0

SFC 126 "SYNC_PI" OB 6164 ,


OB
HW Config.
SFC 126 "SYNC_PI",
SFC 26 "UPDAT_PI".

14-6

( S7-400)
(, L PIB)
, SFC 126
"SYNC_PI".
,
.

S7-300 S7-400
A5E00261410-01

14 SFC SFB

1 30

PART

INPUT

BYTE



,
.

RET_VAL

OUTPUT

INT

FLADDR

OUTPUT

WORD

W#16#8090

PART /
OB.
.

W#16#8091


CPU.
.

W#16#80A0

. ,
, "0".

W#16#80A1


.
.

W#16#80C1


.
.

W#16#8xyy

, .
RET_VAL

SFC 126 "SYNC_PI"


DP-,
, 32 ,
SFC 14 "DPRD_DAT".

S7-300 S7-400
A5E00261410-01

14-7

14 SFC SFB

14.5
SFC 127
"SYNC_PO"

SFC 127 "SYNC_PO"


.
, DP-, SFC
,
,
I/O .
SFC 127 OB 61,
62, 63 64.
SFC 126,
( S7-400):
DP- (DP clock cycle) > 5.0
(slave) < DP- - 4.0

SFC 127 "SYNC_PO" OB 6164 ,


OB
HW Config.
SFC 127, SFC 27
"UPDAT_PO".

( S7-400)
(, L PQB)
, SFC 127.
, .

PART

14-8

INPUT

BYTE


1 30



,

.

S7-300 S7-400
A5E00261410-01

14 SFC SFB

RET_VAL

OUTPUT

INT

FLADDR

OUTPUT

WORD

W#16#0001

.
DP-.
,
.

W#16#8090

PART /
OB.
I/O-.
.

W#16#8091


CPU.
I/O-. .

W#16#80A0

.
I/O-.
.

W#16#80A1


, DP. I/O-.
.

. I/O-.
.

W#16#80C1

W#16#8xyy

, .
RET_VAL

SFC 127 "SYNC_PO"


DP-,
, 32 ,
SFC 15 "DPWR_DAT".

S7-300 S7-400
A5E00261410-01

14-9

14 SFC SFB

14.6 SFC80 "RSET"

SFC80 "RSET" (reset range of outputs [ ])


:
/,
N SA.

,
.

/, .
,
SFC80 .
RET_VAL .

SFC80 /
.
, N SA,
, SFC80
:
,
/
,
.
,
.
, ,
, .
N 0, SFC80
.
, SFC80 .

INPUT

INT

I, Q, M, D, L,

RET_VAL

OUTPUT

INT

I, Q, M, D, L

SA

OUTPUT

POINTER


RET_VAL,
2.
SFC. SFC80 RET_VAL -
.

14-10

S7-300 S7-400
A5E00261410-01

14 SFC SFB

14.7
SFB32 "DRUM"

SFB 32 DRUM
, 16. DSP,
LST_STEP.
16 OUT0 OUT15
OUT_WORD ( ).

OUT_VAL ,
. ,
S_MASK (. ).
SFB32 "DRUM" , JOG

SFB. SFB ,
JOG Q EOD
, DCC 0, SFB
, RESET 1.
,
.
DRUM_EN 1.
, :
EVENTi

.
DTBP
, (
S_PRESET)

(DCC)
, EVENTi.
SFB RESET 1,
,
DSP.

1 DRUM_EN,
:
, , EVENTi = 1,

DSP < i < LST_STEP.


, ,
EVENTi 0 DTBP.

( DRUM_EN=1) JOG.

S7-300 S7-400
A5E00261410-01

14-11

14 SFC SFB

, 1
RESET.
(DSC
LST_STEP) ,
Q EOD , SFB
, 1 RESET.
DRUM STARTUP RUN.
SFB32 "DRUM" ,
. SFB32 "DRUM"
, 100 RESET = 1.

RESET

INPUT

BOOL

I, Q, M, D, L,

1
.

RESET 1.

JOG

INPUT

BOOL

I, Q, M, D, L,

(

SFB)

,

.

,
DRUM_EN.

DRUM_EN

INPUT

BOOL

I, Q, M, D, L,

,
,

(1:
).

LST_STEP

INPUT

BYTE

I, Q, M, D, L,


. : 1 16

EVENTi,1 < i INPUT


< 16

BOOL

I, Q, M, D, L,

i (
i)

OUTj,0 < j <


15

OUTPUT

BOOL

I, Q, M, D, L

j (
j OUT_WORD)

OUTPUT

BOOL

I, Q, M, D, L

,
,

.

OUT_WORD OUTPUT

WORD

I, Q, M, D, L, P

ERR_CODE

OUTPUT

WORD

I, Q, M, D, L, P

SFB
, ERR_CODE
.

JOG_HIS

VAR

BOOL

I, Q, M, D, L,

(
:
JOG SFB)

EOD

VAR

BOOL

I, Q, M, D, L,

14-12

S7-300 S7-400
A5E00261410-01

14 SFC SFB

DSP

VAR

BYTE

I, Q, M, D, L, P,

.
: 1 16.

DSC

VAR

BYTE

I, Q, M, D, L, P,

DCC

VAR

DWORD

I, Q, M, D, L, P,


(
,
DRUM_EN = 1
= 1)

DTBP

VAR

WORD

I, Q, M, D, L, P,

DWORD

I, Q, M, D, L,

(
:
SFB)

PREV_TIME VAR

S_PRESET

VAR

ARRAY of
WORD

I, Q, M, D, L,



.
: [1 to 16].
S_PRESET [x]
x.

OUT_VAL

VAR

ARRAY of
BOOL

I, Q, M, D, L,


,

S_MASK.
: [1 to 16, 0 to 15].
OUT_VAL [x, y]
,
OUTy x.

S_MASK

VAR

ARRAY of
BOOL

I, Q, M, D, L,


.
: [1 to 16, 0 to 15].
S_MASK [x, y]
y
x.
:

S7-300 S7-400
A5E00261410-01

0:

1:
OUT_VAL

14-13

14 SFC SFB


,
SFB 32 DRUM , ERR_CODE
.
ERR_CODE (W#16#...)

14-14

0000

8081

LST_STEP

8082

DSC

8083

DSP

8084

DCC = DTBP * S_PRESET[DSC] 2**32-1


( 24,86 )

S7-300 S7-400
A5E00261410-01