PGH_FC-FB-S7CP_76
PGH_FC-FB-S7CP_76
PGH_FC-FB-S7CP_76
Preface
A
___________________
Document history
B
___________________
References
11/2015
C79000-G8976-C229-08
Legal information
Warning notice system
This manual contains notices you have to observe in order to ensure your personal safety, as well as to prevent
damage to property. The notices referring to your personal safety are highlighted in the manual by a safety alert
symbol, notices referring only to property damage have no safety alert symbol. These notices shown below are
graded according to the degree of danger.
DANGER
indicates that death or severe personal injury will result if proper precautions are not taken.
WARNING
indicates that death or severe personal injury may result if proper precautions are not taken.
CAUTION
indicates that minor personal injury can result if proper precautions are not taken.
NOTICE
indicates that property damage can result if proper precautions are not taken.
If more than one degree of danger is present, the warning notice representing the highest degree of danger will
be used. A notice warning of injury to persons with a safety alert symbol may also include a warning relating to
property damage.
Qualified Personnel
The product/system described in this documentation may be operated only by personnel qualified for the specific
task in accordance with the relevant documentation, in particular its warning notices and safety instructions.
Qualified personnel are those who, based on their training and experience, are capable of identifying risks and
avoiding potential hazards when working with these products/systems.
Proper use of Siemens products
Note the following:
WARNING
Siemens products may only be used for the applications described in the catalog and in the relevant technical
documentation. If products and components from other manufacturers are used, these must be recommended
or approved by Siemens. Proper transport, storage, installation, assembly, commissioning, operation and
maintenance are required to ensure that the products operate safely and without any problems. The permissible
ambient conditions must be complied with. The information in the relevant documentation must be observed.
Trademarks
All names identified by ® are registered trademarks of Siemens AG. The remaining trademarks in this publication
may be trademarks whose use by third parties for their own purposes could violate the rights of the owner.
Disclaimer of Liability
We have reviewed the contents of this publication to ensure consistency with the hardware and software
described. Since variance cannot be precluded entirely, we cannot guarantee full consistency. However, the
information in this publication is reviewed regularly and any necessary corrections are included in subsequent
editions.
Note
STEP 7 - synonymous names
The term STEP 7 is used in later sections of this manual as a synonym for STEP 7 V5.5
or STEP 7 Professional
Note
CP types and communications services
Note that the program blocks each support certain communications services. Their use is
therefore linked to the use of the CP types that support the particular communications
service.
Note
Component of the products STEP 7 / STEP 7 Professional
The contents of the libraries supplied with STEP 7 V5.5 and STEP 7 Professional may
differ from each other.
The program block overviews in this manual specify the availability for the various device
families S7-300 and S7-400. The overviews do not, provide information about the
availability in the various libraries of STEP 7 V5.5 or STEP 7 Professional.
You will find the changes to the previous manual information in the section Document history
(Page 277).
Preface ................................................................................................................................................... 3
1 Overview and general information on handling ...................................................................................... 13
1.1 Program blocks for Industrial Ethernet / PROFINET ..............................................................13
1.2 Program blocks for PROFIBUS ..............................................................................................15
1.3 Parameters for calling the program blocks .............................................................................17
1.4 Parameters for CP and connection assignment (input parameters) ......................................18
1.5 Parameters for specifying a CPU data area (input parameters).............................................19
1.6 Status information (output parameters) ..................................................................................19
2 Program blocks for Industrial Ethernet ................................................................................................... 21
2.1 Program blocks for open communications services (SEND/RECEIVE interface) ..................21
2.1.1 Overview of program blocks and their use .............................................................................21
2.1.2 AG_SEND / AG_LSEND / AG_SSEND ..................................................................................25
2.1.2.1 Meaning and call - AG_SEND / AG_LSEND / AG_SSEND ....................................................25
2.1.2.2 How AG_SEND / AG_LSEND / AG_SSEND work .................................................................26
2.1.2.3 Explanation of the formal parameters - AG_SEND / AG_LSEND / AG_SSEND ....................29
2.1.2.4 AG_SEND, AG_LSEND and AG_SSEND status codes .........................................................30
2.1.3 AG_RECV / AG_LRECV / AG_SRECV ..................................................................................32
2.1.3.1 Meaning and call - AG_RECV / AG_LRECV / AG_SRECV ....................................................32
2.1.3.2 How AG_RECV / AG_LRECV / AG_SRECV work .................................................................33
2.1.3.3 Explanation of the formal parameters - AG_RECV / AG_LRECV / AG_SRECV ....................38
2.1.3.4 AG_RECV, AG_LRECV and AG_SRECV condition codes ....................................................39
2.2 Program blocks for access coordination with FETCH/WRITE................................................41
2.2.1 Overview of program blocks and their use .............................................................................41
2.2.2 AG_LOCK ...............................................................................................................................43
2.2.2.1 Meaning and call - AG_LOCK .................................................................................................43
2.2.2.2 Explanation of the formal parameters - AG_LOCK .................................................................44
2.2.2.3 Condition codes of AG_LOCK ................................................................................................44
2.2.3 AG_UNLOCK ..........................................................................................................................45
2.2.3.1 Meaning and call - AG_UNLOCK ...........................................................................................45
2.2.3.2 Explanation of the formal parameters - AG_UNLOCK ...........................................................46
2.2.3.3 Condition codes of AG_UNLOCK ...........................................................................................46
2.3 Program blocks for connection and system diagnostics .........................................................47
2.3.1 AG_CNTRL .............................................................................................................................47
2.3.1.1 Meaning and call - AG_CNTRL ..............................................................................................47
2.3.1.2 How AG_CNTRL works ..........................................................................................................49
2.3.1.3 Explanation of the formal parameters - AG_CNTRL ..............................................................50
2.3.1.4 AG_CNTRL codes ..................................................................................................................51
2.3.1.5 Commands and job results - AG_CNTRL ...............................................................................52
2.3.2 AG_CNTEX .............................................................................................................................58
2.3.2.1 Meaning and call - AG_CNTEX ..............................................................................................58
2.3.2.2 How AG_CNTEX works ..........................................................................................................60
5.3 Configuration limits / resources required for the program blocks (PROFIBUS) ...................253
6 Program blocks for PROFIBUS FMS ................................................................................................... 255
6.1 Overview of uses ..................................................................................................................255
6.2 FMS block parameters ..........................................................................................................256
6.3 IDENTIFY ..............................................................................................................................259
6.3.1 Meaning and call - IDENTIFY ...............................................................................................259
6.3.2 How IDENTIFY works ...........................................................................................................260
6.4 READ ....................................................................................................................................261
6.4.1 Meaning and call - READ .....................................................................................................261
6.4.2 How READ works .................................................................................................................262
6.5 REPORT ...............................................................................................................................263
6.5.1 Meaning and call - REPORT ................................................................................................263
6.5.2 How REPORT works ............................................................................................................264
6.6 STATUS ................................................................................................................................265
6.6.1 Meaning and call - STATUS .................................................................................................265
6.6.2 How STATUS works .............................................................................................................267
6.7 WRITE...................................................................................................................................268
6.7.1 Meaning and call - WRITE ....................................................................................................268
6.7.2 How WRITE works ................................................................................................................269
6.8 Condition codes and error messages - FMS blocks .............................................................270
6.8.1 Error detected locally ............................................................................................................271
6.8.2 Errors detected by FMS partner ...........................................................................................274
6.9 Quantity framework / resource requirements of FBs (PROFIBUS FMS) .............................276
A Document history ................................................................................................................................ 277
B References ......................................................................................................................................... 281
B.1 On configuring, commissioning and using the CP ................................................................281
B.2 On programming ...................................................................................................................282
Index................................................................................................................................................... 283
Note
Component of the products STEP 7 / STEP 7 Professional
The contents of the libraries supplied with STEP 7 V5.5 and STEP 7 Professional may differ
from each other.
The following list shows the block numbers as they are supplied.
Under SIMATIC_NET_CP, you can also see which folders contain blocks. Please note that
you must use different program blocks for the S7300 and S7400 (separate libraries).
Legend:
1) FB88/FB90 is supplied along with the engineering tool SIMATIC iMap and is entered in the PROFINET system library
when you install the STEP 7 addon.
2) Not to be used with the current CPs and no longer part of the current "SIMATIC_NET_CP" library.
3) Depending on the CP type
4) Described in the STEP 7 documentation
5) You will find the description of the program block PE_DS3_Write_ET200S_CP for STEP 7 Professional later in this
document with the description of the program block DS3_WRITE_CP for STEP 7 V5.5 that has the same functionality.
Note
We recommend that you always use the latest block versions for all module types.
You will find information on the current block versions and the current blocks to download
from the Internet in Siemens Industry Online Support at the following address:
Link: (https://support.industry.siemens.com/cs/ww/en/view/8797900)
This recommendation assumes that you are using the latest firmware for the particular
module type.
Note
Remember that if you replace a module, you must only use the blocks permitted for the
configured CP type in the user program.
We recommend that you always use the latest block versions for all module types.
This recommendation assumes that you are using the latest firmware for the particular
module type.
The specific manuals contain information on the compatibility of the S7-CPs and the
corresponding program blocks.
Note
Component of the products STEP 7 / STEP 7 Professional
The contents of the libraries supplied with STEP 7 V5.5 and STEP 7 Professional may differ
from each other.
The following list shows the block numbers as they are supplied.
Under SIMATIC_NET_CP, you can also see which folders contain blocks. Please note that
you must use different program blocks for the S7300 and S7400 (separate libraries).
BRCV FB13 x 1)
PUT FB15 x 1)
GET FB14 x 1)
USEND FB8 x 1)
URCV FB9 x 1)
C_CNTRL FC62 x 1)
1) Described in the STEP 7 documentation. Accordingly, SFBs to be used for the S7-400 are available in the STEP 7 li-
brary.
2) Can be used but has no special function with PROFIBUS.
Note
We recommend that you always use the latest block versions for all module types.
You will find information on the current block versions and the current blocks to download
from the Internet in Customer Support under entry ID:
Link: (https://support.industry.siemens.com/cs/ww/en/view/8797900)
This recommendation assumes that you are using the latest firmware for the particular
module type.
Note
Remember that if you replace a module, you must only use the blocks permitted for the
configured CP type in the user program.
We recommend that you always use the latest block versions for all module types.
This recommendation assumes that you are using the latest firmware for the particular
module type.
The manuals contain information on the compatibility of the S7-CPs and the corresponding
program blocks.
NOTICE
Calling communication blocks for an S7300
The communication blocks for S7-300 (SIMATIC NET block libraries for S7300 in STEP
7) must not be called in more than one priority class! If, for example, you call a
communication block in OB1 and in OB35, block execution could be interrupted by the
higherpriority OB.
If you call blocks in more than one OB, you must write your program so that a
communication block that is currently executing cannot be interrupted by another
communication block (for example by disabling/enabling SFC interrupts).
Note
If you inadvertently address not a CP but another module type, errors occur that cannot be
indicated by the error messages of the program blocks themselves.
Note
Remember that the status codes DONE, NDR, ERROR, STATUS are updated at each
block call.
Overview
The following program blocks are available for transferring data on the SEND/RECEIVE
interface:
Further information
Please check the supported data area for the S7-CP you are using in the manual for the
specific device. You will find an overview of the versions of the FCs/FBs in the SIMATIC NET
block history.
Application
The following diagram illustrates the use of the program blocks described here for bi-
directional data transfer on a configured connection.
Note
Unless specifically stated otherwise, the information on this and the following pages refers to
the AG_SEND / AG_LSEND / AG_SSEND or AG_RECV / AG_LRECV / AG_SRECV blocks.
Sample programs
Please note that the following sample programs are also available on the Internet under the
following entry ID
● Sample program for the SEND/RECEIVE interface with the blocks FC5 (AG_SEND) and
FC6 (AG_RECV) for S7-300:
17853532 (https://support.industry.siemens.com/cs/ww/en/view/17853532)
● Sample program for the SEND/RECEIVE interface with the functions FC50 (AG_LSEND)
and FC60 (AG_LRECV) for S7-400:
18513371 (https://support.industry.siemens.com/cs/ww/en/view/18513371)
Note
For information on the length of the data area you can transfer with older versions of the
Ethernet CPs, refer to the product information / manual of the Ethernet CP you are using.
Image 2-1 Sending and receiving on a free UDP connection with programmed addresses
Note
Once the job has been triggered, you can only change the call parameters of the call
interface of the AG_SEND or AG_RECV program blocks after the FC has confirmed
completion of the job with DONE=1 or with ERROR=1.
If you do not keep to this rule, it is possible that the job will be aborted with an error.
Status display on the FC call interface; Special case with FC versions (only for S7-300) *)
With the FCs AG_SEND (FC5) and AG_RECV (FC6), you will receive the codes shown
below in the following situations:
● CP is in STOP;
● Connection is not configured;
Call interface
Call interface in FBD representation
STL Explanation
call fc 5 ( //Block call
ACT := M 10.0, //Job triggered by memory bit
ID := MW 12, //Connection ID acc. to configuration
LADDR := W#16#0100, //=LADDR 256 dec. in HW Config
SEND := P#db99.dbx10.0 byte 240, //Buffer with send data
LEN := MW 14, //Length for send data
DONE := M 10.1, //Execution code
ERROR := M 10.2, //Error code
STATUS := MW 16 ); //Status code
Note
If you want to use FC53 AG_SSEND, you will need to select the "SPEED SEND/RECV"
mode in the connection properties during configuration of the connection.
How It works
The following diagrams illustrate the normal sequence of data transmission triggered in the
user program using AG_SEND.
The way in which the FC functions depends on the CP type you are using.
● Case 1: Sequence with FC5, FC50, FC53 in S7-400 CPs
In the S7–400, the transfer of the entire data area regardless of its length is handled by
the CP after the first block call.
● Case 2: Sequence with FC5 in S7–300 CPs
In the S7-300, the transfer takes place several data segments (each with 240 bytes of
user data) and requires several FC calls to transfer the entire data.
Note
In principle, it is possible to call the FC more than once within the CPU cycle to speed up the
handling of the job. Do not forget, however, that this increases the load during the CPU cycle
(the load differs depending on the CPU type)!
Condition codes
The following table shows the condition codes formed based on DONE, ERROR and
STATUS that must be evaluated by the user program.
Note
For entries coded with 8FxxH in STATUS, refer to the information about the output
parameter RET_VAL in the descriptions of the referenced system program blocks.
Which system program blocks are used and are relevant for error evaluation, can be queried
in STEP 7.
See also
/5/ (Page 282)
Call
Call interface in FBD representation
STL Explanations
call fc 6 ( //Block call
ID := MW 40, //Connection ID acc. to configuration
LADDR := W#16#0100, //=LADDR 256 dec. in HW Config
RECV := P#M 0.0 BYTE 100, //Buffer for received data
NDR := DB 110.DBX 0.6, //Receive code
ERROR := DB 110.DBX 0.7, //Error code
STATUS := DB 110.DBW 2, //Status code
LEN := DB 110.DBW 4 ); //Received data length
Note
If you want to use FC63 AG_SRECV, you will need to select the "SPEED SEND/RECV"
mode in the connection properties during configuration of the connection.
How It works
The following diagrams illustrate the normal sequence of data acceptance triggered by an
AG_RECV in the user program.
Each AG_RECV job in the user program is acknowledged by the Ethernet CP with an entry
in the output parameters NDR, ERROR and STATUS.
The way in which the FC functions depends on the CP type you are using and the
connection types.
● Case 1: Sequence with FC6 in S7-300 CPs
With the newer CP types, optimized data transfer on the SEND/RECEIVE interface is
available. In particular with longer data records, this allows a much higher data
throughput on the interface between the CPU and CP.
● Case 2: Sequence with FC6 and FC60 in S7-400 CPs
With FC6 / FC60 AG_RECV, the response on the S7-400 depends on the protocol used.
– Case 2a: Sequence with ISO transport, ISO-on-TCP, UDP connections
Wit these connection types, the transfer is handled by the CP with one or more FC6
/FC60 calls depending on the length of the data area.
– Case 2b: Sequence with TCP connections
On a TCP connection, the length specified in the ANY pointer of the RECV parameter
is the deciding factor. An FC6 /FC60 job is completed with the condition code NDR=1,
as soon as an amount of data corresponding to the specified length has been written
to the receive buffer.
● Case 3: Sequence with FC63 in S7-400 CPs
With FC63 AG_SRECV, the response on the S7-400 depends on the protocol used.
– Case 3a: Sequence with ISO transport, ISO-on-TCP, UDP connections
With these connection types, the transfer of the entire data area regardless of its
length is started by the CP after the first block call.
– Case 3b: Sequence with TCP connections
On a TCP connection, the data on the CP is accepted up to the maximum specified
job length with every call.
The call must be repeated until a data record has been entered completely and
consistently in the receive buffer. The reception of the completed data record is
indicated in one of the later FC calls with the parameter NDR=1.
Depending on the length of the user data, the FC must be called repeatedly until the
complete transfer is indicated by parameter NDR=1.
The status code in the output parameters NDR, ERROR and STATUS is updated in each
block call and can be evaluated.
Case 2a: Sequence with FC6 and FC60 in S7-400 CPs (with ISO transport, ISO-on-TCP, UDP
connections)
When the FC is called, the user program prepares the buffer to receive data and instructs
the CP to enter all available data there.
As soon as a data record has been entered fully and consistently in the receive buffer, this is
indicated by the parameter NDR=1 in one of the next FC calls.
The status code in the output parameters NDR, ERROR and STATUS is updated in each
block call and can be evaluated.
Case 2b: Sequence with FC6 / FC60 in S7-400 CPs (only for TCP connections)
On a TCP connection, the length specified in the ANY pointer of the RECV parameter is the
deciding factor. An FC6 /FC60 job is completed with the condition code NDR=1, as soon as
an amount of data corresponding to the specified length has been written to the receive
buffer.
The sequence example shows a situation in which the length in the ANY pointer was set to
400 bytes for an FC60.
Case 3a: Sequence with FC63 in S7-400 CPs (with ISO transport, ISO-on-TCP, UDP connections)
When the FC is called, the user program prepares the buffer for the received data and
instructs the CP to enter all data until the end of the transfer there; in other words, when the
length specified in the ANY pointer is reached.
As soon as the data record has been entered fully and consistently in the receive buffer, this
is indicated by the parameter NDR=1 in one of the next FC calls.
The maximum length for received data is 1452 bytes. The size of the receive buffer must
always be set to this value.
The status code in the output parameters NDR, ERROR and STATUS is updated in each
block call and can be evaluated.
Case 3b: Sequence with FC63 in S7-400 CPs (only for TCP connections)
When the FC is called, the user program prepares the buffer to receive data and instructs
the CP to enter the currently available data there. Until the data has been completely entered
in the receive buffer, the message "Job active" (8181H) is sent.
With each new FC call, the currently available data is entered in the receive buffer. When the
data record has been entered fully and consistently in the receive buffer, this is indicated by
the parameter NDR=1 in one of the next FC calls.
The maximum length for received data is 1452 bytes. The size of the receive buffer must
always be set to this value.
The status code in the output parameters NDR, ERROR and STATUS is updated in each
block call and can be evaluated.
Condition codes
The following table shows the codes formed by the NDR, ERROR and STATUS parameters
that must be evaluated by the user program.
Note
For entries coded with 8FxxH in STATUS, refer to the information about the output
parameter RET_VAL in the descriptions of the referenced system program blocks.
Which system program blocks are used and are relevant for error evaluation, can be queried
in STEP 7.
See also
/5/ (Page 282)
Overview
The following program blocks are available for the FETCH/WRITE function to coordinate
access:
How It works
With these program blocks, you can coordinate access to system memory areas so that no
inconsistent data is created and transferred. The control is from the user program in the S7
CPU that can, if necessary, disable an external FETCH/WRITE access using an AG_LOCK
call. After a certain time or after the local write/read access is completed, an AG_UNLOCK
job can be used to enable external access again.
Another advantage is that this access lock only applies to the FETCH/WRITE connection
specified in the call. If more than one FETCH/WRITE connection is configured, these can, for
example, be used for certain specific system areas and a selective access coordination can
be implemented.
The following diagram illustrates the usual chronological sequence of memory access
coordination controlled in the user program with AG_LOCK and AG_UNLOCK.
The lock job must first be monitored in the user program using the code in the return
parameter LOCKED. As long as LOCKED=0 is indicated, it must be assumed that there is
still an external FETCH/WRITE access active.
If LOCKED=1 is indicated, this shows that the lock is active; data can now be modified by the
user program.
The status code is updated at each block call.
2.2.2 AG_LOCK
Call
Call interface in FBD representation
STL Explanation
call fc 7 ( //Block call
ID := DB 100.DBW 2, //Connection ID acc. to configuration
LADDR := W#16#0100, //=LADDR 256 dec. in HW Config
LOCKED := DB 100.DBX 0.6, //Status code of access lock
STATUS := DB 100.DBW 4 ); //Status code
Condition codes
The following table shows the STATUS code that must be evaluated by the user program.
STATUS Meaning
7000H CP is not processing a job
7001H FETCH active
7002H WRITE active
8183H FETCH/WRITE not configured for this connection (S7-400 only)
8186H ID number not in permitted range (e.g. 1...64 for S7-400 Industrial Ethernet CPs)
80A4H The communication bus connection between the CPU and CP is not established (with newer CPU versions)
80B0H The module does not recognize the data record.
80B1H The specified length (in the LEN parameter) is incorrect.
80B2H The communication bus connection between the CPU and CP is not established.
80C0H The data record cannot be read.
80C1H The specified data record is currently being processed.
80C2H There are too many jobs pending.
80C3H CPU resources (memory) occupied.
80C4H Communications error
occurs temporarily and a repetition in the user program will often remedy the problem.
80D2H Module start address incorrect.
2.2.3 AG_UNLOCK
Call
Call interface in FBD representation
STL Explanation
call fc 8 ( //Block call
ID := DB 100.DBW 2, //Connection ID acc. to configuration
LADDR := W#16#0100, //=LADDR 256 dec. in HW Config
STATUS := DB 100.DBW 4 ); //Status code
How it works
To release the connection again, the FC must clear the LOCK request bit again. The FC also
shows the current status using error messages.
Condition codes
The following table shows the STATUS code that must be evaluated by the user program.
STATUS Meaning
7000H CP is not processing a job
7001H FETCH active
7002H WRITE active
8183H FETCH/WRITE not configured for this connection (S7-400 only)
8186H ID number not in permitted range (e.g. 1...64 for S7-400 Industrial Ethernet CPs)
80A4H The communication bus connection between the CPU and CP is not established (with newer CPU versions)
80B0H The module does not recognize the data record.
80B1H The specified length (in the LEN parameter) is incorrect.
80B2H The communication bus connection between the CPU and CP is not established.
80C0H The data record cannot be read.
80C1H The specified data record is currently being processed.
80C2H There are too many jobs pending.
80C3H CPU resources (memory) occupied.
80C4H Communications error
occurs temporarily and a repetition in the user program will often remedy the problem
80D2H Module start address incorrect.
2.3.1 AG_CNTRL
How It works
With the AG_CNTRL program block, you can diagnose connections. When necessary, you
can initialize connection establishment again using AG_CNTRL.
Note
AG_CNTRL and AG_CNTEX
The AG_CNTEX program block provides expanded functionality compared with the
AG_CNTRL program block.
All the functions of AG_CNTRL are included in AG_CNTEX and they can be used identically
in the user program.
Call interface
Call interface in FBD representation
STL Explanation
call fc 10 ( //AG_CNTRL block call
ACT := M1.0, //Job trigger
ID := MW8, //Connection ID acc. to configuration
LADDR := W#16#100, //Module address acc. to HW Config
CMD := MW6, //Command ID
DONE := M20.1, //Execution code
ERROR := M20.2, //Error code
STATUS := MW22, //Status code
RESULT1 := MD24, //Job result 1
RESULT2 := MD28 ); //Job result 2
See also
FAQ under entry ID 33414377
(https://support.industry.siemens.com/cs/ww/en/view/33414377)
Operating principle
The following diagram shows a typical sequence of AG_CNTRL jobs in the user program.
The diagram shows how the connection status is initially queried and then, in a second job,
how the connection termination is triggered with the reset command.
The reset ID (bit 15 in RESULT1) is set on the CP. If there is a status query later, it is
therefore clearly recognizable whether the connection has been reset due to a reset job. The
reset ID is cleared on the CP only after this status query (or as a result of an explicit
CN_CLEAR_RESET command)
Note
The block must be called with ACT = 1; if it is called with ACT=0, there is no function call and
the block is exited again immediately.
Since the job result of FC10 is obtained synchronous to the call, it can be called again in the
same cycle.
Condition codes
The following table shows the condition codes formed based on DONE, ERROR and
STATUS that must be evaluated by the user program.
The command results in the RESULT1/2 parameters must also be evaluated according to
"Commands and job results - AG_CNTRL (Page 52) ".
Note
Command evaluation with older CP types or firmware versions
The commands described below are supported by the current CP types or firmware
versions. You should also check the more detailed information under the following entry ID:
33414377 (https://support.industry.siemens.com/cs/ww/en/view/33414377)
CMD Meaning
0 NOP – no operation
The block executes without a job being sent to the CP.
RESULT (for CMD = 0) Meaning
Parameter Hex value/range
RESULT1 0000 0001H Executed without error
RESULT2 0000 0000H Default
CMD Meaning
1 CN_STATUS – connection status
This command returns the status of the connection selected with the ID.
The CP is selected in the LADDR parameter.
If bit 15 (reset ID) is set, this is automatically reset (this action corresponds to the CN_CLEAR_RESET job -
see CMD = 5).
RESULT (for CMD = 1) Value / meaning
Parameter Hex value/range Bit
RESULT1 0000 000*H Bits 0-3: Codes for the send direction
(excluded values: 0x2)
Bit 0 Connection type
• 0: no send and receive connection
• 1: Connection reserved for send and receive jobs
Bit 1 Status of current job
• 0: No send job being executed
• 1: Send job being executed
Bits 2+3 Previous job:
• 00: No information available on previous send job
• 01: previous send job completed successfully
• 10: previous send job not completed successfully
CMD Meaning
1 CN_STATUS – connection status (CMD=1 continued)
This command returns the status of the connection selected with the ID.
The CP is selected in the LADDR parameter.
If bit 15 (reset ID) is set, this is automatically reset (this action corresponds to the CN_CLEAR_RESET job -
see CMD = 5).
RESULT (for CMD = 1) Value / meaning
Parameter Hex value/range Bit
RESULT1 0000 00*0H Bits 4−7: Codes for the receive direction
(excluded values: 0x2)
Bit 4 Connection type
• 0: no send and receive connection
• 1: Connection reserved for send and receive jobs
Bit 5 Status of current job
• 0: No receive job being executed
• 1: Receive job being executed
Bits 6+7 Previous job:
• 00: No information available on previous receive job
• 01: previous receive job completed successfully
• 10: previous receive job not completed successfully
CMD Meaning
1 CN_STATUS – connection status (CMD=1 continued)
This command returns the status of the connection selected with the ID.
The CP is selected in the LADDR parameter.
If bit 15 (reset ID) is set, this is automatically reset (this action corresponds to the CN_CLEAR_RESET job -
see CMD = 5).
RESULT (for CMD = 1) Value / meaning
Parameter Hex value/range Bit
RESULT1 0000 0*00H Bits 8-11: Codes for FETCH/WRITE
(excluded values: 0x3, 0x7, 0x8, 0xB, 0xF)
Bit 8 Connection type:
• 0: No FETCH connection
• 1: Connection reserved for FETCH jobs
Bit 9 Connection type:
• 0: No WRITE connection
• 1: Connection reserved for WRITE jobs
Bit 10 Job status (FETCH/WRITE):
• 0: Job status OK
• 1: Job status NOT OK
This ID is set in the following situations:
– The job was acknowledged negatively by the CPU
– The job could not be forwarded to the CPU be-
cause the connection was in the "LOCKED" sta-
tus.
– The job was rejected because the FETCH/WRITE
header did not have the correct structure.
Bit 11 Status of FETCH/WRITE job
• 0: No job active
• 1: Job from LAN active
CMD Meaning
1 CN_STATUS – connection status (CMD=1 continued)
This command returns the status of the connection selected with the ID.
The CP is selected in the LADDR parameter.
If bit 15 (reset ID) is set, this is automatically reset (this action corresponds to the CN_CLEAR_RESET job -
see CMD = 5).
RESULT (for CMD = 1) Value / meaning
Parameter Hex value/range Bit
RESULT1 0000 *000H Bits 12-15: General CP information
(excluded values: 0x3, 0xB)
Bit 12 + 13 Information on connection status:
(only available for SEND/RECV connections based on
the ISO/RFC/TCP protocols, with UDP, the correspond-
ing internal information is output)
• 00: Connection is terminated
• 01: Connection establishment active
• 10: Connection termination active
• 11: Connection is established
Bit 14 CP information:
• 0: CP in STOP
• 1: CP in RUN
Bit 15 Reset ID
• 0: FC10 has not yet reset a connection or the reset ID
was cleared.
• 1: The control block has executed a connection reset.
RESULT1 **** 0000H Bits 16-31: Reserved
0 – reserved for later expansions
RESULT2 0000 0000H - reserved for later expansions
CMD Meaning
2 CN_RESET – connection reset
This command resets the connection selected with ID.
The CP is selected in the LADDR parameter.
Resetting the connection means that a connection is aborted and established again (active or passive depend-
ing on the configuration). Data that has been received but not yet entered in the user program when the con-
nection aborts is deleted.
An entry is also generated in the diagnostics buffer in which the job result can be found.
RESULT (for CMD = 2) Meaning
Parameter Hex value/range
RESULT1 0000 0001H The reset job was transferred to the CP successfully.
The connection abort and subsequent connection estab-
lishment were triggered.
CMD Meaning
0000 0002H The reset job could not be transferred to the CP because
the service has not started on the CP (for example, CP in
STOP).
RESULT2 0000 0000H Default
CMD Meaning
3 CN_STATUS_ALL – all connections status
This command returns the connection status of all connections (established/terminated) in the RESULT1/2
parameters (at total of 8 bytes of group information).
The ID parameter must be set to "0" (checked for 0).
The CP is selected in the LADDR parameter.
When necessary, you can obtain detailed information about a terminated or unconfigured connection using a
further connection status call with CMD=1.
RESULT (for CMD = 3) Meaning
Parameter Hex value/range
RESULT1 **** ****H 32 bits: Connection 1 - 32
• 0 – connection terminated / not configured
• 1 – connection established
RESULT2 **** ****H 32 bits: Connection 33 - 64
• 0 – connection terminated / not configured
• 1 – connection established
CMD Meaning
4 CN_RESET_ALL – all connections reset:
This command resets all connections.
The ID parameter must be set to "0" (checked for 0).
The CP is selected in the LADDR parameter.
Resetting the connections means that connections are aborted and established again (active or passive de-
pending on the configuration). Data that has been received but not yet entered in the user program when the
connection aborts is deleted.
An entry is also generated in the diagnostics buffer in which the job result can be found.
RESULT (for CMD = 4) Meaning
Parameter Hex value/range
RESULT1 0000 0001H The reset job was transferred to the CP successfully. The
connection abort and subsequent connection establish-
ment of all connections were triggered.
RESULT1 0000 0002H The reset job could not be transferred to the CP because
the service has not started on the CP (for example, CP in
STOP).
RESULT2 0000 0000H Default
CMD Meaning
5 CN_CLEAR_RESET – Clear the reset ID
This command resets the reset ID (bit 15 in RESULT1) for the connection selected with ID.
The CP is selected in the LADDR parameter.
This job executes automatically when the connection status is read (CMD=1); the separate job described here
is therefore only required in special situations.
RESULT (for CMD = 5) Meaning
Parameter Hex value/range
RESULT1 0000 0001H The clear job was transferred to the CP successfully.
RESULT1 0000 0002H The Clear job could not be transferred to the CP because
the service has not started on the CP (for example, CP in
STOP).
RESULT2 0000 0000H Default
CMD Meaning
6 CN_DISCON − connection disconnect
This command resets the connection selected with ID and LADDR.
Resetting the connection is achieved by aborting the connection.
Any data in the stack is lost without any message being displayed. The connection is not established again
automatically afterwards. The connection can be established again with the CN_STARTCON control job. A
diagnostics buffer entry is created in which you will find the job result.
RESULT (for CMD = 6) Meaning
Parameter Hex value/range
RESULT1 0000 0001H The job was transferred to the CP successfully. The con-
nection abort was initiated.
RESULT1 0000 0002H The job could not be transferred to the CP because the
service has not started on the CP (for example, CP in
STOP).
RESULT2 0000 0000H Default
CMD Meaning
7 CN_STARTCON − start connection
This command establishes a connection selected with ID and LADDR and aborted earlier with the control job
CN_DISCON. A diagnostics buffer entry is created in which you will find the job result.
RESULT (for CMD = 7) Meaning
Parameter Hex value/range
RESULT1 0000 0001H The connection establishment job was transferred to the
CP successfully. The connection establishment was
initiated.
RESULT1 0000 0002H The connection establishment job could not be trans-
ferred to the CP because the service has not started on
the CP (for example, CP in STOP).
RESULT2 0000 0000H Default
See also
You will find further information in the FAQ under the following entry ID: 33414377
(https://support.industry.siemens.com/cs/ww/en/view/33414377)
2.3.2 AG_CNTEX
Note
AG_CNTRL and AG_CNTEX
The AG_CNTEX program block provides expanded functionality compared with the
AG_CNTRL program block.
All the functions of AG_CNTRL are included in AG_CNTEX and they can be used identically
in the user program.
Note
Availability in the block library
If the program block AG_CNTEX is not yet available in the SIMATIC_NET_CP block library,
install the current SIMATIC NET block library. You will find this under the following entry ID
on the Internet:
Link: (https://support.industry.siemens.com/cs/ww/en/view/109481127)
Call interface
Call interface in FBD representation
STL Explanation
call fb 10, DB10 ( //AG_CNTEX block call
ACT := DB11.DBX0.0, //Job trigger
ID := DB11.DBW2, //Connection ID acc. to configuration
LADDR := DB11.DBW4, //module address acc. to hardware configuration
CMD := DB11.DBW6, //Command ID
PING := P#DB11.DBX8.0, // Data area with ping data
DONE := DB11.DBX16.0, //Execution code
ERROR := DB11.DBX16.1, //Error code
STATUS := DB11.DBW18, //Status code
RESULT1 := DB11.DBD20, //Job result 1
RESULT2 := DB11.DBD24); //Job result 2
Operating principle
The following diagram shows a typical sequence of AG_CNTEX jobs in the user program.
Below you will find examples of the sequence of ping commands.
The diagram shows how the connection status is initially queried and then, in a second job,
how the connection termination is triggered with the reset command.
The reset ID (bit 15 in RESULT1) is set on the CP. If there is a status query later, it is
therefore clearly recognizable whether the connection has been reset due to a reset job. The
reset ID is cleared on the CP only after this status query or as a result of an explicit
CN_CLEAR_RESET command
Note
When the block is called, ACT = 1 must be set. If it is called with ACT=0, there is no function
call and the block is exited again immediately.
Since the job result of AG_CNTEX is obtained synchronous to the call, AG_CNTEX can be
called again in the same cycle.
Note
Ping is only possible over a configured connection
The ping command is only possible if at least one connection for the SEND/RECEIVE
interface (TCP, ISO-on-TCP, ISO-Transport, UDP) is configured.
The following schematic shows a typical sequence of a ping request with the corresponding
ping result request.
Condition codes
The following table shows the condition codes formed based on DONE, ERROR and
STATUS that must be evaluated by the user program.
The command results in the RESULT1/2 parameters must also be evaluated according to
Commands and job results - AG_CNTEX (Page 66).
Note
Command evaluation with older CP types or firmware versions
The commands described below are supported by the current CP types or firmware
versions. You should also check the more detailed information under the following entry ID:
33414377 (https://support.industry.siemens.com/cs/ww/en/view/33414377)
CMD Meaning
0 NOP – no operation
The block executes without a job being sent to the CP.
RESULT (for CMD = 0) Meaning
Parameter Hex value/range
RESULT1 0000 0001H Executed without error
RESULT2 0000 0000H Default
CMD Meaning
1 CN_STATUS – connection status
This command returns the status of the connection selected with the ID.
The CP is selected in the LADDR parameter.
If bit 15 (reset ID) is set, this is automatically reset (this action corresponds to the CN_CLEAR_RESET job -
see CMD = 5).
RESULT (for CMD = 1) Value / meaning
Parameter Hex value/range Bit
RESULT1 0000 000*H Bits 0-3: Codes for the send direction
(excluded values: 0x2)
Bit 0 Connection type
• 0: no send and receive connection
• 1: Connection reserved for send and receive jobs
Bit 1 Status of current job
• 0: No send job being executed
• 1: Send job being executed
Bits 2+3 Previous job:
• 00: No information available on previous send job
• 01: previous send job completed successfully
• 10: previous send job not completed successfully
CMD Meaning
1 CN_STATUS – connection status (continued for CMD=1)
This command returns the status of the connection selected with the ID.
The CP is selected in the LADDR parameter.
If bit 15 (reset ID) is set, this is automatically reset (this action corresponds to the CN_CLEAR_RESET job -
see CMD = 5).
RESULT (for CMD = 1) Value / meaning
Parameter Hex value/range Bit
RESULT1 0000 00*0H Bits 4−7: Codes for the receive direction
(excluded values: 0x2)
Bit 4 Connection type
• 0: No send and receive connection
• 1: Connection reserved for send and receive jobs
Bit 5 Status of current job
• 0: No receive job being executed
• 1: Receive job being executed
Bits 6+7 Previous job:
• 00: No information available on previous receive job
• 01: previous receive job completed successfully
• 10: previous receive job not completed successfully
CMD Meaning
1 CN_STATUS – connection status (continued for CMD=1)
This command returns the status of the connection selected with the ID.
The CP is selected in the LADDR parameter.
If bit 15 (reset ID) is set, this is automatically reset (this action corresponds to the CN_CLEAR_RESET job -
see CMD = 5).
RESULT (for CMD = 1) Value / meaning
Parameter Hex value/range Bit
RESULT1 0000 0*00H Bits 8-11: Codes for FETCH/WRITE
(excluded values: 0x3, 0x7, 0x8, 0xB, 0xF)
Bit 8 Connection type:
• 0: No FETCH connection
• 1: Connection reserved for FETCH jobs
Bit 9 Connection type:
• 0: No WRITE connection
• 1: Connection reserved for WRITE jobs
Bit 10 Job status (FETCH/WRITE):
• 0: Job status OK
• 1: Job status NOT OK
This ID is set in the following situations:
– The job was acknowledged negatively by the CPU
– The job could not be forwarded to the CPU be-
cause the connection was in the "LOCKED" sta-
tus.
– The job was rejected because the FETCH/WRITE
header did not have the correct structure.
Bit 11 Status of FETCH/WRITE job
• 0: No job active
• 1: Job from LAN active
CMD Meaning
1 CN_STATUS – connection status (continued for CMD=1)
This command returns the status of the connection selected with the ID.
The CP is selected in the LADDR parameter.
If bit 15 (reset ID) is set, this is automatically reset (this action corresponds to the CN_CLEAR_RESET job -
see CMD = 5).
RESULT (for CMD = 1) Value / meaning
Parameter Hex value/range Bit
RESULT1 0000 *000H Bits 12-15: General CP information
(excluded values: 0x3, 0xB)
Bit 12 + 13 Information on connection status:
(only available for SEND/RECV connections based on
the ISO/RFC/TCP protocols, with UDP, the correspond-
ing internal information is output)
• 00: Connection is terminated
• 01: Connection establishment active
• 10: Connection termination active
• 11: Connection is established
Bit 14 CP information:
• 0: CP in STOP
• 1: CP in RUN
Bit 15 Reset ID
• 0: AG_CNTEX has not yet reset a connection or the
reset ID was cleared.
• 1: AG_CNTEX caused a connection reset.
RESULT1 **** 0000H Bits 16-31: Reserved
0 – reserved for later expansions
RESULT2 0000 0000H - reserved for later expansions
CMD Meaning
2 CN_RESET – connection reset
This command resets the connection selected with ID.
The CP is selected in the LADDR parameter.
Resetting the connection means that a connection is aborted and established again (active or passive depend-
ing on the configuration). Data that has been received but not yet entered in the user program when the con-
nection aborts is deleted.
An entry is also generated in the diagnostics buffer in which the job result can be found.
RESULT (for CMD = 2) Meaning
Parameter Hex value/range
RESULT1 0000 0001H The reset job was transferred to the CP successfully.
The connection abort and subsequent connection estab-
lishment were triggered.
CMD Meaning
0000 0002H The reset job could not be transferred to the CP because
the service has not started on the CP (for example, CP in
STOP).
RESULT2 0000 0000H Default
CMD Meaning
3 CN_STATUS_ALL – all connections status
This command returns the connection status of all connections (established/terminated) in the RESULT1/2
parameters (at total of 8 bytes of group information).
The ID parameter must be set to "0" (checked for 0).
The CP is selected in the LADDR parameter.
When necessary, you can obtain detailed information about a terminated or unconfigured connection using a
further connection status call with CMD=1.
RESULT (for CMD = 3) Meaning
Parameter Hex value/range
RESULT1 **** ****H For the relevant connection:
32 bits with the following validity: • 0 – connection terminated / not configured
• For S7-400: Bits 0-31 for con- • 1 – connection established
nections 1 - 32
• For S7-300: Bits 0-15 for con-
nections 1 - 16
RESULT2 **** ****H For the relevant connection:
32 bits with the following validity: • 0 – connection terminated / not configured
• For S7-400: Bits 0-31 for con- • 1 – connection established
nections 33 - 64
CMD Meaning
4 CN_RESET_ALL – all connections reset
This command resets all connections.
The ID parameter must be set to "0" (checked for 0).
The CP is selected in the LADDR parameter.
Resetting the connections means that connections are aborted and established again (active or passive de-
pending on the configuration). Data that has been received but not yet entered in the user program when the
connection aborts is deleted.
An entry is also generated in the diagnostics buffer in which the job result can be found.
RESULT (for CMD = 4) Meaning
Parameter Hex value/range
RESULT1 0000 0001H The reset job was transferred to the CP successfully. The
connection abort and subsequent connection establish-
ment of all connections were triggered.
RESULT1 0000 0002H The reset job could not be transferred to the CP because
the service has not started on the CP (for example, CP in
STOP).
RESULT2 0000 0000H Default
CMD Meaning
5 CN_CLEAR_RESET - Clear the reset ID
This command resets the reset ID (bit 15 in RESULT1) for the connection selected with ID.
The CP is selected in the LADDR parameter.
This job executes automatically when the connection status is read (CMD=1); the separate job described here
is therefore only required in special situations.
RESULT (for CMD = 5) Meaning
Parameter Hex value/range
RESULT1 0000 0001H The clear job was transferred to the CP successfully.
RESULT1 0000 0002H The Clear job could not be transferred to the CP because
the service has not started on the CP (for example, CP in
STOP).
RESULT2 0000 0000H Default
CMD Meaning
6 CN_DISCON − connection disconnect
This command resets the connection selected with ID and LADDR.
Resetting the connection is achieved by aborting the connection.
Any data in the stack is lost without any message being displayed. The connection is not established again
automatically afterwards. The connection can be established again with the CN_STARTCON control job. A
diagnostics buffer entry is created in which you will find the job result.
RESULT (for CMD = 6) Meaning
Parameter Hex value/range
RESULT1 0000 0001H The job was transferred to the CP successfully. The con-
nection abort was initiated.
RESULT1 0000 0002H The job could not be transferred to the CP because the
service has not started on the CP (for example, CP in
STOP).
RESULT2 0000 0000H Default
CMD Meaning
7 CN_STARTCON − start connection
This command establishes a connection selected with ID and LADDR and aborted earlier with the control job
CN_DISCON. A diagnostics buffer entry is created in which you will find the job result.
RESULT (for CMD = 7) Meaning
Parameter Hex value/range
RESULT1 0000 0001H The connection establishment job was transferred to the
CP successfully. The connection establishment was
initiated.
RESULT1 0000 0002H The connection establishment job could not be trans-
ferred to the CP because the service has not started on
the CP (for example, CP in STOP).
RESULT2 0000 0000H Default
CMD Meaning
8 PING_REQUEST - Send a ping request
This command sends a ping command to the CP. The CP then initiates 4 ping echo requests to the specified
IP address.
RESULT (for CMD = 8) Meaning
Parameter Hex value/range
RESULT1 0000 0001H The ping request was sent to the CP successfully.
RESULT2 0000 0002H The ping request could not be sent to the CP because
the corresponding service was not available on the CP.
A possible cause might, for example, be: CP in STOP
mode
CMD Meaning
9 PING_RESULT - Query ping result
This command sends a ping result request to the CP. The CP transfers the results of the 4 executed ping echo
requests in the RESULT parameter.
The call is successful when the 4 ping echo requests have been completed on the part of the CP.
RESULT (for CMD = 9) Meaning
Parameter Hex value/range
RESULT1 **** ****H 1. Word:
Reply time in ms for the 1st ping echo request.
2. Word:
Reply time in ms for the 2nd ping echo request.
Example:
0005 FFFFH
Echo 1 -> received after 5 ms
Echo 2 -> no echo in the set monitoring time
RESULT2 **** ****H 1. Word:
Reply time in ms for the 3rd ping echo request.
2. Word:
Reply time in ms for the 4th ping echo request.
Example:
0002 3456H
Echo 3 -> received after 2 ms
Echo 4 -> received after 13398 ms
Range of values for data words in RESULT1 / RESULT 2:
0000H not used
0001H ... EA60H Reply time in ms
0001H = 1 ms
EA60H = 60000 ms
EA61H ... FFFEH not used
FFFFH Timeout: No echo within the specified monitoring time.
CMD Meaning
10 CONN_TYPE - Connection type
This command requests the CP to specify the current connection type for the specified connection ID.
RESULT (for CMD = 10) Meaning
Parameter Hex value/range
RESULT1 0000 000*H The request returns the following values for the possible
connection types:
0: no connection set up
1: UDP connection
2: SMTP connection
3: TCP connection
4: Free UDP connection
5: FTP connection
6: ISO transport connection
7: ISOonTCP connection
RESULT2 0000 0000H Default
See also
You will find further information in the FAQ under the following entry ID: 33414377
(https://support.industry.siemens.com/cs/ww/en/view/33414377)
Note
Note that the FTP client services of older SIMATIC S7-300 CPUs, for example the CPU 312
or CPU 315-1AF01, cannot be used because they do not support SFC24.
The following applies to S7-300s when using FC40 - FC44: The CP requires the supplied
FC5 (AG_SEND) to start the FTP FCs; do not rename the FC5 for this application.
See also
Migration of FC 40-44 to FTP_CMD (Page 85)
Validity
FB40 can be used as of the following module types:
● As of CP 343-1 Advanced - GX30*) / GX31)
● As of CP 443-1 Advanced - GX20*) / GX30
*) The commands 33 (CONNECT_PASSIVE), 17 (CONNECT_TLS_PRIVATE) and
49 (CONNECT_TLS_PRIVATE_PASSIVE) cannot be used.
**) The commands 33 (CONNECT_PASSIVE) and
49 (CONNECT_TLS_PRIVATE_PASSIVE) cannot be used
The commands 33 "CONNECT_PASSIVE" and 49 "CONNECT_TLS_PRIVATE_PASSIVE"
are only supported by the CP 443-1 Advanced as of firmware version V3.2 and as of block
version 2.2.
Meaning
Using FB40, you can establish FTP connections and transfer files from and to an FTP
server.
FB40 replaces the FTP functions FC40 to FC44 used previously. The differences in these
functions are mapped to a command parameter in FB40.
The advantages of FB40 are as follows:
● Simplification in the user program by using a command variable instead of different
function calls
● The AG_SEND (FC5) function is not required here.
● The following commands with the parameter “CMD” provide additional functions:
– APPEND
The command allows data to be appended to an existing file.
– RETR_PART
The command allows selected data areas to be read from a file.
– CONNECT_PASSIVE
Command for establishing an FTP connection
The client establishes the data connection, the server is in passive mode.
– CONNECT_TLS_PRIVATE
Command for establishing an SSL secured FTP connection
The server actively establishes the FTP data connection.
– CONNECT_TLS_PRIVATE_PASSIVE
Command for establishing an SSL secured FTP connection
The client establishes the data connection, the server is in passive mode.
Call interface
Call interface in FBD representation
STL Explanation
CALL FB 40, DB 40 ( // Block call
ID := 4, // FTP connection ID acc. to configuration
LADDR := W#16#3FFD, // Module address acc. to configuration
CMD := B#16#3, // The FTP command to be executed
NAME_STR := P#DB44.DBX 170.0 BYTE 220, // Target data area address and length
FILE_DB_NR := 42, // Number of the data block
OFFSET := DW#16#0, // (not relevant in example)
LEN := DW#16#0, // (not relevant in example)
DONE := M 420.1, // Status parameter
ERROR := M 420.2, // Error information
STATUS := MW 422); // Status information
Note
Note that the FTP client services of old SIMATIC S7-300 CPUs, for example the CPU 312 or
CPU 315-1AF01, cannot be used because they do not support SFC24.
Introduction
For status evaluation, the following parameters must be evaluated in the user program:
The DONE, ERROR and STATUS parameters are updated at every block call.
Example
During job execution, the FB40 returns the following codes:
● DONE=0
● ERROR=0
● STATUS=8181H
Meaning: Job still running.
Note
For entries coded with 8FxxH in STATUS, refer to the information in the STEP 7 Standard
and System Functions reference manual. The chapter describing error evaluation with the
RET_VAL output parameter contains detailed information.
Table 2- 14 FB 40: Meaning of the STATUS parameter in conjunction with DONE and ERROR
The corresponding parameters that specify a particular function in the functions FC40...FC43
or in the commands of FB40 are listed in the following table.
2.4.3 FTP_CONNECT
Meaning
With this function call, the FTP client establishes an FTP connection to an FTP server.
The IP address of the FTP server, the user identification (username) and (if necessary) the
password for user identification must be transferred to the FTP server.
All further access by the FTP client is then based on this user identification if you use the
same FTP connection ID. Data is then exchanged with the FTP server specified for this user.
Call interface
STL Explanation
call fc40 ( //Call FTP_CONNECT
ACT := M 420.0, //Job triggered by memory bit
ID := 4, //FTP connection ID acc. to configuration
LADDR := W#16#3FFD, //Module address acc. to configuration
LOGIN := P#DB40.DBX 0.0 BYTE 170, //Information for LOGIN in DB40
BUFFER_DB_NR := 9, //Buffer area for FTP service
DONE := M 420.1,
ERROR := M 420.2,
STATUS := MW 422);
LOGIN parameter
This parameter record has the following content for FTP_CONNECT:
2.4.4 FTP_STORE
Meaning
This function call transfers a data block (file DB) from the FTP client (S7-CPU) to the FTP
server.
You need to specify the data block that contains the file. You will also have to select the
path/file name under which the file will be created on the FTP server.
If the file (file DB) already exists on the FTP server, it will be overwritten.
Call interface
STL Explanation
call fc41 ( //Call FTP_STORE
ACT := M 420.0, //Job triggered by memory bit
ID := 4, //FTP connection ID acc. to configuration
LADDR := W#16#3FFD, //Module address acc. to configuration
FILE_NAME := P#DB40.DBX 170.0 BYTE 220, //Information for target file in DB40
BUFFER_DB_NR := 9, //Buffer area for FTP service
FILE_DB_NR := 42, DB no. in source file
DONE := M 420.1,
ERROR := M 420.2,
STATUS := MW 422);
FILE_NAME parameter
This parameter record has the following content for FTP_STORE:
2.4.5 FTP_RETRIEVE
Meaning
This function call transfers a file from the FTP server to the FTP client (S7-CPU).
You need to specify the data block in which the file will be entered. You will also have to
select the path/file name under which the file is located on the FTP server.
If the data block (file DB) on the FTP client already contains a file, it will be overwritten.
Call interface
STL Explanation
call fc42 ( //Call FTP_RETRIEVE
ACT := M 420.0, //Job triggered by memory bit
ID := 4, //FTP connection ID acc. to configuration
LADDR := W#16#3FFD, //Module address acc. to configuration
FILE_NAME := P#DB40.DBX 170.0 BYTE 220, //Information for source file in DB40
BUFFER_DB_NR := 9, //Buffer area for FTP service
FILE_DB_NR := 42, DB no. in target file
DONE := M 420.1,
ERROR := M 420.2,
STATUS := MW 422);
FILE_NAME parameter
This parameter record has the following content for FTP_RETRIEVE:
136.0 password STRING[32] 'password' Password for the login on the FTP server. 3)
170.0 filename STRING[220] 'plant1/tank2/press.dat' Name of the destination or source file
1) in each case, the maximum possible string length is specified
2) The specified values relate to the string lengths specified in "Type".
3) These rows are irrelevant for this call.
2.4.6 FTP_DELETE
Meaning
With this function call, you delete a file on the FTP server.
Call interface
STL Explanation
call fc43 ( //Call FTP_DELETE
ACT := M 420.0, //Job triggered by memory bit
ID := 4, //FTP connection ID acc. to configuration
LADDR := W#16#3FFD, //Module address acc. to configuration
FILE_NAME := P#DB40.DBX 170.0 BYTE 220, //Information for target file in DB40
BUFFER_DB_NR := 9, //Buffer area for FTP service
DONE := M 420.1,
ERROR := M 420.2,
STATUS := MW 422);
LOGIN parameter
This parameter record has the following content for FTP_DELETE:
136.0 password STRING[32] 'password' Password for the login on the FTP server.
3)
2.4.7 FTP_QUIT
Meaning
With this function call, you establish the FTP connections selected with the ID.
Call interface
STL Explanation
call fc44 ( //Call FTP_QUIT
ACT := M 420.0, //Job triggered by memory bit
ID := 4, //FTP connection ID acc. to configuration
LADDR := W#16#3FFD, //Module address acc. to configuration
DONE := M 420.1,
ERROR := M 420.2,
STATUS := MW 422);
Note
The output of FC44 must be assigned a memory word as value. If you enter DBx.DWy, an
error message is displayed (applies only to S7-300).
NOTICE
Make sure that only one FTP client program block is called per user ID as long as ACT = 1
is set.
For example, FTP_STORE and FTP_RETRIEVE must not be running on the same FTP
connection at the same time. This requirement corresponds to normal FTP functionality.
Otherwise you cannot rely on the correctness of the output parameters (DONE bit, ERROR
bit and STATUS word).
Note
For FC FTP_QUIT, use only the data type memory word for the STATUS parameter (applies
only to the CP 343-1 IT).
Example
During job execution, the FC returns the following codes:
● DONE=0
● ERROR=0
● STATUS=8181H
Note
For entries coded with 8FxxH in STATUS, refer to the information in the STEP 7 Standard
and System Functions reference manual. The chapter describing error evaluation with the
RET_VAL output parameter contains detailed information
2.4.10.1 Structure of the data blocks (file DBs) for FTP services - FTP client mode
Procedure
To transfer data with FTP, create data blocks (file DBs) on the CPU of your S7 station.
These data blocks must have certain structure to allow them to be handled as transferable
files by the FTP services. They consist of the following sections:
● Section 1: File DB header (has a fixed length of 20 bytes)
● Section 2: User data (has a variable length and structure)
2.4.10.2 Structure of the data blocks (file DBs) for FTP services - FTP server mode
Procedure
To transfer data with FTP, create data blocks (file DBs) on the CPU of your S7 station.
These data blocks must have certain structure to allow them to be handled as transferable
files by the FTP services. They consist of the following sections:
● Section 1: File DB header (has a fixed length (20 bytes) and structure)
● Section 2: User data (has a variable length and structure)
Note
Remember that the functions described here depend on the characteristics (supported
connection types) of the CP type you are using. You will find information on this in the
manuals.
Further information
You will find further information on the following topics in /1/ (Page 281):
● Properties of the configurable connection types;
● Information on configuring IP access protection;
● Information on amounts of data and configuration limits.
The configuration DB can be loaded on the CP at any time. The previously applicable
connections and configuration data (IP address, subnet mask, default router, NTP time
server and other parameters) are overwritten.
Based on the configuration data, the Ethernet CP recognizes that the communication
connections must be set up by the user program.
Note
The functions can only be executed if "Not locked" was configured for the module access
protection. Refer to the "Options" tab in the properties dialog of the CP (not available for
every CP).
The "Set IP address in user program" option must also be enabled (see properties dialog of
the CP or the Ethernet interface of the CP, "IP Configuration" tab).
Based on the configuration data, the Ethernet CP recognizes that the communication
connections must be set up by the user program.
Note
As soon as the user program transfers the connection data via FB55 IP_CONFIG, the CPU
switches the CP briefly to STOP. The CP receives the system data (including the IP
address) and the new connection data and processes them during startup (RUN).
Quantity framework
A maximum of 64 connections can be specified in program block CP_CONFIG. The most
important factor, however, is the maximum number of connections supported by the CP type
you are using.
2.5.2 Procedure
Initial situation
The steps described here assume the following:
● You have created the local S7 station and the required partner stations in your STEP7
projects.
● You have clarified the other station types with which connections must be established.
You create substitute objects for these station types in your STEP 7 projects.
Configuring CP properties
Set the CP properties in "IP Configuration": Select the "Set IP address in user program"
option.
Meaning
The configuration data block (CONF_DB) contains all the connection data and configuration
data (IP address, subnet mask, default router, NTP time server and other parameters) for an
Ethernet CP. The configuration data block is transferred to the CP with function block FB55.
① Parameter fields are described below in Parameter field for system data (IP configuration) (Page 112)
② Subfield types are described below in Parameter fields for connection types (Page 113)
See also
Subfield types (Page 119)
CONF_DB
STL
DATA_BLOCK DB271
TITLE=IP_CONFIG for 1 active nTCP connection,
AUTHOR : SIMATIC //CP-Daten : IP=200.12.1.144, Router=200.12.1.80
FAMILY : AS300 //Connection data: Destination IP-Addr=200.12.1.99,
NAME : ipconf //Local port = 4001, remote port = 5001, estab=active
VERSION : 1.0 //07-June-2005
STRUCT
DB_TYP : INT := 1;
// --------------------------------------------------------- System Data ------
sys_pb : INT:=0; // Subfield type: System data for CP
sys_id : INT:= 0; // System parameter ID, always 0
sys_sb_cnt: INT:= 3; // Number of subfields in the system parameter
ip_addr: SUB_IP_V4; field
STL
// Data structure IP Config
TYPE "SUB_IP_V4"
STRUCT
id : int := 1; // ID for IP, V4-Addr.
len: int := 8; // Sub Block Length
b_3 : BYTE := b#16#C8; // IP_High 200.
b_2 : BYTE := b#16#0C; // IP_ 12.
b_1 : BYTE := b#16#01; // IP_ 1.
b_0 : BYTE := b#16#90; // IP_Low 144
END_STRUCT;
END_TYPE
TYPE "SUB_NETMASK"
STRUCT
id : int := 2; // ID for Sub Net Mask
len: int := 8; // Sub Block Length
b_3 : BYTE := b#16#FF; // SNM_High
b_2 : BYTE := b#16#FF; // SNM_
b_1 : BYTE := b#16#FF; // SNM_
b_0 : BYTE := b#16#00; // SNM_Low
END_STRUCT;
END_TYPE
TYPE "SUB_DEF_ROUTER"
STRUCT
id : int := 8; // ID_4_Router
len: int := 8; // Sub Block Length
r_3 : BYTE := b#16#C8; // R_High
r_2 : BYTE := b#16#0C; // R_
r_1 : BYTE := b#16#01; // R_
r_0 : BYTE := b#16#50; // R_Low
END_STRUCT;
END_TYPE
STL
TYPE "SUB_LOC_PORT"
STRUCT
id : int := 9; // ID_4_LOC_PORT
len: int := 6; // Sub Block Length
port: int := 2001; // Loc. Port
END_STRUCT;
END_TYPE
TYPE "SUB_REM_PORT"
STRUCT
id : int :=10; // ID_4_REM_PORT
len: int := 6; // Sub Block Length
port: int := 2002; // Rem. Port
END_STRUCT;
END_TYPE
TYPE "CON_NAME_L" // 24 characters
STRUCT
id : int := 18; // ID for CON Name
len: int := 28; // 4+len(n[0..x]
c : ARRAY [1..24] of CHAR := ‘V’,’B’,’_’,’N’,’a’,’m’,’e’,’_’,’2’,’4’,’C’,’h’,’a’,’r’,
‘a’,’c’,’t’,’e’,’r’,’s’,’_’,’0’,’0’,’1’;
END_STRUCT;
END_TYPE
TYPE "SUB_KBUS_ADDR"
STRUCT
id : int := 21; // ID for KBUS-Address
len: int := 5; //
addr: BYTE := B#16#04; // =R0/S4
END_STRUCT
END_TYPE
TYPE "ACT_CN_REQ"
STRUCT
id : int := 22; // ID for CON REQ Mode
len: int := 5; // Sub Block Length
w : BYTE := b#16#1; // = Active
END_STRUCT;
Note:
The structures listed here must also be entered in the symbol table.
See also
Subfield types (Page 119)
Meaning
Below, you will find the parameter field for system data relevant to the IP configuration of the
CP and the subfields that need to be specified in it.
Some applications do not require all the subfield types - refer to the table for details.
Layout
On CPs with several interfaces, the structure of the parameter field described below applies
only to the PROFINET interface.
• Type = 0
• ID = 0
• Number of subfields = n
• Subfield 1
• Subfield 2
• Subfield n
...
Usable subfields
Subfield Parameter
ID Type Special features / notes Application ***)
1 SUB_IP_V4 Local IP address ++
2 SUBNET_MASK - ++
8 SUB_DEF_ROUTER - +
4 SUB_DNS_SERV_ADDR *) This subfield can occur from 0 to 4 times. The first entry is +
the primary DNS server.
14 SUB_DHCP_ENABLE 0: No DHCP +
1: DHCP
Subfield Parameter
ID Type Special features / notes Application ***)
15 SUB_CLIENT_ID - +
Note: Only useful when SUB_DHCP_ENABLE = 1
30**) SUB_DEVICE_NAME Device name complying with PROFINET IO convention +
Enter a device name to make the device individually rec-
ognizable for analysis and diagnostics in the network.
*)The subfield type is used only for E-mail connections.
**) ID is supported only be certain CP types.
***) ++ = mandatory; + = optional
See also
Subfield types (Page 119)
General
Below, you will see which values need to be entered in the parameter fields and which
subfields are used for the various connection types.
Some applications do not require all the subfield types - refer once again to the table for
details.
Connection ID
The ID parameter that precedes each connection parameter field beside the type ID is
particularly important.
On programmed connections, you can assign this ID freely within the permitted range of
values. You must then use this ID on the call interface of the FCs for the SEND/RECV
interface to identify the connection.
Range of values for the connection ID:
● S7-400: 1,2...64
● S7-300: 1,2...16
Layout
Enter the parameters in the parameter field for TCP connections as follows:
• Type = 1 -> ①
• ID = connection ID -> ②
• Number of subfields = n
• Subfield 1
• Subfield 2
• Subfield n
...
Legend:
① Identifier for the connection type
② Freely selectable connection reference; must be specified in AG_SEND / AG_RECV.
Range of values for the connection ID:
for S7-400: 1, 2...64
for S7-300: 1,2...16
Usable subfields
Subfield Parameter
ID Type Special features / notes Application ***)
1 SUB_IP_V4 IP address of the partner ++ *)
9 SUB_LOC_PORT - ++
10 SUB_REM_PORT - ++ **)
18 SUB_CONNECT_NAME - +
19 SUB_LOC_MODE - +
21 SUB_KBUS_ADR This value is always set to 2 for CPs for ++ (for S7-400)
the S7300 and does not need to be
specified.
22 SUB_CON_ESTABL - ++
*) optional for a passive connection.
***) ++ = mandatory; + = optional
See also
Subfield types (Page 119)
Layout
Enter the parameters in the parameter field for UDP connections as follows:
• Type = 2 -> ①
• ID = connection ID -> ②
• Number of subfields = n
• Subfield 1
• Subfield 2
• Subfield n
...
Legend:
① Identifier for the connection type
② Freely selectable connection reference; must be specified in AG_SEND / AG_RECV.
Range of values for the connection ID:
for S7-400: 1, 2...64
for S7-300: 1,2...16
Usable subfields
Subfield Parameter
ID Type Special features / notes Application ***)
1 SUB_IP_V4 IP address of the partner ++
9 SUB_LOC_PORT - ++
10 SUB_REM_PORT - ++
18 SUB_CONNECT_NAME - +
19 SUB_LOC_MODE - +
21 SUB_KBUS_ADR This value is always set to 2 for ++ (for S7-400)
CPs for the S7300 and does not
need to be specified.
23 SUB_ADDR_IN_DATABLOCK If the "Free UDP connection" is +
selected for this parameter, the
parameters SUB_IP_V4 and
SUB_REM_PORT are omitted.
***) ++ = mandatory; + = optional
See also
Subfield types (Page 119)
Layout
Enter the parameters in the parameter field for ISO-on-TCP connections as follows:
• Type = 3 -> ①
• ID = connection ID -> ②
• Number of subfields = n
• Subfield 1
• Subfield 2
• Subfield n
...
Legend:
① Identifier for the connection type
② Freely selectable connection reference; must be specified in AG_SEND / AG_RECV.
Range of values for the connection ID:
for S7-400: 1, 2...64
for S7-300: 1,2...16
Usable subfields
Subfield Parameter
ID Type Special features / notes Application ***)
1 SUB_IP_V4 IP address of the partner ++ *)
11 SUB_LOC_TSAP - ++
12 SUB_REM_TSAP - ++ *)
18 SUB_CONNECT_NAME - +
19 SUB_LOC_MODE - +
21 SUB_KBUS_ADR This value is always set to 2 for CPs ++ (for S7-400)
for the S7300 and does not need to
be specified.
22 SUB_CON_ESTABL - ++
*) optional on the passive connection (if the IP address is specified, the TSAP must also be specified)
***) ++ = mandatory; + = optional
See also
Subfield types (Page 119)
Meaning
To send Emails, one Email connection must be set up per Advanced CP. The Email
connection specifies the mail server via which all the mails sent by the Advanced CP are
delivered.
Layout
Enter the parameters in the parameter field for E-mail connections as follows:
• Type = 4 -> ①
• ID = connection ID -> ②
• Number of subfields = n
• Subfield 1
• Subfield 2
• Subfield n
...
Legend:
① Identifier for the connection type
② Freely selectable connection reference; must be specified in AG_SEND / AG_RECV.
Range of values for the connection ID:
for S7-400: 1, 2...64
for S7-300: 1,2...16
Usable subfields
Subfield Parameter
ID Type Special features / notes Application ***)
1 SUB_IP_V4 IP address of the mail server, over ++ / + *)
which the Emails are sent.
You can specify an absolute or alias IP
address.
The use of an alias assumes that the
Advanced CP knows the address of the
domain name server (DNS). This entry
must be made when configuring the
Advanced CP in STEP 7. For more
detailed information refer to the online
help.
3 SUB_DNS_NAME DNS name of the Email server ++ / + *)
13 SUB_EMAIL_SENDER Email address of the sender ++
18 SUB_CONNECT_NAME - +
Subfield Parameter
ID Type Special features / notes Application ***)
21 SUB_KBUS_ADR This value is always set to 0 for CPs for ++ (for S7-400)
the S7300 and does not need to be
specified.
22 SUB_CON_ESTABL - ++
**) The parameters SUB_IP_V4 and SUB_DNS_NAME are mutually exclusive; one or the other pa-
rameter must be specified.
***) ++ = mandatory; + = optional
Note
Mail server ports are "wellknown ports" and do not need to be specified.
See also
Subfield types (Page 119)
Meaning
To run an FTP job sequence between the S7 station acting as the FTP client and an FTP
server, the Advanced CP must establish a connection to the S7 CPU. This connection is
known as an FTP connection.
FTP connections are TCP connections, with the parameter SUB_LOC_MODE set to the
"FTP" mode.
Layout
Enter the parameters in the parameter field for FTP connections as follows:
• Type = 1 -> ①
• ID = connection ID -> ②
• Number of subfields = n
• Subfield 1
• Subfield 2
• Subfield n
...
Legend:
① Identifier for the connection type
② Freely selectable connection reference; must be specified in AG_SEND / AG_RECV.
Range of values for the connection ID:
for S7-400: 1, 2...64
for S7-300: 1,2...16
Usable subfields
Subfield Parameter
ID Type Special features / notes Application ***)
18 SUB_CONNECT_NAME - +
19 SUB_LOC_MODE here: 0x01 = FTP protocol ++
21 SUB_KBUS_ADR This value is always set to 0 for CPs for ++ (for S7-400)
the S7300 and does not need to be
specified.
***) ++ = mandatory; + = optional
See also
Subfield types (Page 119)
Example
The following excerpt from a CONF_DB illustrates the structure of a subfield based on the
example of the SUBNET_MASK subfield type.
0 = no DHCP
1 = DHCP
(optional)
15 SUB_CLIENT_ID Length of the client ID + (optional)
4
18 SUB_CONNECT_NAME Length of the name + 4 Name of the connection Possible characters
are: a...z, A...Z, 0...9, -, _
19 SUB_LOC_MODE 1+4 Local mode of the connection
• Range of values:
0x00 = SEND/RECV
0x80 = FETCH *)
0x40 = WRITE *)
If you do not set the parameter, the default
setting is SEND/RECV.
Note:
FETCH / WRITE require the passive connec-
tion establishment setting (see
SUB_CON_ESTABL.
0 = passive
1 = active
23 SUB_ADDR_IN_DATA-BLOCK 1+4 Select free UDP connection.
The remote node is entered in the job head-
er of the job buffer by the user program
when it calls AG_SEND. This allows any
node on Ethernet/LAN/WAN to be reached.
• Range of values:
1 = free UDP connection
0 = other
The parameter is practical only for a UDP
connection.
24 SUB_NTP_SERVER 4+4 The subfield defines an NTP server from
which the CP can obtain its time via the NTP
protocol.
For the situation when one or more NTP
servers are defined, up to 4 subfields of
ID 24 can be defined.
The subfields of ID 24 may only be installed
in the system parameter field type 0 / ID 0.
* For subfield 11 and 12: If the subblock length is an uneven number of bytes, a padding byte that has no further use is
inserted after the subblock so that there is an even byte address for the next subblock. The padding byte is not dis-
played in the subblock length, but must be taken into account in the total length of the data block.
See also
Configuration data block - example (Page 108)
Depending on the size of the configuration DB, the data may be transferred to the CP in
several segments. This means that the FB must continue to be called until the FB signals
complete transfer by setting the DONE bit to 1.
Call
Call interface in FBD representation
STL Explanation
call fb 55 ( //IP_CONFIG block call
ACT := M 10.0, //Job initiated by memory bit
LADDR := W#16#0100, //=LADDR 256 dec. in hardware configuration
CONF_DB:= P#db99.dbx10.0 byte 240, //Data block with connection data
LEN := MW 14, //Length info for the connection data
DONE := M 10.1, //Execution code
ERROR := M 10.2, //Error code
STATUS := MW 16, //Status code
EXT_STATUS := MW 18); //Cause of error in connection data
Note
No use of FB55 when operating the CP with fault-tolerant S7 connections
If you configure fault-tolerant S7 connections via the CP, you cannot use FB55 for IP
configuration of the CP.
Note
Avoid possible double addressing
If you use FB55, make sure that the assignment of IP addresses is unique. If an address is
detected twice, it is possible that the CP will not become active in the network.
Note
CPU in RUN mode
In an H system, you can only configure a CP with FB55 if the assigned CPU is in RUN.
Initially, only one rack starts up in the H system. This means that the CPU can only reach
its own peripherals (CP). As a result, you can only set parameters for the CPs in this rack
with FB55 in the startup OB (OB100).
To be able to set parameters for the CPs in the redundant rack as well, the following
procedure is recommended:
1. In OB100, program the FB55 calls for all CPs that are to received a configuration from
FB55.
2. As the individual FB55 blocks execute, save the information as to whether or not
configuration of the individual CPs was possible.
3. When the H system changes to the redundant state, OB72 (CPU redundancy error) is
called automatically. Make sure that status information is saved while OB72 executes to
indicate which configuration FBs (FB55) still need to be called.
4. Based on the previously saved status information, call the FB55 blocks in OB1 that you
require for the IP configuration in the redundant system.
Note:
In principle, you can make those FB55 calls that were unsuccessful during startup in
OB100 in OB72. Since, however, this is an FB that requires more than one call, this
would extend the execution time of the OB. This is why the procedure in OB1 described
above is recommended.
Operating principle
The following diagram illustrates the normal sequence of IP configuration and connection
configuration triggered by IP_CONFIG in the user program.
The job executes as soon as the parameter ACT is transferred with value 1.
Due to the segmented transfer of the CONF_DB, you will need to repeat the job with ACT =
1 until completion of the job is indicated in the parameters DONE, ERROR, and STATUS.
If you want to transfer a connection configuration again later, the parameter ACT must first
be transferred with value 0 in at least one further call.
Note
The data transferred with the configuration DB are stored in volatile memory on the CP and
must be downloaded to the CP again following a power down!
Condition codes
The following table shows the condition codes formed based on DONE, ERROR and
STATUS that must be evaluated by the user program.
Validity
The LOGICAL_TRIGGER program block can be used with the following module types:
● CP 343-1 ERPC
Call
Call interface in FBD representation
Operating principle
The following table shows the steps involved in a trigger call by the user program of the
CPU.
Step Meaning
1 FB56 LOGICAL_TRIGGER is called at the intended point in the user program of the
CPU with the corresponding instance DB and the selected configuration data block
CONF_DB.
• If FB56 LOGICAL_TRIGGER is called with ACT = 1, the current trigger data is read
and sent to the CP firmware.
• If FB56 LOGICAL_TRIGGER is called with ACT = 0, the status codes DONE,
ERROR and STATUS are updated.
2 FB56 LOGICAL_TRIGGER reads the current trigger data.
3 FB56 LOGICAL_TRIGGER creates the PDU that will be sent to the CP firmware with
the current data.
4 The CP firmware creates the data frame and transfers it to the ERPC application.
5 The ERPC application sends the data frame to the ERP subscriber (ERP system or
MES).
Condition codes
The following table shows the condition codes formed based on DONE, ERROR and
STATUS that must be evaluated by the user program.
Table 2- 22 FB56 LOGICAL_TRIGGER codes
*) END_STRUCT *)
*) Values are entered by the program
Note
DB size
2 048 bytes are recommended as the DB size. If it becomes apparent during commissioning
that this value is not enough, increase it. If a value is too low, this is reported by FB56
LOGICAL_TRIGGER with an error and the STATUS "8A05H".
Required resources
Note
Note the version information of the blocks. The currently supplied block versions may differ
from those shown here. Blocks with other versions have different resource requirements.
You will find information on the current block versions under entry ID:
Link: (https://support.industry.siemens.com/cs/ww/en/view/9836605)
NAME Version FC/FB no. Load memory Work memory MC7 [bytes] Local data
requirements requirements [bytes]
[bytes] [bytes]
AG_SEND 1.2 FC5 732 576 540 20
AG_RECV 1.2 FC6 656 522 486 20
AG_LOCK 1.0 FC7 272 200 164 6
AG_UNLOCK 1.0 FC8 256 186 150 6
AG_CNTRL 1.0 FC10 2048 1610 1574 178
AG_CNTEX 1.0 FB10 7002 6036 6000 78
AG_LSEND 3.1 FC50 1044 846 810 52
AG_LRECV 3.1 FC60 1190 992 956 58
AG_SSEND 1.2 FC53 1928 1618 1582 154
AG_SRECV 1.2 FC63 1882 1584 1548 158
IP_CONFIG 1.3 FB55 1864 1576 1540 76
FTP_CMD 2.0 FB40 2400 2084 2048 154
FTP_CONNECT 1.0 FC40 1482 1236 1200 86
FTP_STORE 1.0 FC41 1794 1514 1478 102
FTP_RETRIEVE 1.0 FC42 1934 1642 1606 106
FTP_DELETE 1.0 FC43 1478 1232 1196 86
FTP_QUIT 1.0 FC44 968 796 760 46
NAME Version FC/FB no. Load memory Work memory MC7 [bytes] Local data
requirements requirements [bytes]
[bytes] [bytes]
AG_SEND 4.2 FC5 1976 1664 1628 50
AG_RECV 4.7 FC6 1440 1206 1170 40
AG_LOCK 4.0 FC7 748 636 600 34
AG_UNLOCK 4.0 FC8 712 604 568 32
AG_CNTRL 1.4 FC10 1418 1152 1116 82
AG_CNTEX 1.0 FB10 4594 4006 3970 78
IP_CONFIG 1.3 FB55 2406 1984 1948 62
FTP_CMD 1.0 FB40 2590 2240 2204 70
FTP_CONNECT 1.1 FC40 928 774 738 68
FTP_STORE 1.1 FC41 1232 1046 1010 74
FTP_RETRIEVE 1.1 FC42 1306 1114 1078 84
FTP_DELETE 1.1 FC43 922 770 734 68
FTP_QUIT 1.1 FC44 452 370 334 28
LOGICAL_TRIGGER 1.0 FB56 4294 3648 3612 98
For CPs operating as PROFINET IO controller and IO device at the same time, the FCs as
of version 2.0 are available.
3.2.1 PNIO_SEND
How It works
The PNIO_SEND program block is used to transfer data in the PROFINET IO controller or
PROFINET IO device modes of the CP.
● Operating as a PROFINET IO controller
The block transfers process data (outputs) of a specified output area to the CP for
forwarding to PROFINET IO devices. As the status code, the block returns the IO
Consumer Status (IOCS) of the outputs from the PROFINET IO devices.
● Operating as a PROFINET IO device
The block reads the preprocessed process inputs of the CPU on the PROFINET IO
device and transfers them to the PROFINET IO controller (configured I addresses); the
block also returns the IO Consumer Status (IOCS) of the PROFINET IO controller as a
status code.
The preprocessed process data is available in a DB or bit memory area.
Expansions
● As of block version V2.0
PNIO_SEND supports the parallel operation of PROFINET IO controller and IO device on
one CP. With the additional MODE parameter, you set the mode for which the FC will be
called.
● As of block version V3.0
Using the MODE parameter, you have the following options for the transfer of the IO
consumer status:
– Restriction to the group status information in the CHECK_IOCS parameter optimized
for faster transfer;
or
– Additional, detailed status information in the IO Consumer Status parameter
STL Explanation
call fc 11 ( //Call PNIO_SEND
CPLADDR:=W#16#0100, //Module address from hardware configuration
MODE :=B#16#80, //Controller mode or device mode;
//IOCS status bits are not transferred.
LEN :=20, //Length of the data area
IOCS :=P#DB10.DBX20.0 BYTE 3, //One bit status per send data byte in DB10
DONE :=M 70.0, //Address for return parameter DONE
ERROR :=M 70.1, //Address for return parameter ERROR
STATUS :=MW 72, //Address for return parameter STATUS
CHECK_IOCS :=M 70.2, //Address for return parameter CHECK_IOCS
SEND :=P#DB10.DBX0.0 BYTE 20 ); //Data area to transfer from DB10
//(20 bytes)
IO device mode:
• The data is transferred in the order of the
slots as the configured input modules on
the PROFINET IO controller chain for
this PROFINET IO device.
Note:
Make sure that the length programmed
here and the configuration of the
PROFINET IO controller are consistent.
The entire data area length including any
gaps is transferred for the device.
DONE OUTPUT BOOL 0: - This parameter indicates whether or not the
1: new data accepted job was completed without errors.
ERROR OUTPUT BOOL 0: -1: Error Error code
STATUS OUTPUT WORD - Status code
Note
Wait for confirmation of execution
Execute the following actions only after the block has signaled either DONE = 1 or
ERROR = 1:
• Evaluate output parameters;
• Change the MODE parameter.
Note
You must assume that the returned IOCS status does not arrive timesynchronized with the
data (SEND parameter) but delayed by one user program cycle. This means: User data and
IOCS are not consistent.
Condition codes
The following table shows the condition codes formed based on DONE, ERROR and
STATUS that must be evaluated by the user program.
Note
For entries coded with 8FxxH in STATUS, refer to the information about the output parameter
RET_VAL in the descriptions of the referenced system program blocks.
Which system program blocks are used and are relevant for error evaluation, can be queried
in STEP 7.
3.2.2 PNIO_RECV
How It works
The PNIO_RECV program block is used to receive data in the PROFINET IO controller or
PROFINET IO device modes of the CP.
● Operating as a PROFINET IO controller
The block received the process data from PROFINET IO devices (inputs of the controller)
and the IO provider status (IOPS) from the PROFINET IO devices in the specified input
areas.
● Operating as a PROFINET IO device
The block receives the data transferred by the PROFINET IO controller (configured O
addresses) and the IO Provider Status (IOPS) of the PROFINET IO controller and writes
it to the data areas on the CPU of the PROFINET IO device reserved for the process
outputs.
Expansions
● As of block version V2.0
PNIO_RECV supports the parallel operation of PROFINET IO controller and IO device on
one CP. With the additional MODE parameter, you set the mode for which the FC will be
called.
● As of block version V3.0
Using the MODE parameter, you have the following options for the transfer of the IO
provider status:
– Restriction to the group status information in the CHECK_IOPS parameter optimized
for faster transfer;
or
– Additional, detailed status information in the IO Provider Status parameter
STL Explanation
call fc 12 ( //Call PNIO_RECV
CPLADDR :=W#16#0100, //Module address from hardware configuration
MODE :=B#16#80, //Controller mode or device mode;
//IOCS status bits are not transferred.
LEN :=7, //Length of the data area
IOPS :=P#DB11.DBX7.0 BYTE 1, //One bit status per received data byte in DB11
NDR :=M 74.0, //Address for return parameter NDR
ERROR :=M 74.1, //Address for return parameter ERROR
STATUS :=MW76, //Address for return parameter STATUS
CHECK_IOPS :=M74.2, //Address for return parameter CHECK_IOPS
ADD_INFO :=MW 26, //Diagnostic information
RECV :=P#DB11.DBX0.0 BYTE 7 ); //Received data in DB11 (7 bytes)
See also
Data consistency (Page 158)
Substitute values (Page 159)
• 8YH
IO device mode:
• The data is transferred in the order of the
slots corresponding to the configuration of
the input modules on the PROFINET IO
controller line for this PROFINET IO de-
vice.
• Note:
Make sure that the length programmed
here and the configuration of the
PROFINET IO controller are consistent.
The entire data area length including any
gaps is transferred for the device.
NDR OUTPUT BOOL 0: - This parameter indicates whether or not the
1: Data accepted job was completed without errors.
ERROR OUTPUT BOOL 0: - Error code
1: Error
STATUS OUTPUT WORD - Status code
CHECK_ OUTPUT BOOL 0: All IOPS set to GOOD Group message that indicates whether or not
IOPS 1: At least one IOPS set to it is necessary to evaluate the IOPS status
BAD area.
CHECK_IOPS is always returned regardless
of the MODE parameter.
Note
Wait for confirmation of execution
Execute the following actions only after the block has signaled either DONE = 1 or
ERROR = 1:
• Evaluate output parameters;
• Change the MODE parameter.
Condition codes
The following table shows the codes formed by the NDR, ERROR and STATUS parameters
that must be evaluated by the user program.
Note
For entries coded with 8FxxH in STATUS, refer to the information about the output
parameter RET_VAL in the descriptions of the referenced system program blocks.
Which system program blocks are used and are relevant for error evaluation, can be queried
in STEP 7.
Block call
To guarantee data consistency, you may, however, only access the IO data when the block
has completed free of errors (output parameter NDR = TRUE). You must also check that the
IOCS or IOPS status for the data is GOOD.
Example
In a normal situation (depending on the total length of the IO data), the block will run over
several user program cycles until the condition code DONE/NDR = 1 is signaled.
Note: The user program cycle and the cycle of the IO data exchange between the
PROFINET IO controller and PROFINET IO devices are independent of each other.
Operational situations
The setting of substitute values is supported for the two following operational situations:
● Substitute values during startup (mode change on the CPU from STOP to RUN)
● Substitute values if problems are detected (remove/insert or station failure/return)
3.2.6 PNIO_RW_REC
Call interface
Call interface in FBD representation:
STL Explanation
CALL FB 52, DB 52 ( //Call PNIO_RW_REC
CPLADDR := W#16#0110, //Module address from hardware configuration
WRITE_REC := M 1.1, //Job type
ID := W#16#86A, //Logical address of the module to be addressed
INDEX := W#16#8000, //Data record number
DONE := M 1.3, //Address for return parameter DONE
ERROR := M 1.1, //Address for return parameter ERROR
STATUS := MW 12, //Address for return parameter STATUS
LEN := MW 16, //Length of the data record in bytes
RECORD := P#DB3.DBX0.0 BYTE 80 ); //Target or source of the data record
//(here max. 80 bytes)
Condition codes
The following table shows the condition codes formed based on DONE, ERROR and
STATUS that must be evaluated by the user program.
Note
For entries coded with 8FxxH in STATUS, refer to the information about the output
parameter RET_VAL in the descriptions of the referenced system program blocks.
Which system program blocks are used and are relevant for error evaluation, can be queried
in STEP 7.
3.2.7 PNIO_ALARM
How It works
FB54 is used for alarm evaluation by a CP 3431 operating as PROFINET IO controller and
should be called in its user program when the ADD_INFO parameter in FC12 is not equal to
0. After complete and errorfree transfer of all OUTPUT parameters of FB54, the received
alarms are acknowledged automatically.
The alarms are forwarded to the user program in the chronological order in which they were
signaled. Older alarms that have not yet been signaled to the user program and that become
invalid due to more recent alarms are not deleted by the newer alarms.
Note
As long as the block has not yet been called, the alarms are acknowledged automatically in
the CP.
If FB54 has been called (at least) once in the user program, it must continue to be called to
acknowledge pending alarms. This is the situation when FC12 signals a value not equal to
"0" in the ADD_INFO parameter.
If FB54 is no longer called after it has been called once or more in the user program, alarms
are not acknowledged and there is no guarantee that the IO image will be updated correctly.
The can occur, for example, following a station return alarm. The need to call FB54 can only
be reset by restarting the CP (power cycle).
Call interface
Call interface in FBD representation
STL Explanation
CALL FB 54, DB 54 ( //Call PNIO_ALARM
CPLADDR:= W#16#0110, //Module address from hardware configuration
DONE := M 1.1, //Address for return parameter DONE
ERROR := M 1.2, //Address for return parameter ERROR
NEW := M 1.3, //TRUE: A new alarm was received
STATUS := MW 12, //Error code
ID := MW14, //Logical start address of the reporting component
LEN := MW 16, //Length of the received alarm information (AINFO)
MODE := MD 18, //RESERVED (value always = 0)
TINFO := P#DB4.DBX0.0 BYTE 32, //task information
AINFO := P#DB4.DBX32.0 BYTE 532 ); //alarm information
1) Reference Manual "STEP 7 - System and Standard Functions for S7-300 and S7-400",
Condition codes
The following table shows the condition codes formed by the DONE, NEW, ERROR and
STATUS parameters that must be evaluated by the user program.
Note
For entries coded with 8FxxH in STATUS, refer to the information about the output
parameter RET_VAL in the descriptions of the referenced system program blocks.
Which system program blocks are used and are relevant for error evaluation, can be queried
in STEP 7.
3.3 PROFIenergy
PROFIenergy
The PROFIenergy functions in PROFINET are used for energy management of plants.
These include the planned or spontaneous shutdown of individual field devices, units or plant
sections to save energy. The shutdown takes place during times without production or during
breaks in production. Energy and diagnostics data can be read from devices included in the
energy concept and that support these functions.
PROFIenergy controller
The commands for shutting down are output by the higher-level controller, in PROFINET IO,
the IO controller.
With the SIMATIC S7-300, an S7-300 CPU with PROFIenergy functionality can be the
PROFIenergy controller.
PROFIenergy devices
The commands of the PROFIenergy controller are processed by the IO devices with
PROFIenergy functionality to shut down connected devices in the field.
In the context of the PROFIenergy program blocks, an IO device with PROFIenergy
functionality is known as a PROFIenergy device. With the SIMATIC S7-300, an S7-300 CPU
with PROFIenergy functionality can be the PROFIenergy device.
I-devices
In SIMATIC S7, an intelligent device (I-device) itself can have subordinate PROFIenergy
devices. In this case, the I-device also has the function of a PROFIenergy controller.
PROFIenergy specification
The functions of the PROFIenergy program blocks for the CP 300 are based on the following
specification of the PROFIBUS Users Organization (PNO):
Common Application Profile PROFIenergy, Technical Specification for PROFINET,
Version 1.0, January 2010, Order No. 3.802
Note
Block calls
PE_START_END_CP, PE_CMD_CP, PE_I_DEV_CP and DS3_WRITE_CP must not be
called at the same time. The next program block can only be called after one of these
program blocks as signaled "no error" (VALID = 1) or "error" (ERROR = 1).
The program block PNIO_RW_REC must also not be called at the same time as
PE_START_END_CP, PE_CMD_CP, PE_I_DEV_CP or DS3_WRITE_CP.
3.3.2 PE_START_END_CP
Sequence
Image 3-1 Flow chart of the write/read jobs of PE_START_END_CP and PE_CMD_CP
STL Explanation
call fb 85 ( //Call program block PE_START_END_CP;
CPLADDR :=W#16#0100, //Module address from the hardware configuration;
START :=M100.0, //Address for "Start of pause" signal;
END :=M100.1, //Address for "End of pause" signal;
ID :=W#16#110, //Address of the destination device;
PAUSE_TIME :=T#10S //Specification of the pause time as IEC time;
VALID :=M100.2 //Address for VALID return parameter;
BUSY :=M110.0, //Address for BUSY return parameter;
ERROR :=M110.1, //Address for ERROR return parameter;
STATUS :=MW128, //Address for STATUS return parameter;
PE_MODE_ID :=MB111 ); //Address for the ID of the energy-saving mode
STATUS Meaning
Block-specific errors
8080h Rising edge at START and END at the same time
8081h Length conflict between CMD_PARAM and CMD_PARAM_LEN
PROFIenergy-specific errors
FE01h Invalid Service_Request_ID
STATUS Meaning
FE02h Invalid Request_Reference
FE03h Invalid CMD_MODIFIER
FE04h Invalid information about the data structure of a command (Data_Structure_Identifier_RQ) in the frame for
writing the PROFIenergy data record
FE05h Invalid information about the data structure of a command (Data_Structure_Identifier_RS) in the frame for
reading the PROFIenergy data record
FE06h Energy saving mode (PE_Mode_ID) not supported
FE07h Response longer than max transfer length
FE08h Invalid number of commands
FE09h Invalid block type (see frame header)
FE0Ah Invalid block length (see frame header)
FE0Bh Invalid block version (see frame header)
FE50h Not a suitable energy saving mode (PE_Mode_ID)
FE51h Value for PAUSE_TIME not supported
FE52h PE_Mode_ID not supported
Details on the parameters of the PROFIenergy-specific errors can be found in the section
Response data (Page 179).
See also
Condition codes of PNIO_RW_REC (Page 161)
3.3.3 PE_CMD_CP
The CMD_PARA parameter assigns the values for certain parameters to some commands
using an Any pointer. The CMD_PARA_LEN parameter specifies the length of this
parameter.
The RESPONSE_DATA parameter points to the data area of the response data of the IO
device.
STL Explanation
call fb 86 ( //Call program block PE_CMD_CP;
CPLADDR :=W#16#0100, //Module address from the hardware configuration;
REQ :=M220.0, //Address for edge signal for block execution;
ID :=W#16#110, //Address of the destination device;
CMD :=MB222, //Service_Request_ID of the PROFIenergy command;
CMD_MODIFIER :=MB224, //Modifier of the PROFIenergy command;
CMD_PARA :=MD240, //Pointer to parameter of the modifier;
CMD_PARA_LEN :=MW226, //Length of the parameter of CMD_PARA;
VALID :=M220.2 //Address for VALID return parameter;
BUSY :=M220.1, //Address for BUSY return parameter;
ERROR :=M220.3, //Address for ERROR return parameter;
STATUS :=MW228, //Address for STATUS return parameter;
RESPONSE_DATA //Address for the response data of the IO device
:=P#DB400.DBX0.0 BYTE 244 );
See also
Explanation of the formal parameters of PE_CMD_CP (Page 175)
STATUS Meaning
Block-specific errors
8081h Length conflict between CMD_PARAM and CMD_PARAM_LEN
PROFIenergy-specific errors
FE01h Invalid Service_Request_ID
FE02h Invalid Request_Reference
FE03h Invalid CMD_MODIFIER
FE04h Invalid information on the data structure of a command (Data_Structure_Identifier_RQ) in the frame for the
PROFIenergy data record to be written
FE05h Invalid information on the data structure of a command (Data_Structure_Identifier_RS) in the frame for the
PROFIenergy data record to be read
FE06h Energy saving mode (PE_Mode_ID) not supported
STATUS Meaning
FE07h Response longer than max transfer length
FE08h Invalid number of commands
FE09h Invalid block type (see frame header)
FE0Ah Invalid block length (see frame header)
FE0Bh Invalid block version (see frame header)
FE50h Not a suitable energy saving mode (PE_Mode_ID)
FE51h Value for PAUSE_TIME not supported
FE52h PE_Mode_ID not supported
Details on the parameters of the PROFIenergy-specific errors can be found in the section
Response data (Page 179).
See also
Condition codes of PNIO_RW_REC (Page 161)
* Expected time for switching over the PROFIenergy device to "ready to operate"
* Coding of bit 0:
0 = Only static time and energy measured values available.
1 = Dynamic time and energy measured values available.
Bits 1...7: Reserved
* Number of Measurement_IDs
** First supported Measurement_ID
*** Last supported Measurement_ID
1 Accuracy domain (range 1...4):
0 = Reserved
1 = Percentage of the measuring range
2 = Percentage of the current measured values
3 = Accuracy according to IEC 61557-12
4 = Accuracy according to EN 50470-3 section 8
2 Accuracy class (range 1...15):
0 = Reserved
1 (0.01%) ... 15 (>20%)
3 Measuring range if Accuracy_Domain = 1; otherwise undefined
* Number of Measurement_IDs
** First queried measured value
*** Last queried measured value
* Number of Measurement_IDs
** First queried measured value
*** Last queried measured value
3.3.5 PE_I_DEV_CP
STL Explanation
call fb 87 ( //Call program block PE_I_DEV_CP;
CPLADDR :=W#16#0100, //Module address from the hardware configuration;
RESET :=M1.0, //Signal for resetting the block;
VALID :=M1.3, //Signal for data transfer to the controller;
CMD :=MW222, //Service_Request_ID of the PROFIenergy command;
CMD_MODIFIER :=MW224, //Modifier of the PROFIenergy command;
CMD_PARA :=MD230, //Pointer to parameters of the modifier;
INDEX :=MW228, //Number of the PROFIenergy data record;
NEW :=M1.1, //Processing status of the block;
ERROR :=M1.2, //Address for the ERROR return parameter;
STATUS :=MW2, //Address for the STATUS return parameter;
RESPONSE_DATA //Address for the response data of the IO device
:=P#DB400.DBX0.0 BYTE 244 );
See also
Condition codes of PNIO_RW_REC (Page 161)
Function
The supplementary program blocks FC 0 to FC 8 support the preparation of the response
data made available to the controller by PE_I_DEV_CP:
● For the response data of each PROFIenergy command, there is a separate program
block (FC 1 - FC 8).
● FC 0 generates a common negative response for all PROFIenergy commands.
The FCs are called in the user program. In STEP 7 V5.5, they are available in the standard
library in the "PROFIenergy" folder.
The FCs have several common parameters as well as individual parameters. Some of the
common parameters of the FCs are interconnected with parameters of PE_I_DEV_CP. With
some of the individual input parameters of the FCs, the response data is entered as plain
language for the user or stored in the memory area of the IO device.
Number Name
FC 0 PE_ERROR_RSP
FC 1 PE_START_RSP
FC 2 PE_END_RSP
FC 3 PE_LIST_MODES_RSP
FC 4 PE_GET_MODE_RSP
FC 5 PE_PEM_STATUS_RSP
FC 6 PE_IDENTIFY_RSP
FC 7 PE_MEASUREMENT_LIST_RSP
FC 8 PE_MEASUREMENT_VALUE_RSP
See also
Individual parameters of the FCs (Page 191)
Note
Interconnection of the program blocks is an absolute necessity
PE_I_DEV_CP must be interconnected with FC 0...FC 8 at the parameters shown on a light
blue background that are assigned to the corresponding parameters of the FCs indicated by
red arrows.
Individual parameters of FC 0 to FC 8
Below you will find a description of the individual parameters of the FCs.
PE_ERROR_RSP
Generates a negative response if the required PROFIenergy command is generally or
temporarily not supported. The negative response is not dependent on the requesting
command.
PE_START_RSP
Initiates an energy saving pause. Generates the response to the "Start_Pause" command.
Returns the energy-saving mode adopted by the device.
Return message with the PE_Mode_ID of the energy-saving mode that the field devices or
the unit group have adopted.
PE_END_RSP
Generates the response to the "End_Pause". command
PE_LIST_MODES_RSP
Generates the response to the "Query_Modes" > modifier "List_Modes" command (list of the
supported energy-saving modes).
The IDs of the energy-saving modes must be specified in the user program.
If the devices or a group need to react differently to different lengths of pause you can set up
different energy-saving modes (PE_Mode) to achieve this. You assign a different
PE_Mode_ID to the various energy-saving modes.
Possible values for "PE_Mode_ID":
● 00h: PE_Power_off
● 01h...FEh: Freely configurable or vendor-specific
● FFh: PE_Ready_to_operate
PE_GET_MODE_RSP
Generates the response to the "Query_Modes" > Modifier "Get_Mode". command
PE_PEM_STATUS_RSP
Generates the response to the "PEM_STATUS". command
PE_IDENTIFY_RSP
Generates the response to the "PE_Identify". command
As the user you need to specify which PROFIenergy commands are supported.
PE_MEASUREMENT_LIST_RSP
Generates the response to the "Query_Measurement" > Modifier "Get_Measurement_List".
command
PE_MEASUREMENT_VALUE_RSP
Generates the response to the "Query_Measurement" > Modifier
"Get_Measurement_Values". command
STL Explanation
CALL FB 53, DB 53 ( //Call program block DS3_WRITE_CP;
CPLADDR := W#16#0110, //Module address from hardware configuration;
ENABLE := M 1.1, //Address for edge signal for block execution;
ID := W#16#86A, //Address of the header slot of the IO device;
SLOT_NO_1 := W#16#1000, //Logical address of power module 1;
FUNC_1 := M 2.1, //Address of the value of the switching behavior of power module 1;
... //...
... //...
BUSY := M 1.2, //Address for the BUSY return parameter;
DONE := M 1.3, //Address for the DONE return parameter;
ERROR := M 1.4, //Address for the ERROR return parameter;
STATUS := MW 12 ); //Address for the STATUS return parameter
For the meaning of DONE, ERROR and STATUS, see Condition codes of DS3_WRITE_CP
(Page 199).
See also
Condition codes of PNIO_RW_REC (Page 161)
Required resources
Note
Note the version information of the blocks. The currently supplied block versions may differ
from those shown here. Blocks with other versions have different resource requirements.
You will find information on the current block versions under entry ID:
Link: (https://support.industry.siemens.com/cs/ww/en/view/9836605)
NAME Version FC/FB no. Load memory Work memory MC7 [bytes] Local data
requirements requirements [bytes]
[bytes] [bytes]
PN_InOut 1.3 FB88 2678 2234 2198 48
PN_InOut_Fast 1.0 FB90 2906 2266 2230 48
NAME Version FC/FB no. Load memory Work memory MC7 [bytes] Local data
requirements requirements [bytes]
[bytes] [bytes]
PN_InOut 1.5 FB88 2470 2066 2030 54
PNIO_SEND 3.0 FC11 1420 1182 1146 46
PNIO_RECV 3.0 FC12 1270 1052 1016 46
PNIO_RW_REC 1.1 FB52 1636 1378 1342 62
PNIO_ALARM 1.1 FB54 1168 960 924 62
PE_START_END_CP 1.0 FB85 3286 2808 2772 92
PE_CMD_CP 1.0 FB86 3750 3264 3228 358
PE_I_DEV_CP 1.0 FB87 3192 2902 2866 114
DS3_WRITE_CP 1.0 FB53 1716 1408 1372 84
● With some errors, there are different codes in the STATUS parameter of FB88 and FB90;
● There are differences in the configuration limits of the interface DB (see relevant manual).
Note
For more detailed information on handling the interface DB, refer to the SIMATIC iMap
documentation.
Note
When you reload user program blocks, data consistency is only guaranteed if the CPU is
first changed to STOP.
Call interface
Call interface in FBD representation
STL Explanation
Call FB 88 , DB88 ( //Block call with instance DB88
LADDR := W#16#0120,
DONE := M 99.1,
ERROR := M 99.0,
STATUS := MW 104);
To find out which SFCs are used that are relevant for error evaluation, display the properties
dialog of the FB described here in the "Calls" tab.
Note
For entries with the coding 8FxxH (for S7-300) or 8xxxH (for S7-400) under STATUS, note
the information in the Reference Manual STEP 7 Standard and System Functions. The
chapter describing error evaluation with the RET_VAL output parameter contains detailed
information
Overview
The following program blocks are available for the SEND/RECEIVE interface for transferring
data on configured FDL connections:
Application
The following diagram illustrates the use of the FCs AG_SEND / AG_LSEND and AG_RECV
/ AG_LRECV for bi-directional data transfer on one configured FDL connection.
With certain connection types, a job header should be included in the user data area.
Image 5-2 Sending and receiving via an FDL connection with programmed broadcast addressing
|The user data area can be up to 240 bytes. Up to 236 bytes of user data can be transferred.
4 bytes are reserved for the job header.
Please note that the data length specified in the block call (LEN parameter) must include the
header and the user data!
Call
Call interface in FBD representation
STL Explanation
call fc 5 ( //Function call
ACT := M 20.0, //Job triggered by memory bit
ID := MW 22, //Connection ID acc. to configuration
LADDR := W#16#0100, //=LADDR 256 dec. in HW Config
SEND := P#db99.dbx10.0 byte 240, //Buffer with send data
LEN := MW 24, //Length for send data
DONE := M 20.1, //Execution code
ERROR := M 20.2, //Error code
STATUS := MW 26 ); //Status code
Operating principle
The following diagram illustrates the normal sequence of data transmission triggered in the
user program using AG_SEND.
The send job in executed as soon as the parameter ACT = 1 is passed.
Following this, the parameter ACT = 0 must be passed in at least one further call.
The status code in the output parameters DONE, ERROR and STATUS is updated in each
block call and can be evaluated. To update the status code without starting a new send job,
start a new block call with the parameter ACT = 0.
Refer to the sample program at the end of this section.
Condition codes
The following table shows the condition codes formed based on DONE, ERROR and
STATUS that must be evaluated by the user program.
Note
For entries coded with 8FxxH in STATUS, refer to the information about the output
parameter RET_VAL in the descriptions of the referenced system program blocks.
Which system program blocks are used and are relevant for error evaluation, can be queried
in STEP 7.
Call interface
Call interface in FBD representation
STL Explanation
call fc 6 ( //Function call
ID := MW 30, //Connection ID acc. to configuration
LADDR := W#16#0100, //=LADDR 256 dec.in HW Config
RECV := P#M 10.0 BYTE 100, //Buffer for received data
NDR := DB 100.DBX 0.6, //Receive code
ERROR := DB 100.DBX 0.7, //Execution code
STATUS := DB 100.DBW 2, //Error code
LEN := DB 100.DBW 4 ); //Status code
Table 5- 3 Return parameters in the job header in the FDL (user) data area
Operating principle
The following diagram illustrates the normal sequence of data acceptance triggered by an
AG_RECV in the user program.
Each AG_RECV job in the user program is acknowledged by the Ethernet CP with an entry
in the output parameters NDR, ERROR and STATUS.
Condition codes
The following table shows the codes formed by the NDR, ERROR and STATUS parameters
that must be evaluated by the user program.
Note
For entries coded with 8FxxH in STATUS, refer to the information about the output
parameter RET_VAL in the descriptions of the referenced system program blocks.
Which system program blocks are used and are relevant for error evaluation, can be queried
in STEP 7.
The destination area for the received data was adequately dimensioned.
Remedy: Run another receive call with maximum receive buffer size. This applies
regardless of the connection type (unicast / multicast / broadcast) and the device
family (S7-300 / S7-400).
0 1 80B2H The communication bus connection between the CPU and CP is not established.
0 1 80C0H The data record cannot be read.
0 1 80C1H The specified data record is currently being processed.
0 1 80C2H There are too many jobs pending.
0 1 80C3H Resources occupied (memory).
0 1 80C4H Communication error (occurs temporarily, it is usually best to repeat the job in the user
program).
0 1 80D2H Module start address incorrect.
Overview
The following program blocks are available for the DP master and DP slave modes with an
S7300:
Application
The following diagram illustrates the use of the DP_SEND and DP_RECV program blocks on
the DP master and DP slave.
5.2.2 DP_SEND
Meaning
The DP_SEND program block transfers data to the PROFIBUS CP. Depending on the mode
of the PROFIBUS CP, DP_SEND has the following significance:
● When used in the DP master
The block transfers the data of a specified DP output area to the PROFIBUS CP for
output to the distributed I/O system.
● When used in the DP slave
The block transfers the input data of the DP slave to the PROFIBUS CP for transfer to the
DP master
The selected data area can be a process image area, a memory bit area or a data block
area.
Correct execution is signaled when the entire DP data area could be accepted by the
PROFIBUS CP.
To start the DP master exactly one DP-SEND or DP-RECV call must precede the call
sequence. The following applies to this first call:
If DP-SEND is used for initialization, the transferred data area is not accepted and "0" is sent
to the slaves. The user data to be transferred is accepted only with the second block call.
Call interface
STL Explanation
call fc 1 ( //DP_SEND function call
CPLADDR:= W#16#0120,
SEND := P#db17.dbx0.0 byte 103,
DONE := M 99.1,
ERROR := M 99.0,
STATUS := MW 104 );
Operating principle
The following flow diagram illustrates the normal sequence of data transfer triggered with
DP_SEND in the user program.
In the diagram, it is assumed that the DP master has already been initialized by a previous
DP_SEND or DP-RECV call.
Each DP_SEND job in the user program is acknowledged by the PROFIBUS CP setting
values in the DONE, ERROR and STATUS output parameters.
Condition codes
The following table shows the condition codes formed based on DONE, ERROR and
STATUS that must be evaluated by the user program.
Note
For entries coded with 8FxxH in STATUS, refer to the information about the output
parameter RET_VAL in the descriptions of the referenced system program blocks.
Which system program blocks are used and are relevant for error evaluation, can be queried
in STEP 7.
The DP service was started but data acceptance is not yet possible.
• Normal operation
5.2.3 DP_RECV
Meaning
The DP_RECV program block receives data over PROFIBUS. DP_RECV has the following
significance depending on the mode of the PROFIBUS CP:
● When used in the DP master
DP_RECV receives the process data from the distributed I/O along with status
information and enters this in a specified DP input area.
● When used on the DP slave
DP_RECV accepts the output data transferred by the DP master in the DP data area
specified in the block.
The data area specified for the receive data can be a process image area, a bit address area
or a data block area.
Errorfree execution of the function is signaled when the entire DP data input area could be
transferred by the PROFIBUS CP.
Note that FC DP_RECV must be called successfully at least once on the DP slave in the
user program if output data was configured for this DP slave. Please read the information in
the manual.
To start the DP master exactly one DP-SEND or DP-RECV call must precede the call
sequence. The following applies to this first call:
● If DP-RECV is used for initialization, the received data is not adopted. The user data to be
received is accepted only with the second block call.
Call interface
STL Explanation
call fc 2 ( //DP_RECV function call
CPLADDR:= W#16#0120,
RECV := P#db17.dbx240.0 byte 103,
NDR := M 99.1,
ERROR := M 99.0,
STATUS := MW 104,
DPSTATUS:= MB 0 );
Operating principle
The following flow diagram illustrates the normal sequence of data transfer triggered with
DP_RECV in the user program.
Each DP_RECV job in the user program is acknowledged by the PROFIBUS CP setting
values in the NDR, ERROR and STATUS output parameters.
Condition codes
The following table shows the codes formed by the NDR, ERROR and STATUS parameters
that must be evaluated by the user program.
Note
For entries coded with 8FxxH in STATUS, refer to the information about the output
parameter RET_VAL in the descriptions of the referenced system program blocks.
Which system program blocks are used and are relevant for error evaluation, can be queried
in STEP 7.
The DP service was started but data acceptance is not yet possible.
• Normal operation
DPSTATUS
The coding of the DPSTATUS output parameter is different for the DP master mode and DP
slave mode.
DP master mode
Bit Meaning
7 not used
6 This bit is not set.
Please read the information in the manual as well.
Bit Meaning
5,4 Values for DPSTATUS of the DP master:
00 RUN
01 CLEAR
10 STOP (this is now the OFFLINE mode)
11 OFFLINE
Please read the information in the manual as well.
3 Value 1: Cyclic synchronization is active
2 Value 0: No new diagnostic data exists
Value 1: Evaluation of diagnostic list useful; at least one station has new diagnostic data
1 Value 0: All DP slaves are in the data transfer phase
Value 1: Evaluating the station list is useful
0 DP mode
Value 0: DP master mode
The other bits only have the specified meaning when this bit is not set.
DP slave mode
Bit Meaning
7-5 not used
4 This bit is not set.
Please read the information in the manual as well.
3 This bit is not set.
Please read the information in the manual as well.
2 Value 1: DP master 1 is in the CLEAR mode. The DP slave receives the value 0 in the DP data intended for the
outputs. This has no effect on the send data.
1 Value 1: The configuration/parameter assignment is not yet completed.
0 Value 1: DP slave mode.
The other bits only have the specified meaning when this bit is set.
Note
Please note, that DPSTATUS must not be evaluated until the return parameter NDR=1 is
set.
5.2.4 DP_DIAG
Note
FC DP_DIAG is only of practical use in the DP master mode.
Exclusion
As long as this block is running, it must not be supplied with new job data.
Exception: Requesting the DP station list or DP diagnostics list.
Call interface
STL Explanation
call fc 3 ( //DP_DIAG function call
CPLADDR:= W#16#0120,
DTYPE := B#16#00,
STATION:= B#16#03,
DIAG := P#db18.dbx0.0 byte 16,
NDR := M 70.0,
ERROR := M 70.1,
STATUS := MW 72,
DIAGLNG:= MB 20 );
Note
Please note the following special feature of the job types read_DP_station_list and
read_DP_diagnostic_list:
• The diagnostic job supplies the diagnostic data available at the time of the last DPRECV
call. Reading a list prevents the data from being read out again (return value 0x8182).
• The lists are released again after a new diagnostic event followed by a DPRECV call.
After calling DP_DIAG, you obtain information indicating one of the situations below:
● NDR=0, ERROR=0, STATUS=8181
As long as the code combination NDR=0, ERROR=0 and STATUS=8181 is set, the job
parameters must not be modified.
● NDR=1
The parameter value NDR=1 indicates that valid diagnostic data is available. Additional
information is possible in the STATUS parameter.
● NDR=0, ERROR=1
An error has occurred. The diagnostic data is invalid. The error message is located in
STATUS.
Job types
The following overview of the specifications for DTYPE, STATION and DIAGLNG shows the
permitted or useful entries.
*) The STOP status is no longer supported on the latest modules (as of module type DA02).
When the current diagnostic data is read out, the read pointer is reset to the first older
diagnostic data.
Condition codes
The following table shows the codes formed by the NDR, ERROR and STATUS parameters
that must be evaluated by the user program.
Note
For entries coded with 8FxxH in STATUS, refer to the information about the output
parameter RET_VAL in the descriptions of the referenced system program blocks.
Which system program blocks are used and are relevant for error evaluation, can be queried
in STEP 7.
5.2.5 DP_CTRL
There are restrictions relating to the job types listed here (please refer to the information in
the manual for the module).
Note
FC DP_CTRL is only of practical use in the DP master mode.
Connector
As long as this block is running, it must not be supplied with new job data.
Call interface
STL Explanation
call fc 4 ( //DP_CTRL block call
CPLADDR:= W#16#0120,
CONTROL:= P#db14.dbx0.0 byte 30, // The buffer for the control job
// occupies the first 30 bytes in DB 14.
DONE := M 70.0,
ERROR := M 70.1,
STATUS := MW 72 );
After calling DP_CTRL, you obtain one of the following condition code patterns as the
reaction:
● DONE=0, ERROR=0, STATUS=8181
As long as the code combination DONE=0, ERROR=0 and STATUS=8181 is set, the job
parameters must not be modified.
● DONE=1
The parameter value DONE=1 indicates that the job was executed. Additional information
is possible in the STATUS parameter.
● DONE=0, ERROR=1
An error has occurred. The error message is located in STATUS.
The length in the ANY pointer must be at least 4 (in the example, 30 has been selected).
Job types
Permitted or feasible specifications for the job are shown in the following overview based on
the specification for CTYPE and the information in the job field.
or deactivated:
• UNSYNC
• UNFREEZE
• UNCLEAR (CLEAR bit = 0)
It is possible to specify more than one job in the com-
mand mode parameter.
An active cyclic global control job can only be termi-
nated by a further global control job (cyclic or acyclic).
To terminate the job set in the command mode, the
job must be canceled. For example, the SYNC job
is canceled by an UNSYNC job.
Condition codes
The following table shows the return codes formed by the DONE, ERROR and STATUS
parameters that must be evaluated by the user program.
Note
For entries coded with 8FxxH in STATUS, refer to the information about the output
parameter RET_VAL in the descriptions of the referenced system program blocks.
Which system program blocks are used and are relevant for error evaluation, can be queried
in STEP 7.
Required resources
Note
Note the version information of the blocks. The currently supplied block versions may differ
from those shown here. Blocks with other versions have different resource requirements.
You will find information on the current block versions under entry ID:
Link: (https://support.industry.siemens.com/cs/ww/en/view/9836605)
NAME Version FC/FB no. Load memory Work memory MC7 [bytes] Local data
requirements requirements [bytes]
[bytes] [bytes]
AG_SEND 1.2 FC5 732 576 540 20
AG_RECV 1.2 FC6 656 522 486 20
AG_LSEND 3.1 FC50 1044 846 810 52
AG_LRECV 3.1 FC60 1190 992 956 58
NAME Version FC/FB no. Load memory Work memory MC7 [bytes] Local data
requirements requirements [bytes]
[bytes] [bytes]
DP_SEND 3.0 FC1 1066 886 850 42
DP_RECV 3.0 FC2 1144 950 914 46
DP_DIAG 3.0 FC3 1956 1638 1602 58
DP_CTRL 3.0 FC4 1532 1292 1256 52
AG_SEND 4.2 FC5 1976 1664 1628 50
AG_RECV 4.7 FC6 1440 1206 1170 40
Overview
The following function blocks are available for an S7 station involved in FMS communication.
The list shows the block numbers as they are when supplied. You can change these block
numbers.
FB call interfaces
The following sections describe the call interface for each FB as shown below:
Depending on the FB type, the FB has different parameters of the type INPUT, OUTPUT or
INOUT.
The following tables explain the meaning, data type, range of values and memory area of all
block parameters.
INPUT parameters
OUTPUT parameters
INPUT/OUTPUT parameters
Memory area
The abbreviated forms for the memory areas in the table correspond to the following:
6.3 IDENTIFY
Call interface
STL Explanation
call FB 2, DB 22 ( //IDENTIFY block call with instance DB
REQ := M 1.0, //Edge signal for executing the FB
ID := DW#16#10001, //Matched with configuration of the
//FMS connection
NDR := M 1.1, //Indicates when "new data accepted"
ERROR := M 1.2, //Indicates error in execution
STATUS := MW 20, //Detailed error decoding
VENDOR := "SLAVE2".VENDOR_ABBILD, //Data area for vendor name
MODEL := "SLAVE2".MODEL_ABBILD, //Data area for model
REVISION := "SLAVE2".REV_ABBILD ); //Data area for revision
Additional information
"SLAVE2"
is the symbolic name of a data block. This name is defined in the corresponding symbols
table.
VENDOR_IMAGE, MODEL_IMAGE and REVISION_IMAGE
are variables of the data type STRING. These are defined in the "SLAVE2" data block.
Operating principle
The following flow chart illustrates the normal sequence of an IDENTIFY job.
The job is activated by a (positive-going) edge change at the parameter REQ.
Each IDENTIFY job of the user program is acknowledged by the PROFIBUS CP with a value
in the output parameters NDR, ERROR and STATUS.
6.4 READ
Meaning
The READ function block reads data from a data area of the communication partner
specified by a name or index depending on the assignment of parameters for the job. The
data that is read is saved locally in a data block, an area in the process image of the
inputs/outputs or in a bit memory area.
The structure description is only read when the connection is established if the
communications variable was selected during configuration of the FMS connection.
Access rights
Remember that access rights can be set for the data transfer. Data transmission is then only
possible if the FMS client has been assigned suitable rights.
FB call interface
STL Explanation
call FB 3, DB 29 ( //READ block call with instance DB
REQ := M 1.0, //Signal edge change to execute the FB
ID := DW#16#10001, //Compared with configuration of
//FMS connection
VAR_1 := "SLAVE2".INDEX, //Addresses K variable that will be read
RD_1 := "PROZESS".Motor1, //Addresses data area as destination
NDR := M 1.1, //Confirmation of execution
ERROR := M 1.2, //Indicates incorrect execution
STATUS := MW 20 ); //Detailed error decoding
Operating principle
The following sequence chart shows the normal sequence of data reception triggered with
READ in the user program.
The job is activated by a (positive-going) edge change at the parameter REQ.
Every READ job in the user program is acknowledged by the PROFIBUS CP with values in
the output parameters NDR, ERROR and STATUS.
6.5 REPORT
Call interface
STL Explanation
call FB 4, DB 28 ( //REPORT block call with instance DB
REQ := M 1.0, //Signal edge change to execute the FB
ID := DW#16#10001, //Compared with configuration of FMS connection
VAR_1 := "SLAVE2".INDEX, //Names the C variable to be reported
SD_1 := "PROZESS".Motor1, //Addresses the source data area
DONE := M 1.1, //Confirmation of execution
ERROR := M 1.2, //Indicates incorrect execution
STATUS := MW 20 ); //Detailed error decoding
Note
The parameter SD_1 is used to address the data area from which the variable values are
read and reported. According to the FMS conventions, you also need to specify the variable
index on the FC interface. The consistency of this information is not, however, checked when
the call is executed.
Operating principle
The following flow chart shows the normal sequence of a data transfer transferred by
REPORT in the user program.
The job is activated by a (positive-going) edge change at the parameter REQ.
Every REPORT job in the user program is acknowledged by the PROFIBUS CP with values
in the output parameters DONE, ERROR and STATUS.
6.6 STATUS
Call interface
STL Explanation
call FB 5, DB 21 ( //STATUS block call with instance DB
REQ := M 1.0, //Signal edge change to execute the FB
ID := DW#16#10001, //Compared with configuration of FMS connection
NDR := M 1.1, //Indicates when new data is accepted
ERROR := M 1.2, //Indicates incorrect execution
STATUS := MW 20, //Detailed error decoding
PHYS := MB 22, //Data area for physical status
LOG := MB 23, //Data area for logical status
LOCAL := P#DB18.DBX0.0 WORD8 ); //Data area for "local detail"
Operating principle
The following flow chart shows the normal sequence of a STATUS job.
The job is activated by a (positive-going) edge change at the parameter REQ.
Every STATUS job in the user program is confirmed by the PROFIBUS CP with values in the
output parameters NDR, ERROR and STATUS.
6.7 WRITE
Meaning
The WRITE FB transfers data from a specified local data area to a data area on the
communication partner. The local data area can be a data block, an area in the process
input or output image or a bit memory area. (See also parameter SD_1, FMS block
parameter (Page 256))
The data area of the communication partner is specified using a variable name or a variable
index.
Access rights
Remember that access rights can be set for the data transfer. Data transmission is then only
possible if the FMS client has been assigned suitable rights.
Call interface
STL Explanation
call FB 6, DB 28 ( //WRITE block call with instance DB
REQ := M 1.0, //Signal edge change to execute the FB
ID := DW#16#10001, //Compared with configuration of FMS connection
VAR_1 := "SLAVE2".INDEX, //Names the C variable to be written
SD_1 := "PROZESS".Motor1, //Addresses the source data area
DONE := M 1.1, //Confirmation of execution
ERROR := M 1.2, //Indicates incorrect execution
STATUS := MW 20 ); //Detailed error decoding
Operating principle
The following flow chart shows the normal sequence of a data transfer triggered with WRITE
in the user program.
The job is activated by a (positive-going) edge change at the parameter REQ.
Every WRITE job in the user program is confirmed by the PROFIBUS CP with values in the
output parameters DONE, ERROR and STATUS.
Error classes
The possible error codes are grouped into the following error classes:
Table 6- 7 "Object dictionary" (OD) error class / VFD Status/Reject error class
Note
Note the version information of the blocks. The currently supplied block versions may differ
from those shown here. Blocks with other versions have different resource requirements.
You will find information on the current block versions under entry ID:
Link: (https://support.industry.siemens.com/cs/ww/en/view/9836605)
NAME Version FB No. Load Work MC7 [bytes] Local data Instance Instance
memory memory [bytes] DB [bytes] DB MC7
require- require- [bytes]
ments ments
[bytes] [bytes]
IDENT 1.4 2 1658 1364 1328 136 464 196
READ 1.5 3 2474 2086 2050 130 606 338
REPORT 1.5 4 2184 1818 1782 156 588 332
STATUS 1.3 5 1656 1390 1354 112 438 190
WRITE 1.5 6 2486 2094 2058 142 632 358
NAME Version FB No. Block Work MC7 [bytes] Local data Instance Instance
[bytes] memory [bytes] DB [bytes] DB MC7
require- [bytes]
ments
[bytes]
IDENT 1.6 2 1462 1254 1218 86 306 158
READ 1.5 3 1998 1700 1664 64 218 70
REPORT 1.6 4 2036 1732 1696 76 230 72
STATUS 1.6 5 1430 1244 1208 60 182 46
WRITE 1.6 6 2028 1724 1688 76 230 72
Compared with the previously valid versions of the manuals for S7 CPs, version 1 includes
the following innovations in the block descriptions:
● In the section on Industrial Ethernet
A new function block FB 40 is available for the FTP client mode of advanced CPs. Using
this FB, complete FTP job sequences can be created efficiently in the user program.
● In the section on PROFINET IO
Parameter modification in the blocks for PROFINET IO
– FC11 PNIO_SEND (block version 2.0)
– FC12 PNIO_RECV (block version 2.0)
These two functions must be used for CPs that use PROFINET IO controller and device
mode at the same time.
/1/
SIMATIC NET
S7 CPs for Industrial Ethernet
Configuring and Commissioning
Manual Part A - General Applications
Configuration Manual
Siemens AG
Link to Part A: (https://support.industry.siemens.com/cs/ww/en/view/30374198)
B.2 On programming
/2/
SIMATIC NET
Program blocks for SIMATIC NET S7 CPs
Programming Manual
Siemens AG
Link: (https://support.industry.siemens.com/cs/ww/en/view/30564821)
/3/
SIMATIC NET
Program blocks for SIMATIC NET S7 CPs
Version history, reference document
Siemens AG
Entry ID: Link: (https://support.industry.siemens.com/cs/ww/en/view/9836605)
/4/
SIMATIC
Programming with STEP 7
Siemens AG
(Part of the STEP 7 documentation package STEP 7 Basic Knowledge)
(Part of the online documentation in STEP 7)
Link: (https://support.industry.siemens.com/cs/ww/en/view/45531107)
/5/
SIMATIC
System and Standard Functions for S7-300/400 - Volume 1/2
Reference manual
Siemens AG
(Part of the STEP 7 documentation package STEP 7 Basic Knowledge)
(Part of the online documentation in STEP 7)
On the Internet under the following entry ID:
Link: (https://support.industry.siemens.com/cs/ww/en/view/1214574)
FTP connection
Parameter field for, 118
A Functions (FCs)
AG_LOCK / AG_UNLOCK, 41
Access coordination, 41
AG-RECV / AG_LRECV, 215
AG_CNTEX, 58
AG-RECV / AG_LRECV / AG_SRECV, 32
AG_CNTRL, 47
AG-SEND / AG_LSEND, 209
AG-SEND / AG_LSEND / AG_SSEND, 25
Block number, 13
B
for configured connections, 21
Block library, 202 For S5S5 connection, 207
General information, 13
C
G
CONF_DB, 124
CONF_DB see configuration data block, 107 Glossary, 5
Configuration data block, 107
Connection ID, 113
Possible values, 113 I
Connection types
ISO-on-TCP connection
Parameter fields for, 113
Parameter field for, 116
CP address, 13, 15
J
E
Job buffer, 207
E-mail connection
Job header, 23, 207, 209
Parameter field for, 117
P
F
PE_DS3_Write_ET200S_CP, 14
FB, 13, 15
PE_Mode_ID, 168, 193
Condition codes and error messages reported by
Ping command, 58, 61
the FMS partner, 274
PNIO_ALARM (FB54) block
Condition codes and error messages: locally
Formal parameter, 164
detected errors,
PNIO_RECV (FC12)
IDENTIFY, 259
Formal parameter, 151
READ, 261
PNIO_RW_REC (FB52)
REPORT, 263
Formal parameter, 160
STATUS, 265
PNIO_SEND (FC11) block
WRITE, 268
Formal parameter, 143
FC blocks
PROFIenergy controller, 167
Block number, 15
PROFIenergy device, 167
General information, 15
FCs for access coordination with FETCH/WRITE, 41
FMS
R
Condition codes and error messages, 270, 270
Module parameters, 256 Replacing a module, 15, 17
S
Service_Request_ID, 177
SIMATIC NET glossary, 5
Subfield types, 119
System data
Parameter field for, 112
T
TCP connection
Parameter field for, 114
U
UDP connection
Parameter field for, 115