Programming Example for Standard Function Blocks   
9.6 Activation, Startup Program and Cyclic Program 
  Point-to-point connection CP 440 Installation and Parameter Assignment 
136  Manual, 09/2007, A5E00057742-03 
Description of the FC 24 (CHK BCC) 
The program of the FC24 is largely identical to that of the FC23. At the end, the calculated 
block check is compared with the block check of the received data. The #RETVAL output 
parameter is output: 
●  0: Block check OK or 
●  -1: Block check error 
9.6.4 "CP440 MASTER" Program Example 
This example describes the communication between a master and several slaves. You can 
find the program sections for the individual slaves in the "CP440 SLAVE" program example. 
In OB1 the pattern is set for communication with a partner. The branch table in the "Select 
Slave" program section is used for this. Depending on the value in MW 8, either 
communication to slave 1 (FC 1 call) or 2 (FC 2 call) is selected. The program can be 
adapted to include additional slaves. 
In FC 1 a send job ("execute new Send-Job" program section with FC 11 call) and the 
associated receive job ("execute Recv-Job" program section with FC 21 call) are called by 
the slave for the response. The counter "START_TIMER" for monitoring the response is 
started with the send job. If the slave does not respond within the set monitoring time, the 
timed period expires and there is a switch to the next slave. 
9.6.5 "CP440 SLAVE" Program Example 
In FB 40, RECV is called to query whether a job has been received from the master. For this 
purpose, in the receive message frame the slave address is compared with its own address. 
As soon as there is a job, the reply is sent to the master with the SEND call.  
The parameters can be adapted for other slaves in OB 1. 
该文档是极速PDF编辑器生成,
如果想去掉该提示,请访问并下载:
http://www.jisupdfeditor.com/