You are on page 1of 26

3

S7-300 S7-400
A5E00261410-01

3-1

3.1 SFC20 "BLKMOV"

SFC20 "BLKMOV" (block move [ ])


(= )
(= ).
SFC20 "BLKMOV" ,
:
: FB, SFB, FC, SFC, OB, SDB,
,
,
/.
(
, ) (DB,
UNLINKED).

DB10. DBW10

A B

DB10. DBW8

C D

DB10. DBW6

E F

DB10. DBW4

G H

MW16

A B

MW14

C D

MW12

E F

MW10

G H

3-2

S7-300 S7-400
A5E00261410-01


,
,
.
, , SFC20 DB,
, SFC20
.

SRCBLK

INPUT

ANY

RET_VAL

OUTPUT

INT

DSTBLK

OUTPUT

ANY

I, Q, M, D, L ,
( ). ,
STRING,
.
I, Q, M, D, L
,
.
I, Q, M, D, L ,
( ).
, STRING,
.

.
, ,
, .
, ,
,
.
ANY ( ) BOOL,
8; SFC
.
ANY STRING,
1.

:
SFC 20
BLKMOV , , PG,
SFC
.
OB, .
CPU SFC
20.

S7-300 S7-400
A5E00261410-01

3-3


(W#16#...)

3-4

0000

8091

8092

SFC20 "BLKMOV" -
. SFC 83.

8xyy

, .
RET_VAL

S7-300 S7-400
A5E00261410-01

3.2
SFC81 "UBLKMOV"

SFC81 "UBLKMOV" (uninterruptable block move [


])
(= ) (= ).

.
SFC81 "UBLKMOV", ,
:
: FB, SFB, FC, SFC, OB, SDB


/

( UNLINKED)!

CPU SFC83,
, .
SFC20,
W#16#8092.

DB10. DBW10

DB10. DBW8

DB10. DBW6

DB10. DBW4

MW16

MW14

MW12

MW10

S7-300 S7-400
A5E00261410-01

3-5

,
. , ,
SFC81 "UBLKMOV", CPU
.

SRCBLK

INPUT

ANY

I, Q, M, D, L

RET_VAL

OUTPUT

INT

I, Q, M, D, L

DSTBLK

OUTPUT

ANY

I, Q, M, D, L


( ). STRING
.

,
.
,
(
). STRING
.

.
, ,
,
.
, ,
,
.
ANY ( ) BOOL,
8; SFC .
ANY STRING,
1.


(W#16#...)
0000
8091
8092

3-6



"Copy Variable" ( )
, .
SFC83.

S7-300 S7-400
A5E00261410-01

3.3 SFC21
"FILL"

SFC 21 FILL
( ) (
). SFC ,
.

.
, ,
BVAL, , ,
.
, , ,
, ,
.

FILL
A B

BVAL

A B

MW100

C D

MW102

MW18

E F

MW104

MW20

G H

MW106

A B

MW108

C D

MW110

E F

MW112

G H
A B

MW114
MW116

C D

MW118

C D

MW14
MW16

E F
G H

BLK

: MW100 MW118
MW14 MW20.

SFC 21 :
: FB, SFB, FC, SFC, SDB,
,
,
/.

S7-300 S7-400
A5E00261410-01

3-7

BVAL

INPUT

ANY

I, Q, M, D, L

RET_VAL

OUTPUT

INT

I, Q, M, D, L

BLK

OUTPUT

ANY

I, Q, M, D, L

BVAL
,

( ).
,
STRING, .

,
.
BLK
,
( ). ,
STRING, .


,
: STEP 7
.
,
.

:
TYP_5_BYTE_STRUCTURE : STRUCT
BYTE_1_2 : WORD
BYTE_3_4 : WORD
BYTE_5 : BYTE
END_STRUCT
"TYP_5_BYTE_STRUCTURE" 6 .

3-8

S7-300 S7-400
A5E00261410-01

3.4 SFC22 "CREAT_DB"

SFC22 "CREAT_DB" (create data block [ ]),


,
. SFC ,
. SFC DB
. DB
, ,
. ,
DB .
DB .


SFC22 "CREAT_DB" OB.
SFC22 "CREAT_DB" OB ,
W#16#8091.

LOW_LIMIT

INPUT

WORD

I, Q, M, D, L,

UP_LIMIT

INPUT

WORD

I, Q, M, D, L,

COUNT

INPUT

WORD

I, Q, M, D, L,

RET_VAL

OUTPUT

INT

I, Q, M, D, L

DB_NUMBER

OUTPUT

WORD

I, Q, M, D, L

S7-300 S7-400
A5E00261410-01



,
.


,

.

,

.

( 65534).

,
.

.
( 15
RET_VAL ),
DB_NUMBER 0.

3-9


(W#16#...)
0000
8091
8092

80A1

80A2

80B1
80B2
80B3

3-10

.
SFC22.
" DB" ,
:
" "
"
"
CPU .
WinAC Software CPU
, WinAC.
DB:
0.
DB CPU.
lower limit [ ] > upper limit [ ].
DB:
0.
.
, CPU.
DB.
.
(: !)

S7-300 S7-400
A5E00261410-01

3.5 SFC23 "DEL_DB"

SFC 23 DEL_DB (delete data block) ,


, , , CPU.
DB , -
, ,
DB, -. CPU
SFC 23 STOP.
, DB
SFC23 "DEL-DB".
...
DB SFC22 "CREAT_DB",
DB CPU STEP 7
UNLINKED,
DB -,

...
SFC23 .
SFC23 .
SFC23 .


SFC23 "DEL_DB" .
SFC ,
RET_VAL W#16#8091.

DB_NUMBER

INPUT

WORD

RET_VAL

OUTPUT

INT


I, Q, M, D, L,

I, Q, M, D, L

DB



(W#16#...)
0000
8091
8092

.
SFC23 ,
CPU.
DB ,
" "

"
".
" (upload)" DB,

CPU .
WinAC Software CPU

, WinAC.

S7-300 S7-400
A5E00261410-01

3-11

80A1

80B1
80B2
80B3
80B4
80C1

3-12

DB_NUMBER:

, DB
CPU.
DB CPU .
DB UNLINKED.
DB -.
DB , F-.
DB "Delete DB"
- .

S7-300 S7-400
A5E00261410-01

3.6 SFC24
"TEST_DB"

SFC24 "TEST_DB" (test data block [ ])


,
CPU. SFC
DB , DB .

DB_NUMBER

INPUT

WORD

I, Q, M, D, L,

DB

RET_VAL
DB_LENGTH

OUTPUT
OUTPUT

INT
WORD

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

BOOL

I, Q, M, D, L


,
DB.

DB (1 ,
).

WRITE_PROT OUTPUT


(W#16#...)
0000
80A1

80B1
80B2

.
DB_NUMBER:

0
, DB
CPU.
DB CPU .
DB UNLINKED.

S7-300 S7-400
A5E00261410-01

3-13

3.7 SFC25
"COMPRESS"

,
.
.

SFC 25 COMPRESS
, . ,
RUNP (
).
, SFC25
.

, 1000 ,
SFC25 "COMPRESS". ,
.

RET_VAL
BUSY

OUTPUT
OUTPUT

INT
BOOL

DONE

OUTPUT

BOOL

3-14

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

I, Q, M, D, L


,
, SFC25.
(1 , )
,
,
SFC 25 (1
).

S7-300 S7-400
A5E00261410-01


SFC 25 COMPRESS ;
, .
,
:
SFC25 .
RET_VAL. 0,
BUSY DONE. BUSY = 1, DONE = 0, ,
. BUSY 0, DONE - 1,
, .
SFC 25, .



(W#16#...)

0000

. SFC 25.

BUSY DONE (. ).
.

,
"
"

(, )
" ".
CPU .

8091
8092

S7-300 S7-400
A5E00261410-01

3-15

3.8 1
SFC44 "REPL_VAL"

SFC44 "REPL_VAL" (replace value [ ])


1 , .

: OB
SFC 44 REPL_VAL OB
(OB121, OB122).


,
,
OB122. 122 SFC44 "REPL_VAL" 1
,
.
, (, ,
, ),
OB122.

VAL

INPUT

DWORD

RET_VAL

OUTPUT

INT

I, Q, M, D, L,

I, Q, M, D, L



,
.


(W#16#....)
0000
8080

3-16

. .
SFC44 (OB121,
OB122).

S7-300 S7-400
A5E00261410-01

3.9
SFC82 "CREA_DBL"

SFC82 "CREA_DBL" (create date block in load memory [


DB ])
(Memory Card ). SFC82 DB
, , .
SFC82 .
DB

. DB.
/
, .

SFC24 "TEST_DB" ,
DB .
, SRCBLK
DB. DB
BLOCK_DB DB. ,
() , SFC 82.
SFC 82 DB
READ_ONLY.
SFC 82 .


SFC82 "CREA_DBL" , ..
. SFC82
REQ =1.

RET_VAL BUSY.
REQ,
RET_VAL BUSY.

S7-300 S7-400
A5E00261410-01

3-17

BOOL

I, Q, M, D, L

LOW_LIMIT INPUT

WORD

I, Q, M, D, L

UP_LIMIT

INPUT

WORD

I, Q, M, D, L

COUNT

INPUT

WORD

I, Q, M, D, L

ATTRIB

INPUT

BYTE

I, Q, M, D, L

REQ

INPUT

REQ = 1:



DB


DB

,
DB.
.
DB:
UNLINKED: ():
DB
.
1 = 1: READ_ONLY: ( ):
DB .
2 = 1: NON_RETAIN:
():
DB .
3 7:
,
DB

0 = 1:

SRCBLK

INPUT

ANY

RET_VAL

OUTPUT

INT

I, Q, M, D, L

BUSY

OUTPUT

BOOL

I, Q, M, D, L

DB_NUM

OUTPUT

WORD

I, Q, M, D, L

BUSY = 1: ( ):

DB


(W#16#....)
0000
0081

7000
7001
7002

3-18


() ().
.
.
REQ=0: ;
BUSY 0.
REQ=1: ;
BUSY 1.
(REQ ):
; BUSY 1.

S7-300 S7-400
A5E00261410-01

8081

8091
8092

8093
8094
80A1

80A2

80B1
80B2
80B3
80BB
80C0
80C3
8xyy

() ().
.
.
SFC82
DB , ..:

H CPU
Windows NT ( )
SCRBLK
( )
,
ATTRIB
DB:
0

DB:
0

CPU
DB

( )


SFC

, :
DB
DB

S7-300 S7-400
A5E00261410-01

3-19

3.10
SFC83 "READ_DBL"

SFC83 "READ_DBL" (read date block in load memory [ DB


]) DB BLOCK_DB
DB (Memory Card )
DB (DB ). DB
( UNLINKED = 0). ,
(
UNLINKED = 1).
.

SFC83.
SRCBLK DSTBLK :
ANY BOOL 8.
ANY STRING,
1.

SFC24 "TEST_DB".

SFC83 ,
.

, SFC83
,
.

SFC83 , ..
.
SFC83 REQ =1.

RET_VAL BUSY.
REQ,
RET_VAL BUSY.

3-20

S7-300 S7-400
A5E00261410-01

REQ

INPUT

BOOL

I, Q, M, D, L

SRCBLK

INPUT

ANY

RET_VAL

OUTPUT

INT

I, Q, M, D, L

BUSY

OUTPUT

BOOL

I, Q, M, D, L

DSTBLK

OUTPUT

ANY

REQ = 1:
DB
,


BUSY = 1: ( ):


DB


(W#16#....)
0000
8081

7000
7001
7002
0081

80C0
8093
80B1
80B4
80C3
8xyy


() ().
.
.
REQ=0: ;
BUSY 0.
REQ=1: ;
BUSY 1.
(REQ ):
; BUSY 1.
() ().
.
.

SFC
SCRBLK
( )
DSTBLK
( )
DB c F-

S7-300 S7-400
A5E00261410-01

3-21

3.11
SFC84 "WRITE_DBL"

SFC84 "WRITE_DBL" (write date block in load memory [ DB


]) DB DB
BLOCK_DB DB (Memory Card
). DB ( DSTBLK)
. ,
, BLOCK_DB DB-
, , DB ( SRCBLK)
(), .. UNLINKED = 0.
, DB
SCF22 "CREAT_DB".

SFC84.
SRCBLK DSTBLK :
ANY BOOL 8.
ANY STRING,
1.

SFC24 "TEST_DB".
DB

SFC84 ,
.
, , .

SFC84 "WRITE_DBL" , ..
.
SFC83 REQ =1.

RET_VAL BUSY.
REQ,
RET_VAL BUSY.

3-22

S7-300 S7-400
A5E00261410-01

REQ

INPUT

BOOL

I, Q, M, D, L

SRCBLK

INPUT

ANY

RET_VAL

OUTPUT

INT

I, Q, M, D, L

BUSY

OUTPUT

BOOL

I, Q, M, D, L

DSTBLK

OUTPUT

ANY

REQ = 1:
DB,


BUSY = 1: ( ):


DB


(W#16#....)

0000

8081

() ().
.
.
REQ=0: ;
BUSY 0.
REQ=1: ;
BUSY 1.
(REQ ):
; BUSY 1.
() ().
.
.

SFC
Windows NT ( )

7000
7001
7002
0081

80C0
8092
8093
80B1
80B4

SCRBLK
( )
DSTBLK
( )
DB c F-

80C3

8xyy

S7-300 S7-400
A5E00261410-01

3-23

3.12 SFC85 "CREA_DB"

SFC85 "CREA_DB" ( )

. DB . SFC
.
SFC DB.
DB ,
.
DB,
. DB .
ATTRIB DB
RETAIN NON_RETAIN:
RETAIN , DB
(work memory). , DB
/
("" - "warm").
NON_RETAIN , DB
(work memory). , DB
/
("" - "warm") .
(work memory), ,
ATTRIB . , DB
/
("").

3-24

S7-300 S7-400
A5E00261410-01


SFC85 "CREA_DB" OB
. SFC85 "CREA_DB" OB
,
W#16#8091.

LOW_LIMIT

INPUT

WORD

I, Q, M, D, L

-

,

UP_LIMIT

INPUT

WORD

I, Q, M, D, L

-

,

COUNT

INPUT

WORD

I, Q, M, D, L


,
.

( 65534).

ATTRIB

INPUT

BYTE

I, Q, M, D, L

DB:

B#16#00: RETAIN
( )

B#16#04: NON_ RETAIN


( )

RET_VAL

OUTPUT

INT

I, Q, M, D, L


,

.

DB_NUMBER

OUTPUT

WORD

I, Q, M, D, L

-
.
( 15 RET_VAL
) DB_NUMBER
0.

S7-300 S7-400
A5E00261410-01

3-25



(W#16#...)

0000

8091

SFC85.

8092

SFC85 "CREA_DB" , :

"Compress User
Memory"

, WinAC.

8094

ATTRIB

80A1

DB:

80A2

, CPU DB

DB:

CPU

80B1

DB.

80B2

80B3

( ""
- compress).

8xyy

, .
RET_VAL

3-26

S7-300 S7-400
A5E00261410-01