Siemens SIMATIC S7-400 Equipment Manual page 112

Hide thumbs Also See for SIMATIC S7-400:
Table of Contents

Advertisement

Programming Example for Standard Function Blocks
9.6 Activation, Startup Program and Cyclic Program
Cyclic Program
The cyclic program is defined in the organization block OB 1.
In the example, the function blocks FB 9 "RECV_440" and FB 10 "SEND_440" work together with
the functions FC 21 and FC 22 as well as with the data blocks DB 21 and DB 22 as instance DBs
and DB 42 and DB 43 as send or receive DBs.
In the example the function blocks are assigned parameters partly via constants and partly via
symbolically addressed actual operands.
Data Transmission
Data transmission takes place from the CP 440 on slot 4 to the CP 440 on slot 5. If you work with
other communication partners, the FC 22 (RECEIVE) is not called.
Description of FC 21 (SEND)
The "Generate edge SEND_REQ" program section:
SEND_440 is run through once at the start with SEND_REQ=0.SEND_REQ is then set to 1. The
SEND_440 job is started when a signal state change from "0" to "1" is detected at the SEND_REQ
control parameter.
When SEND_DONE=1 or SEND_ERROR=1, SEND_REQ is reset to 0.
"SEND_DONE=1" program section:
If the transfer is successful, SEND_DONE is set to "1" at the parameter output of SEND_440.
To distinguish between consecutive transfers, a send counter (SEND_COUNTER_OK) is included
in data word 0 of the source block DB 42.
"SEND_ERROR=1" program section:
If SEND_440 runs through with SEND_ERROR=1, the SEND_COUNTER_ERR error counter is
incremented in data word 2. The SEND_STATUS is copied, because it is overwritten with 0 in the
next run, which means it will not be possible to read it out.
Description of FC 22 (RECEIVE)
The "Enable Receive Data" program section:
Before data can be received, the receive enable (RECV_EN_R) at block RECV_440 must be set to
"1".
"RECV_NDR=1" program section:
When RECV_NDR is set, new data has been received and the RECV_COUNTER_OK receive counter
is incremented.
"RECV_ERROR=1" program section:
If execution is unsuccessful (i.e. if the error bit is set at the parameter output of RECV_440), the
RECV_COUNTER_ERR error counter is incremented. The RECV_STATUS is copied, because it is
overwritten with 0 in the next run and it will thus not be possible to read it out.
All relevant values can be observed for test purposes in the variable table.
112
Point-to-point connection CP 440 Installation and Parameter Assignment
Equipment Manual, 03/2022, A5E00057742-AE

Advertisement

Table of Contents
loading

Table of Contents