Overview You can use these SFBs on all S7-400 CPUs. They support the exchange
of data with S7/M7-300/400 CPUs. These functions can be used to trans- fer up to 64 Kbytes of data via the MPI, PROFIBUS and Industrial Ether- net subnets.
Features The communication SFBs offer you acknowledged data transmission via
configured S7 links. These links are set up using STEP 7.
The communication SFBs can only be used on CPUs of the S7-400 fam- ily. Data can only be read from or written to S7-300 CPUs (PUT/GET). The communication functions are not limited to data transfer, additional functions can be used to control and monitor the communication partner. Communication is only possible within an S7 project. The communication partners must be connected to the same subnet.
Links S7 links configured using STEP 7 are required for the communication
SFBs.
These links are established on initial start of the stations and remain es- tablished permanently, even when the station switches to the STOP state. When a station restarts (warm), the links are not established anew.
Blocks These communication SFBs are integral to the operating system of the
S7-400 CPUs. The communication SFBs require instance DBs (program memory space) for the current parameters and the static data.
On the server side, no SFBs are required in the user program for the PUT and GET functions because these functions are already processed by the operating system.
Subnets To be accessible, the communication partners must be connected to a
Communication Functions for S7-300/400
Communication with SIMATIC
EWA 4NEB 710 6075-02a 4-9
Size of Useful Data The maximum size of useful data that can be transferred depends on the type of block used and the communication partner.
Block S7-400 to
S7-300 (server)
S7-400 to S7-400 S7-400 to M7-300/400
PUT/GET 160 bytes 1) 400 bytes 1)
USEND/URCV - 440 bytes 1)
BSEND/BRCV - 64 Kbytes
1)
This is the total size of the useful data for an SFB with 1 to 4 variables.
Function Classes The communication SFBs can be categorized as follows:
• Send and receive functions
• Control functions
• Monitoring functions
Communication Functions for S7-300/400
Send and Receive Functions
You can use these communication SFBs to transfer data between two communication partners.
The following SFBs (see STEP 7 documentation) are available:
Block Description
SFB 8 SFB 9
USEND URCV
High-speed transfer of data without checking, inde- pendent of the time taken to process the communi- cation function (URCV) by the communication part- ner (e.g. operating and maintenance signals). This means that the data can be overwritten with more up-to-date data at the communication partner. SFB 12
SFB 13
BSEND BRCV
Error-free transfer of a data block to a communica- tion partner, i.e. data transmission is complete only when the receive function (BRCV) in the communi- cation partner has loaded the data.
SFB 14 GET Program-controlled reading of variables without the need for additional communication functions in the user program of the communication partner. SFB 15 PUT Program-controlled writing of variables without the
need for additional communication functions in the user program of the communication partner.
Data Consistency In the case of S7-300/400 CPUs, this is the maximum data area that can be read or written as a continuous block by the operating system (e.g. PUT/GET).
An array of the data types byte, word and double-word can be transferred consistently up to a maximum CPU-specific length as follows:
CPU 31x CPU 412 CPU 413 CPU 414 CPU 416
8 bytes 32 bytes 32 bytes 32 bytes 32 bytes
If larger quantities of useful data are transferred using PUT/GET, incon- sistencies can occur.
Communication Functions for S7-300/400
Communication with SIMATIC
EWA 4NEB 710 6075-02a 4-11
Control Functions Using these communication SFBs, you can control the operating status of a communication partner.
Block Description
SFB 19 START This triggers a complete restart for an
S7/M7-300/400 CPU when it is in the STOP state. SFB 20 STOP This stops an S7/M7-300/400 CPU when it is in the
RUN, HALT or start-up state.
SFB 21 RESUME This triggers a warm restart for an S7-400 CPU when it is in the STOP state.
Monitoring Functions
Using these communication SFBs, you can obtain information about the operating status of a communication partner.
Block Description
SFB 22 STATUS Outputs the operating status of a communication partner (S7-300/400 CPU) in response to a user program request.
SFB 23 USTATUS This receives the operating status of an S7-400 CPU on status change, provided that the appropri- ate link attribute (operating status signals for send) is set.
Query Function You can use this function to query the internal status of the local commu- nication SFB and the associated link in the program.
Block Description
SFC 62 CONTROL Queries the status of a link.
Addressing The communication partner is addressed via the local link end point (local ID). The local ID is generated by STEP 7 when the link is configured. The communication partners must be within an S7 project. The local ID is only loaded when the communication SFB is initially called and remains valid until the next complete restart.
Communication Functions for S7-300/400
Parallel Arrangement of Communication SFBs
Several communication SFBs can be executed simultaneously and bidi- rectionally via a link. This is possible with the communication SFBs BSEND/BRCV and USEND/URCV.
Using R_ID (block parameter) you can allocate a send and receive SFB to the same link (same value in each case for R_ID).
Figure 4-1: Several Communication SFBs via One Link SFB 13 R_ID=2 SFB 12 BSEND BRCV URCV BSEND R_ID=1 BRCV USEND SFB 8 PUT SFB 15 R_ID=3 SFB 12 R_ID=2 SFB 13 Link R_ID=1 ID ID SFB 9 R_ID=3
Communication Functions for S7-300/400
Communication with SIMATIC
EWA 4NEB 710 6075-02a 4-13
4.4 SEND/RECEIVE Interface
Overview The principle function of the SEND/RECEIVE interface is to link the
SIMATIC S7 to the SIMATIC S5, as well as to other non-S7 stations (e.g. PCs).
This interface is built up from the loadable blocks AG_SEND and AG_RECV for S7 or the handling blocks SEND and RECEIVE for S5. These communication functions support the transfer of medium quantities of data (up to 240 bytes).
The SEND/RECEIVE interface permits data to be exchanged via:
• Industrial Ethernet (ISO transport, ISO-on-TCP)
• PROFIBUS (FDL)
The typical response time for a data transmission using AG_SEND/AG_RECEIVE is 10 ms.
Features The SEND/RECEIVE interface supports simple data transfer between two
communication partners without an acknowledgement at the user program level via a link configured using STEP 7:
• From SIMATIC S7 to SIMATIC S5
• From SIMATIC S7 to PC/programming device
• From SIMATIC S7 to non-Siemens systems
• From SIMATIC S7 to SIMATIC S7.
Communication between stations in different STEP 7 projects is possible.
Links Links configured using STEP 7 are required for the AG_SEND /
AG_RECEIVE blocks.
These links are established when the stations start up and remain estab- lished permanently, even when the CPU switches to the STOP state. When the CP is in the STOP state, all links are removed.
Communication Functions for S7-300/400
Blocks For the purpose of processing the communication via links, two loadable FC blocks are available:
Block Description
FC 5 AG_SEND This sends data blocks via a configured link to a communication partner
FC 6 AG_RECV This receives data blocks via a configured link from a communication partner
You will find the loadable blocks in SIMATIC Manager, if you have in- stalled the appropriate NCM option package, as follows:
Open file -> Library -> SIMATIC_NET_CP -> CP_300 or CP_400 -> blocks.
Size of Useful Data The maximum size of useful data that can be transferred is limited to 240 bytes for all subnets.
Data Consistency In SIMATIC S7, data up to a maximum length of 240 bytes can be trans- ferred consistently.
Link Resources For each link, a link resource is required on the CP. STEP 7 checks during configuration whether sufficient link resources are available.
Interrupt Response
The communication FCs AG_SEND and AG_RECV cannot be interrupted by OBs of a higher priority and can in certain cases therefore cause the interrupt response time to be extended.
Addressing The communication partner is addressed via the local link end point (local ID). The local ID is generated by STEP 7 when the link is configured. The communication partner can also be located within another S7 project. The local ID is only loaded when the communication FC is initially called and remains valid until the next complete restart.
Communication Functions for S7-300/400
Communication with SIMATIC
EWA 4NEB 710 6075-02a 4-15
4.5 FMS Interface
Overview The FMS interface (open communication on Layer 7 of the ISO reference
model according to the PROFIBUS standard) is used principally to connect non-Siemens systems to PROFIBUS. Data volumes of up to 240 bytes can be transferred.
The specific advantage of the FMS service is that the data structures are transferred in a neutral format and then converted in the communication partner. In the user programs of the stations, you can still use the respec- tive "programming language" regardless, e.g. STL for SIMATIC S7 and C for the PC applications.
The FMS services comprise variable services for structured data (variables) and administration services.
Features For open communication, there are special blocks on the SIMATIC S7
which support FMS services.
The FMS interface supports simple data transfer between two communi- cation partners without an acknowledgement at the user program level via a link configured using STEP 7:
• From a SIMATIC S7 with PROFIBUS-CP
• From a SIMATIC S5 with PROFIBUS-CP
• From a PC/programming device with PROFIBUS-CP
• Non-Siemens systems that support FMS services.
All global S7 variables such as bit memories, inputs, outputs and struc- tured DBs are mapped onto VMD/VFD-specific communication variables. These variables within a VMD are usually identified by names.
Links FMS links configured using STEP 7 are required for the communication
FBs.
These FMS links are established when the stations start up and remain established permanently, even when the S7 CPU switches to the STOP state.
When an S7 CPU restarts (warm), the links are not established anew.
Blocks These communication functions for FMS are implemented for the client in the form of loadable function blocks (FBs) for the S7-300/400 family. The communication FBs require instance DBs (program memory space) for the current parameters and the static data.
Communication Functions for S7-300/400
On the server side, no blocks are required by the user program. The server functions are provided by the CP with the communication functions that are integrated in the operating system of the CPU.
Block Description
FB 3 READ This FB can be used to read a variable from a communication partner without you having to place a corresponding FB in the communication partner. This function is provided in the com- munication partner by the operating system. FB 6 WRITE This FB can be used to write a variable to a
communication partner without you having to place a corresponding FB in the communication partner. This function is provided in the com- munication partner by the operating system. FB 4 REPORT For sending a structured variable to the com-
munication partner without acknowledgement. FB 2 IDENTIFY For reading the identification of a non-Siemens
system.
FB 5 STATUS For reading the status of a remote device on user request.
FB 1 ACCESS For temporarily inhibiting data access on the server side for other applications during program processing.
Communication Functions for S7-300/400
Communication with SIMATIC
EWA 4NEB 710 6075-02a 4-17
Size of Useful Data The maximum size of useful data that can be transferred depends on the type of block used.
Block Size of Useful Data
READ 237 bytes
WRITE 233 bytes
REPORT 233 bytes
Addressing The communication partner is addressed via the local link end point (local ID). The local ID is generated by STEP 7 when the link is configured. The communication partner does not have to be located within the same S7 project. The local ID is only loaded when the communication FB is initially called and remains valid until the next complete restart.
Communication Functions for S7-300/400