Programming Example for Standard Function Blocks   
9.6 Activation, Startup Program and Cyclic Program 
  Point-to-point connection CP 440 Installation and Parameter Assignment 
134  Manual, 09/2007, A5E00057742-03 
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. 
9.6.2 "CP440 1 CYC" Program Example 
This example is set up identically to the example "CP440 SEND RECV". However, the FC 21 
has been changed to allow a SEND job to be processed cyclically. 
Description of FC 21 (SEND) 
The procedure for processing a SEND job cyclically is as follows:  
●  At each block call, SEND_440 is run through with SEND_REQ=0. If neither SEND_DONE 
nor SEND_ERROR are present, the block is terminated. 
●  If SEND_DONE is present, SEND_440 is run through again with SEND_REQ=1. 
●  If SEND_ERROR is present, SEND_440 is run through with SEND_REQ=0 and then with 
SEND_REQ=1. 
To ensure that SEND_440 can be run through with SEND_REQ=1 in the very first pass, the 
SEND_STARTUP_ENDED bit is also evaluated in the program section "Check if 
SEND_DONE or SEND_ERROR or not first Cycle". This bit is at 0 during the first pass and is 
then fixed at 1. 
See also 
"CP440 SEND RECV" Program Example (Page 133) 
该文档是极速PDF编辑器生成,
如果想去掉该提示,请访问并下载:
http://www.jisupdfeditor.com/